diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 84ad4845e4..3780992851 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,9 @@ +2014-08-11 Hirofumi Kosaka + + * lib/PandoraFMS/Core.pm: Fixed modules would have ignored + ff_threshold when the module shifted from normal to critical + while its status remained unknown. + 2014-08-07 Ramon Novoa * util/recon_scripts/snmp-recon.pl, diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 590101e048..d11c14e440 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -1103,6 +1103,11 @@ sub pandora_process_module ($$$$$$$$$;$) { $min_ff_event = $module->{'min_ff_event_warning'} if ($new_status == 2); } + # replace $new_status with $last_known_status when recovering from 'unknown' + if ($status == 3) { + $new_status = $last_known_status; + } + if ($last_status == $new_status) { # Avoid overflows @@ -1132,15 +1137,24 @@ sub pandora_process_module ($$$$$$$$$;$) { # Update module status count pandora_mark_agent_for_module_update ($dbh, $agent->{'id_agente'}); } - # Set not-init or unknown modules to its current status even if min_ff_event is not matched the first time they receive data - elsif ($status == 3 || $status == 4) { + # Set not-init modules to normal status even if min_ff_event is not matched the first time they receive data. + # if critical or warning status, just pass through here and wait the time min_ff_event will be matched. + elsif ($status == 4) { + generate_status_event ($pa_config, $processed_data, $agent, $module, 0, $status, $last_known_status, $dbh); + $status = 0; + + # Update module status count + pandora_mark_agent_for_module_update ($dbh, $agent->{'id_agente'}); + } + # If unknown modules receive data, restore status even if min_ff_event is not matched. + elsif ($status == 3) { generate_status_event ($pa_config, $processed_data, $agent, $module, $new_status, $status, $last_known_status, $dbh); $status = $new_status; # Update module status count pandora_mark_agent_for_module_update ($dbh, $agent->{'id_agente'}); } - + $last_status = $new_status; # tagente_estado.last_try defaults to NULL, should default to '1970-01-01 00:00:00'