From c3b0c19136e0cc53c56260266655c5f202332da4 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Tue, 24 Sep 2013 10:02:32 +0000 Subject: [PATCH] 2013-09-24 Ramon Novoa * lib/PandoraFMS/WMIServer.pm: Some HTML entities were not being decoded. * lib/PandoraFMS/Core.pm: Set the severity or alert recovery events to NORMAL. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8802 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 8 ++++++++ pandora_server/lib/PandoraFMS/Core.pm | 6 +++--- pandora_server/lib/PandoraFMS/WMIServer.pm | 5 +++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 90ed2ad083..af68db5de5 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,11 @@ +2013-09-24 Ramon Novoa + + * lib/PandoraFMS/WMIServer.pm: Some HTML entities were not being + decoded. + + * lib/PandoraFMS/Core.pm: Set the severity or alert recovery events to + NORMAL. + 2013-09-22 Junichi Satoh * bin/tentacle_server: Upgraded to 0.4.0. (Imported from trunk of diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 6c5f9fe37c..19389f9a4b 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -690,11 +690,11 @@ sub pandora_execute_alert ($$$$$$$$;$) { # Generate an event only if an event has not already been generated by an alert action if ($event_generated == 0) { - #If we've spotted an alert recovered, we set the new event's severity to 0, otherwise the original value is maintained. - my ($text, $event, $severity) = ($alert_mode == 0) ? ('recovered', 'alert_recovered', 0) : ('fired', 'alert_fired', $alert->{'priority'}); + #If we've spotted an alert recovered, we set the new event's severity to 2 (NORMAL), otherwise the original value is maintained. + my ($text, $event, $severity) = ($alert_mode == 0) ? ('recovered', 'alert_recovered', 2) : ('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), $severity, (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/WMIServer.pm b/pandora_server/lib/PandoraFMS/WMIServer.pm index 9278dc5238..d9aee78247 100644 --- a/pandora_server/lib/PandoraFMS/WMIServer.pm +++ b/pandora_server/lib/PandoraFMS/WMIServer.pm @@ -159,10 +159,11 @@ sub data_consumer ($$) { } # WMI query - my $wmi_query = decode_entities($module->{'snmp_oid'}); + my $wmi_query = $module->{'snmp_oid'}; $wmi_query =~ s/\"/\'/g; $wmi_command .= ' //' . $module->{'ip_target'} . ' "' . $wmi_query . '"'; + $wmi_command = safe_output ($wmi_command); logger ($pa_config, "Executing AM # $module_id WMI command '$wmi_command'", 9); # Execute command @@ -192,7 +193,7 @@ sub data_consumer ($$) { my @row = split(/\|/, $output[2]); # Get the specified column - $module_data = $row[$module->{'tcp_port'}] if defined ($row[$module->{'tcp_port'}]); + $module_data = $row[$module->{'tcp_port'}] if (defined ($module->{'tcp_port'}) && defined ($row[$module->{'tcp_port'}])); if ($module_data =~ m/^ERROR/) { pandora_update_module_on_error ($pa_config, $module, $dbh); return;