diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index ff41b94000..0504d3439d 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2010-07-30 Ramon Novoa + + * lib/PandoraFMS/Core.pm, bin/pandora_server: Added a real unknown + status. + 2010-07-28 Junichi Satoh * lib/PandoraFMS/PredictionServer.pm: Fixed problem that pandora diff --git a/pandora_server/bin/pandora_server b/pandora_server/bin/pandora_server index 7e8064ab19..90750cd260 100755 --- a/pandora_server/bin/pandora_server +++ b/pandora_server/bin/pandora_server @@ -230,6 +230,9 @@ while (1) { # Keepalive module control.(very DB intensive, not run frecuently pandora_module_keep_alive_nd (\%Config, $DBH); + # Set the status of unknown modules + pandora_module_unknown (\%Config, $DBH); + # Multicast status report each 30 x Server Threshold secs enterprise_hook('mcast_status_report', [\%Config, $DBH]); } diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 190da7564e..90b94e2205 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -138,6 +138,7 @@ our @EXPORT = qw( pandora_generate_compound_alerts pandora_module_keep_alive pandora_module_keep_alive_nd + pandora_module_unknown pandora_ping pandora_ping_latency pandora_planned_downtime @@ -2041,6 +2042,30 @@ sub pandora_self_monitoring ($$) { close (XMLFILE); } +########################################################################## +=head2 C<< pandora_module_unknown (I<$pa_config>, I<$dbh>) >> + +Set the status of unknown modules. + +=cut +########################################################################## +sub pandora_module_unknown ($$) { + my ($pa_config, $dbh) = @_; + + my @modules = get_db_rows ($dbh, 'SELECT tagente_modulo.nombre, tagente_estado.id_agente_estado + FROM tagente_modulo, tagente_estado, tagente + WHERE tagente.id_agente = tagente_estado.id_agente + AND tagente_modulo.id_agente_modulo = tagente_estado.id_agente_modulo + AND tagente.disabled = 0 + AND tagente_modulo.disabled = 0 + AND tagente_estado.estado <> 3 + AND (tagente_estado.current_interval = 0 OR (tagente_estado.current_interval * 2) + tagente_estado.utimestamp < UNIX_TIMESTAMP())'); + + foreach my $module (@modules) { + logger ($pa_config, "Module " . $module->{'nombre'} . " is going to UNKNOWN", 10); + db_do ($dbh, 'UPDATE tagente_estado SET last_status = estado, estado = 3 WHERE id_agente_estado = ?', $module->{'id_agente_estado'}); + } +} # End of function declaration # End of defined Code