2007-06-19 Sancho Lerena <slerena@artica.es>

* bin/PandoraFMS/DB.pm: Added support to timeframe alerts.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@525 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2007-06-19 16:57:48 +00:00
parent bda628f021
commit 5f9b26d59e
2 changed files with 116 additions and 100 deletions

View File

@ -1,3 +1,7 @@
2007-06-19 Sancho Lerena <slerena@artica.es>
* bin/PandoraFMS/DB.pm: Added support to timeframe alerts.
2007-06-18 Manuel Arostegui <marostegui@artica.es>
* specs/fedoracore5/pandora_server.spec: Added some useful tips.

View File

@ -131,6 +131,15 @@ sub pandora_calcula_alerta (%$$$$$$) {
my $min_alerts = $data[14];
my $internal_counter = $data[15];
my $alert_text = $data[16];
my $alert_disable = $data[17];
my $alert_timefrom = $data[18];
my $alert_timeto = $data[19];
my $ahora_hour = &UnixDate("today","%H");
my $ahora_min = &UnixDate("today","%M");
# time check !
if (((($ahora_hour * 60)+$ahora_min) >= ($alert_timefrom * 30)) &&
((($ahora_hour * 60)+$ahora_min) <= ($alert_timeto * 30)) ) {
my $comando ="";
logger($pa_config, "Found an alert defined for $nombre_modulo, its ID $id_alerta",4);
# Here we process alert if conditions are ok
@ -154,7 +163,9 @@ sub pandora_calcula_alerta (%$$$$$$) {
if ($s_idag_max->rows == 0) {
logger($pa_config, "ERROR Cannot find agenteModulo $id_agente_modulo",3);
logger($pa_config, "ERROR: SQL Query is $query_idag_max ",10);
} else { @data = $s_idag_max->fetchrow_array(); }
} else {
@data = $s_idag_max->fetchrow_array();
}
$max = $data_max[5];
$min = $data_max[6];
$s_idag_max->finish();
@ -236,6 +247,7 @@ sub pandora_calcula_alerta (%$$$$$$) {
$dbh->do($query_idag);
}
}
} # timecheck
} # While principal
} # if there are valid records
$s_idag->finish();