diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 531180fcdd..e38a08a104 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,11 @@ +2009-09-03 Sancho Lerena + + * lib/PandoraFMS/PredictionServer.pm: Fixed some warning on non init + variables. + + * lib/PandoraFMS/Core.pm: Now uses alert name instead alert description + in event description. + 2009-09-02 Ramon Novoa * lib/PandoraFMS/Core.pm: Decode HTML entities for all alert types. diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index fce248cfda..4472d803e3 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -213,7 +213,7 @@ sub pandora_process_alert ($$$$$$$) { # Generate an event pandora_event ($pa_config, "Alert ceased (" . - $alert->{'descripcion'} . ")", $agent->{'id_grupo'}, + $alert->{'name'} . ")", $agent->{'id_grupo'}, $agent->{'id_agente'}, $alert->{'priority'}, $id, $alert->{'id_agent_module'}, "alert_recovered", $dbh); @@ -401,7 +401,7 @@ sub pandora_execute_alert ($$$$$$$) { # Generate an event my ($text, $event) = ($alert_mode == 0) ? ('recovered', 'alert_recovered') : ('fired', 'alert_fired'); - pandora_event ($pa_config, "Alert $text (" . $alert->{'description'} . ")", + pandora_event ($pa_config, "Alert $text (" . $alert->{'name'} . ")", $agent->{'id_grupo'}, $agent->{'id_agente'}, $alert->{'priority'}, (defined ($alert->{'id_template_module'})) ? $alert->{'id_template_module'} : 0, $alert->{'id_agent_module'}, $event, $dbh); } diff --git a/pandora_server/lib/PandoraFMS/PredictionServer.pm b/pandora_server/lib/PandoraFMS/PredictionServer.pm index a725c5a94e..c34f355911 100644 --- a/pandora_server/lib/PandoraFMS/PredictionServer.pm +++ b/pandora_server/lib/PandoraFMS/PredictionServer.pm @@ -184,10 +184,11 @@ sub exec_prediction_module ($$$$) { $temp1 = $week_utimestamp[$i] + $agent_module->{'module_interval'}; # Get data for week $i in the past + $average_interval = get_db_value ($dbh, 'SELECT AVG(datos) FROM tagente_datos WHERE id_agente_modulo = ? AND utimestamp > ? AND utimestamp < ?', $target_module->{'id_agente_modulo'}, $week_utimestamp[$i], $temp1); # Need to get data outside interval because no data. - if ($average_interval == 0){ + if (!(defined($average_interval)) || ($average_interval == 0)) { $last_data = get_db_value ($dbh, 'SELECT datos FROM tagente_datos WHERE id_agente_modulo = ? AND utimestamp > ? LIMIT 1', $target_module->{'id_agente_modulo'}, $week_utimestamp[$i]); $sum_data++ if ($last_data != 0);