2007-10-01 Sancho Lerena <slerena@gmail.com>

* lib/PandoraFMS/DB.pm: Fixed bug for autoimported modules #1805654

        * lib/PandoraFMS/DB.pm: Fixed problem with fixed alerts. Now reports when
        problem its fixed in event manager (after threshold expires!).



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@662 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2007-10-01 13:44:37 +00:00
parent 1192e5fb85
commit 1f17677712
2 changed files with 34 additions and 7 deletions

View File

@ -1,3 +1,10 @@
2007-10-01 Sancho Lerena <slerena@gmail.com>
* lib/PandoraFMS/DB.pm: Fixed bug for autoimported modules #1805654
* lib/PandoraFMS/DB.pm: Fixed problem with fixed alerts. Now reports when
problem its fixed in event manager (after threshold expires!).
2007-08-28 Sancho Lerena <slerena@gmail.com>
* util/pandora_db.pl: Added some fixes and new checks for database

View File

@ -246,9 +246,26 @@ sub pandora_calcula_alerta (%$$$$$$) {
# database until a real alarm was fired
my $query_idag = "UPDATE talerta_agente_modulo SET times_fired = 0, internal_counter = 0 WHERE id_aam = $id_aam ";
$dbh->do($query_idag);
my $evt_descripcion = "Alert ceased ($nombre_agente $descripcion)";
pandora_event ($pa_config, $evt_descripcion, $id_grupo, $id_agente, $dbh);
}
}
} # timecheck
else { # Outside operative alert timeslot
my $temp_aam_check = give_db_value ( "internal_counter", "talerta_agente_modulo", "id_aam", $id_aam, $dbh);
if ($temp_aam_check > 0){
my $query_idag = "UPDATE talerta_agente_modulo SET times_fired = 0, internal_counter = 0 WHERE id_aam = $id_aam ";
$dbh->do($query_idag);
my $evt_descripcion = "Alert ceased ($nombre_agente $descripcion)";
pandora_event ($pa_config, $evt_descripcion, $id_grupo, $id_agente, $dbh);
}
}
# Check for alert UP event. If any alert have $have_alert 0
# we check if have a internal_counter value > 0. If it does
# reset internal and raise an event with "Alert UP".
} # While principal
} # if there are valid records
$s_idag->finish();
@ -654,7 +671,7 @@ sub module_generic_data_inc (%$$$$$) {
my $timestamp_anterior = 0;
my $m_utimestamp = &UnixDate ($m_timestamp, "%s");
if ($id_agente_modulo == -1) {
if (($id_agente_modulo == -1) && (dame_learnagente($pa_config, $id_agente, $dbh) eq "1" )) {
$id_agente_modulo = crea_agente_modulo ($pa_config, $agent_name, $module_type, $m_name, $a_max, $a_min, $a_desc, $dbh);
$no_existe = 1;
} else {
@ -1426,11 +1443,14 @@ sub dame_learnagente (%$$) {
if ($s_idag->rows == 0) {
logger( $pa_config, "ERROR dame_learnagente(): Cannot find agente $id_agente",2);
logger( $pa_config, "ERROR: SQL Query is $query ",2);
} else { @data = $s_idag->fetchrow_array(); }
return 0;
} else {
@data = $s_idag->fetchrow_array();
my $learn= $data[6];
$s_idag->finish();
return $learn;
}
}
##########################################################################