From 4897288d66f5e43520a07c66b8ea760b349dc8c4 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Thu, 10 May 2012 12:18:43 +0000 Subject: [PATCH] 2012-05-10 Sergio Martin * lib/PandoraFMS/DB.pm lib/PandoraFMS/Core.pm: Added the macro _alert_text_severity_ to the alerts git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6284 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 6 +++++ pandora_server/lib/PandoraFMS/Core.pm | 1 + pandora_server/lib/PandoraFMS/DB.pm | 32 +++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 8beb0e644b..c12e4feef7 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,9 @@ +2012-05-10 Sergio Martin + + * lib/PandoraFMS/DB.pm + lib/PandoraFMS/Core.pm: Added the macro _alert_text_severity_ to + the alerts + 2012-05-09 Dario Rodriguez * util/plugin/ipmi-plugin.pl, diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 3237f1d6b1..85826ebde4 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -762,6 +762,7 @@ sub pandora_execute_action ($$$$$$$$$;$) { _alert_threshold_ => $alert->{'time_threshold'}, _alert_times_fired_ => $alert->{'times_fired'}, _alert_priority_ => $alert->{'priority'}, + _alert_text_severity_ => get_priority_name($alert->{'priority'}), _module_ => (defined ($module)) ? $module->{'nombre'} : '', _modulegroup_ => (defined ($module)) ? (get_module_group_name ($dbh, $module->{'id_module_group'}) || '') : '', _moduledescription_ => (defined ($module)) ? $module->{'descripcion'} : '', diff --git a/pandora_server/lib/PandoraFMS/DB.pm b/pandora_server/lib/PandoraFMS/DB.pm index bee96ef962..33bfd2643f 100644 --- a/pandora_server/lib/PandoraFMS/DB.pm +++ b/pandora_server/lib/PandoraFMS/DB.pm @@ -65,6 +65,7 @@ our @EXPORT = qw( get_os_id get_plugin_id get_profile_id + get_priority_name get_server_id get_template_id get_template_module_id @@ -674,6 +675,37 @@ sub db_concat ($$) { } +########################################################################## +## Get priority/severity name from the associated ID +########################################################################## +sub get_priority_name ($) { + my ($priority_id) = @_; + + if($priority_id == 0) { + return 'Maintenance'; + } + elsif($priority_id == 1) { + return 'Informational'; + } + elsif($priority_id == 2) { + return 'Normal'; + } + elsif($priority_id == 3) { + return 'Warning'; + } + elsif($priority_id == 4) { + return 'Critical'; + } + elsif($priority_id == 5) { + return 'Minor'; + } + elsif($priority_id == 6) { + return 'Major'; + } + + return ''; +} + # End of function declaration # End of defined Code