diff --git a/pandora_agents/ChangeLog b/pandora_agents/ChangeLog index e8af129176..2cfbc25c1f 100644 --- a/pandora_agents/ChangeLog +++ b/pandora_agents/ChangeLog @@ -1,3 +1,10 @@ +2012-05-10 Sergio Martin + + * unix/Linux/pandora_agent.conf + unix/pandora_agent: Added units parameter to the + agent and added units to the default modules in + conf for pending task #3520530 + 2012-05-08 Dario Rodriguez * unix/Linux/pandora_agent.conf: Fixed an example module name. diff --git a/pandora_agents/unix/Linux/pandora_agent.conf b/pandora_agents/unix/Linux/pandora_agent.conf index e575fc15ce..3ca601aec8 100755 --- a/pandora_agents/unix/Linux/pandora_agent.conf +++ b/pandora_agents/unix/Linux/pandora_agent.conf @@ -168,6 +168,7 @@ module_min_warning 70 module_max_warning 90 module_min_critical 91 module_max_critical 100 +module_unit % module_end #Get load average @@ -188,6 +189,7 @@ module_min_warning 500 module_max_warning 600 module_min_critical 100 module_max_critical 499 +module_unit MB module_end #Count total number of processes @@ -200,6 +202,7 @@ module_min_warning 150 module_max_warning 249 module_min_critical 250 module_max_critical 300 +module_unit processes module_end # Process information @@ -220,7 +223,7 @@ module_exec last | head -1 module_description Monitor last user loggin module_end -# Module that get the number or cron file +# Module that get the number of cron file # This module uses a precondition, if cron is running the # module will check the folder /etc/cron.d to get the number of files module_begin @@ -229,6 +232,7 @@ module_type async_string module_precondition =~ .*cron.* ps aux | grep cron module_exec ls -l /etc/cron.d | awk 'NR>1 {print $0}' | wc -l module_description Number of cron task files +module_unit files module_end diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 5e77658da0..41adb3b086 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -356,6 +356,7 @@ sub parse_conf_modules($) { 'intensive_conditions' => [], 'intensive_match' => 0, 'timestamp' => 0, + 'unit' => '', }; } elsif ($line =~ /^\s*module_name\s+(.+)$/) { $module->{'name'} = $1; @@ -498,6 +499,9 @@ sub parse_conf_modules($) { # Min ff event } elsif ($line =~ /^\s*module_min_ff_event\s+(.*)\s*$/) { $module->{'min_ff_event'} = $1; + # Unit + } elsif ($line =~ /^\s*module_unit\s+(\S+)\s*$/) { + $module->{'unit'} = $1; } } return; @@ -1580,6 +1584,9 @@ sub write_module_xml ($@) { # Min ff event $Xml .= " " . $module->{'min_ff_event'} . "\n" if (defined ($module->{'min_ff_event'})); + + # Unit + $Xml .= " " . $module->{'unit'} . "\n" if (defined ($module->{'unit'})); # Data list if ($#data > 0) {