From 6aebffcaabe703856072e2cc0e3cddf9b04f4ba0 Mon Sep 17 00:00:00 2001 From: slerena Date: Mon, 10 Dec 2012 19:09:58 +0000 Subject: [PATCH] 2012-12-10 Sancho Lerena * Core.pm: Applied patch 3576115 from Axel: implemented maintance priority from events coming from recovery alerts. * Tool.pm: Decode output in all logfile output. * Config.pm: Updated version. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7249 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 9 +++++++++ pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/Core.pm | 9 ++++++--- pandora_server/lib/PandoraFMS/Tools.pm | 5 ++++- pandora_server/pandora_server_installer | 2 +- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index e6b9e33d5d..22cfaefc3a 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,12 @@ +2012-12-10 Sancho Lerena + + * Core.pm: Applied patch 3576115 from Axel: implemented maintance + priority from events coming from recovery alerts. + + * Tool.pm: Decode output in all logfile output. + + * Config.pm: Updated version. + 2012-12-09 Junichi Satoh * FreeBSD/tentacle_server: Changed how to get pid of tentacle_server diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index 52c49d8d5e..c7bfe5c5cc 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -43,7 +43,7 @@ our @EXPORT = qw( # version: Defines actual version of Pandora Server for this module only my $pandora_version = "5.0dev"; -my $pandora_build = "120621"; +my $pandora_build = "121210"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 0f9b8be36d..cbc429e028 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -773,10 +773,13 @@ sub pandora_execute_alert ($$$$$$$$;$) { my $unknown_instructions = get_db_value ($dbh, 'SELECT unknown_instructions FROM tagente_modulo WHERE id_agente_modulo = ?', $alert->{'id_agent_module'}); # Generate an event - my ($text, $event) = ($alert_mode == 0) ? ('recovered', 'alert_recovered') : ('fired', 'alert_fired'); - + #If we've spotted an alert recovered, we set the new event's severity to 0, otherwise the original value is maintained. + my $severity; + my ($text, $event, $severity) = ($alert_mode == 0) ? ('recovered', 'alert_recovered', 0) : ('fired', 'alert_fired', $alert->{'priority'}); + + pandora_event ($pa_config, "Alert $text (" . safe_output($alert->{'name'}) . ") " . (defined ($module) ? 'assigned to ('. safe_output($module->{'nombre'}) . ")" : ""), - (defined ($agent) ? $agent->{'id_grupo'} : 0), (defined ($agent) ? $agent->{'id_agente'} : 0), $alert->{'priority'}, (defined ($alert->{'id_template_module'}) ? $alert->{'id_template_module'} : 0), + (defined ($agent) ? $agent->{'id_grupo'} : 0), (defined ($agent) ? $agent->{'id_agente'} : 0), $alert->{'priority'}, (defined ($alert->{'id_template_module'}) ? $alert->{'id_template_module'} : 0), (defined ($alert->{'id_agent_module'}) ? $alert->{'id_agent_module'} : 0), $event, 0, $dbh, 'Pandora', '', '', '', '', $critical_instructions, $warning_instructions, $unknown_instructions); } diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index ee31f05d42..640121bf3f 100644 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -447,7 +447,10 @@ sub md5check { ######################################################################## sub logger ($$;$) { my ($pa_config, $message, $level) = @_; - + + # Clean any string and ready to be printed in screen/file + $message = safe_output ($message); + $level = 1 unless defined ($level); return if ($level > $pa_config->{'verbosity'}); diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index c8a8f563e9..00f82d6cd2 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -4,7 +4,7 @@ # Linux/FreeBSD Version (generic), for SuSe, Debian/Ubuntu and FreeBSD only # other Linux distros could not work properly without modifications # Please see http://www.pandorafms.org -# v4.0dev Build 111026 +# v5.0 Build 121210 # This code is licensed under GPL 2.0 license. # **********************************************************************