2011-04-20 Ramon Novoa <rnovoa@artica.es>

* lib/PandoraFMS/Core.pm,
	  lib/PandoraFMS/DataServer.pm: Module status can be set from the XML
	  data file.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4271 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
ramonn 2011-04-20 15:55:28 +00:00
parent c4307abaed
commit a88b222db2
3 changed files with 16 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2011-04-20 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm,
lib/PandoraFMS/DataServer.pm: Module status can be set from the XML
data file.
2011-04-20 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm: Added _policy_ macro to alerts (Enterprise).

View File

@ -1634,6 +1634,13 @@ sub get_module_status ($$$) {
my ($critical_min, $critical_max, $warning_min, $warning_max) =
($module->{'min_critical'}, $module->{'max_critical'}, $module->{'min_warning'}, $module->{'max_warning'});
# Was the module status set in the XML data file?
if (defined ($module->{'status'})) {
return 1 if (uc ($module->{'status'}) eq 'CRITICAL');
return 2 if (uc ($module->{'status'}) eq 'WARNING');
return 0 if (uc ($module->{'status'}) eq 'NORMAL');
}
# Set default critical max/min for *proc modules
if ($module_type =~ m/_proc$/ && ($critical_min eq $critical_max)) {
($critical_min, $critical_max) = (0, 1);

View File

@ -548,6 +548,9 @@ sub process_module_data ($$$$$$$$$) {
my $data_object = get_module_data($data, $module_type);
my $extra_macros = get_macros_for_data($data, $module_type);
# Get module status from XML data file if available
$module->{'status'} = get_tag_value ($data, 'status', undef);
pandora_process_module ($pa_config, $data_object, $agent, $module, $module_type, $timestamp, $utimestamp, $server_id, $dbh, $extra_macros);
}