mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
2009-02-04 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/DB.pm: Read template default action on alert execution. * bin/pandora_snmpconsole: Fixed SNMP alerts. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1425 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
0d04075c58
commit
9f72cad019
@ -1,3 +1,10 @@
|
|||||||
|
2009-02-04 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* lib/PandoraFMS/DB.pm: Read template default action on alert
|
||||||
|
execution.
|
||||||
|
|
||||||
|
* bin/pandora_snmpconsole: Fixed SNMP alerts.
|
||||||
|
|
||||||
2009-02-04 Ramon Novoa <rnovoa@artica.es>
|
2009-02-04 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
* lib/PandoraFMS/DB.pm: Use db_do instead of db_update.
|
* lib/PandoraFMS/DB.pm: Use db_do instead of db_update.
|
||||||
|
@ -197,8 +197,7 @@ sub calcula_alerta_snmp {
|
|||||||
my $dbh = $_[6];
|
my $dbh = $_[6];
|
||||||
my $alert_fired = 0;
|
my $alert_fired = 0;
|
||||||
|
|
||||||
my $query_idag = "select * from talert_snmp";
|
my $s_idag = $dbh->prepare("SELECT * FROM talert_snmp");
|
||||||
my $s_idag = $dbh->prepare($query_idag);
|
|
||||||
$s_idag ->execute;
|
$s_idag ->execute;
|
||||||
my @data;
|
my @data;
|
||||||
# Read all alerts and apply to this incoming trap
|
# Read all alerts and apply to this incoming trap
|
||||||
@ -273,15 +272,19 @@ sub calcula_alerta_snmp {
|
|||||||
logger($pa_config,"Executing SNMP Trap alert for $agent - $alert_data",2);
|
logger($pa_config,"Executing SNMP Trap alert for $agent - $alert_data",2);
|
||||||
|
|
||||||
# Create a hash for passing to execute_alert
|
# Create a hash for passing to execute_alert
|
||||||
my %data_alert;
|
my %data_alert = (
|
||||||
$data_alert{'id_aam'} = 0;
|
'name' => '',
|
||||||
$data_alert{'id_agente_modulo'} = 0;
|
'id_agent_module' => 0,
|
||||||
$data_alert{'id_alerta'} = $id_alert;
|
'id_template_module' => 0,
|
||||||
$data_alert{'al_campo1'} = $field1;
|
'field1' => $field1,
|
||||||
$data_alert{'al_campo2'} = $field2;
|
'field2' => $field2,
|
||||||
$data_alert{'al_campo3'} = $field3;
|
'field3' => $field3,
|
||||||
$data_alert{'descripcion'} = $description;
|
'description' => $description,
|
||||||
$data_alert{'priority'} = $alert_priority;
|
'times_fired' => $times_fired,
|
||||||
|
'time_threshold' => 0,
|
||||||
|
'id_alert_action' => $id_alert,
|
||||||
|
'priority' => $alert_priority,
|
||||||
|
);
|
||||||
|
|
||||||
# Execute alert
|
# Execute alert
|
||||||
execute_alert ($pa_config, \%data_alert, 0, 0, $agent, $trap_agente, 1, $dbh);
|
execute_alert ($pa_config, \%data_alert, 0, 0, $agent, $trap_agente, 1, $dbh);
|
||||||
|
@ -540,7 +540,13 @@ sub execute_alert (%$$$$$$$$$$$$$$$) {
|
|||||||
OR (" . $alert->{'times_fired'} . " >= fires_min AND " . $alert->{'times_fired'} . " <= fires_max))", $dbh);
|
OR (" . $alert->{'times_fired'} . " >= fires_min AND " . $alert->{'times_fired'} . " <= fires_max))", $dbh);
|
||||||
|
|
||||||
if ($#actions < 0) {
|
if ($#actions < 0) {
|
||||||
return;
|
# Get default action
|
||||||
|
@actions = get_db_all_rows ("SELECT * FROM talert_actions, talert_commands
|
||||||
|
WHERE talert_actions.id = " . $alert->{'id_alert_action'} .
|
||||||
|
" AND talert_actions.id_alert_command = talert_commands.id", $dbh);
|
||||||
|
if ($#actions < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get agent address
|
# Get agent address
|
||||||
@ -566,7 +572,7 @@ sub execute_alert (%$$$$$$$$$$$$$$$) {
|
|||||||
_address_ => $address,
|
_address_ => $address,
|
||||||
_timestamp_ => &UnixDate ("today", "%Y-%m-%d %H:%M:%S"),
|
_timestamp_ => &UnixDate ("today", "%Y-%m-%d %H:%M:%S"),
|
||||||
_data_ => $data,
|
_data_ => $data,
|
||||||
_alert_description_ => $alert->{'descripcion'},
|
_alert_description_ => $alert->{'description'},
|
||||||
_alert_threshold_ => $alert->{'time_threshold'},
|
_alert_threshold_ => $alert->{'time_threshold'},
|
||||||
_alert_times_fired_ => $alert->{'times_fired'},
|
_alert_times_fired_ => $alert->{'times_fired'},
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user