diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 158fae4025..dddace6494 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2011-10-06 Koichiro Kikuchi + + * lib/PandoraFMS/DB.pm: Added function to get module group name. + * lib/PandoraFMS/Core.pm: Added new alert macros. + 2011-09-29 Sancho Lerena * pandora_server/lib/PandoraFMS/SNMPServer.pm diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 3b37da84b3..c4b1e488b2 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -728,8 +728,12 @@ sub pandora_execute_action ($$$$$$$$$;$) { _alert_times_fired_ => $alert->{'times_fired'}, _alert_priority_ => $alert->{'priority'}, _module_ => (defined ($module)) ? $module->{'nombre'} : '', + _modulegroup_ => (defined ($module)) ? (get_module_group_name ($dbh, $module->{'id_module_group'}) || '') : '', _moduledescription_ => (defined ($module)) ? $module->{'descripcion'} : '', _id_agent_ => (defined ($module)) ? $module->{'id_agente'} : '', + _interval_ => (defined ($module) && $module->{'module_interval'} != 0) ? $module->{'module_interval'} : (defined ($agent)) ? $agent->{'intervalo'} : '', + _target_ip_ => (defined ($module)) ? $module->{'ip_target'} : '', + _target_port_ => (defined ($module)) ? $module->{'tcp_port'} : '', _policy_ => (defined ($module)) ? enterprise_hook('get_policy_name', [$dbh, $module->{'id_policy_module'}]) : '', ); diff --git a/pandora_server/lib/PandoraFMS/DB.pm b/pandora_server/lib/PandoraFMS/DB.pm index e8ed0840bb..69e70b749f 100644 --- a/pandora_server/lib/PandoraFMS/DB.pm +++ b/pandora_server/lib/PandoraFMS/DB.pm @@ -56,6 +56,7 @@ our @EXPORT = qw( get_group_name get_module_agent_id get_module_group_id + get_module_group_name get_module_id get_module_name get_nc_profile_name @@ -301,6 +302,15 @@ sub get_module_group_id ($$) { return defined ($rc) ? $rc : -1; } +########################################################################## +## Return module group name given the module group id. +########################################################################## +sub get_module_group_name ($$) { + my ($dbh, $module_group_id) = @_; + + return get_db_value ($dbh, "SELECT name FROM tmodule_group WHERE id_mg = ?", $module_group_id); +} + ########################################################################## ## Return a network component's profile name given its ID. ##########################################################################