From 9a38226e1d0304e6cbd62bb55912204302772bae Mon Sep 17 00:00:00 2001 From: slerena Date: Mon, 1 Sep 2008 08:53:01 +0000 Subject: [PATCH] =?UTF-8?q?=C3=A72008-09-01=20=20Sancho=20Lerena=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lib/PandoraFMS/DB.pm: Sending mail now replaces macros also in the subject. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1054 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 6 ++++++ pandora_server/lib/PandoraFMS/DB.pm | 24 ++++++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index f3527b7892..bde29c6cf3 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,9 @@ + +2008-09-01 Sancho Lerena + + * lib/PandoraFMS/DB.pm: Sending mail now replaces macros also + in the subject. + 2008-08-28 Evi Vanoost * util/pandora2ast: Pandora to Asterisk script. Check README for how to diff --git a/pandora_server/lib/PandoraFMS/DB.pm b/pandora_server/lib/PandoraFMS/DB.pm index ad087bcbd4..9e4fe6d3eb 100644 --- a/pandora_server/lib/PandoraFMS/DB.pm +++ b/pandora_server/lib/PandoraFMS/DB.pm @@ -545,9 +545,15 @@ sub execute_alert (%$$$$$$$$$$$$$$$) { pandora_audit ($pa_config, $field1, $agent, "Alert ($alert_description)", $dbh); $create_event = 0; } elsif ($id_alert == 2) { # email + + $field2 =~ s/_agent_/$agent/ig; + $field2 =~ s/_timestamp_/$timestamp/ig; + $field2 =~ s/_data_/$data/ig; + $field3 =~ s/_agent_/$agent/ig; $field3 =~ s/_timestamp_/$timestamp/ig; $field3 =~ s/_data_/$data/ig; + pandora_sendmail ( $pa_config, $field1, $field2, $field3); } elsif ($id_alert == 4) { # internal event $create_event = 1; @@ -631,6 +637,16 @@ sub pandora_writestate (%$$$$$$$) { @data = $s_idag->fetchrow_array(); } + # Postprocess management + + if ((defined($data[23])) && ($data[23] != 0) && (is_numeric($data[23]))){ + if (($id_modulo == 1) || ($id_modulo == 7) || ($id_modulo == 15) || ($id_modulo == 22) || ($id_modulo == 4) || ($id_modulo == 8) || ($id_modulo == 16) ){ + $datos = $datos * $data[23]; + } + } + + $s_idag->finish(); + # Get module interval or agent interval if module don't defined my $id_module_type = $data[2]; my $module_interval = $data[7]; @@ -656,14 +672,6 @@ sub pandora_writestate (%$$$$$$$) { my $s_idages = $dbh->prepare($idages); $s_idages ->execute; - # Postprocess management - - if ((defined($data[23])) && ($data[23] != 0) && (is_numeric($data[23]))){ - if (($id_modulo == 1) || ($id_modulo == 7) || ($id_modulo == 15) || ($id_modulo == 22) || ($id_modulo == 4) || ($id_modulo == 8) || ($id_modulo == 16) ){ - $datos = $datos * $data[23]; - } - } - # Apply Mysql quotes to data to prepare for database insertion / update $datos = $dbh->quote($datos); # Parse data entry for adecuate SQL representation.