From 7f60b3921fb51bc7026df0184d158229e79b9c85 Mon Sep 17 00:00:00 2001 From: slerena Date: Tue, 4 Dec 2007 01:19:46 +0000 Subject: [PATCH] 2007-12-04 Sancho Lerena * lib/PandoraFMS/Config.pm, bin/pandora_network: This little portion of code should fix problem detected in some very extrange module "blackout" effect reported by Corona. Need check and testing before get as final. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@680 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 6 ++++++ pandora_server/bin/pandora_network | 22 ++++++++++++++++------ pandora_server/lib/PandoraFMS/Config.pm | 6 +++--- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index d46014554e..7ed613691c 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,9 @@ +2007-12-04 Sancho Lerena + + * lib/PandoraFMS/Config.pm, bin/pandora_network: This little portion of + code should fix problem detected in some very extrange module "blackout" + effect reported by Corona. Need check and testing before get as final. + 2007-11-20 Manuel Arostegui * pandora_snmpconsole,pandora_server,pandora_recon,pandora_network: Fixed diff --git a/pandora_server/bin/pandora_network b/pandora_server/bin/pandora_network index 3eaac248ee..756a00bbb8 100755 --- a/pandora_server/bin/pandora_network +++ b/pandora_server/bin/pandora_network @@ -143,13 +143,23 @@ sub pandora_network_consumer ($$) { lock %current_task_hash; $current_task_hash{$data_id_agent_module}=1; } - # Call network execution process - exec_network_module ( $pa_config, $data_id_agent_module, $dbh); + + # Executing network task with unmanaged error trapping + eval { + # Call network execution process + exec_network_module ( $pa_config, $data_id_agent_module, $dbh); + }; + if ($@){ + logger ($pa_config, "[ERROR] Network Task for module $data_id_agent_module causes a system exception", 0); + logger ($pa_config, "ERROR Code: $@", 1); + } + + # Remove from queue. If catch an error, probably data is + # not been processed, but has been freed from task queue { lock %current_task_hash; delete($current_task_hash{$data_id_agent_module}); } - $counter = 0; } else { $counter ++; @@ -262,7 +272,7 @@ sub pandora_ping_icmp { # Make more than a single ping (as defined in icmp_checks for ($temp =0; $temp < $pa_config->{'icmp_checks'}; $temp++){ - # Some hosts don't accept ICMP with too small payload. Use 16 Bytes + # Some hosts don't accept ICMP with too small payload. Use 16 Bytes min { lock $icmp_lock; $p = Net::Ping->new("icmp", $l_timeout, 32); @@ -415,7 +425,7 @@ sub pandora_query_snmp (%$$$$) { Community => $snmp_community, Version => 1); if ( (!defined($SESSION)) && ($snmp_target != "") && ($snmp_community != "") && ($snmp_oid != "")) { - logger($pa_config, "SNMP ERROR SESSION for Target $snmp_target ", 4); + logger($pa_config, "SNMP ERROR SESSION for Target $snmp_target ", 2); $_[4] = "1"; } else { # Perl uses different OID syntax than SNMPWALK or PHP's SNMP @@ -500,7 +510,7 @@ sub exec_network_module { $exec_sql->finish(); } else { $exec_sql->finish(); - logger (\%pa_config,"[ERROR] Processing data for invalid module",0); + logger (\%pa_config,"[ERROR] Processing data for invalid module", 0); return 0; } diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm index ff7c82b48f..e8c2d92ee2 100644 --- a/pandora_server/lib/PandoraFMS/Config.pm +++ b/pandora_server/lib/PandoraFMS/Config.pm @@ -34,8 +34,8 @@ our @EXPORT = qw( pandora_help_screen # There is no global vars, all variables (setup) passed as hash reference # version: Defines actual version of Pandora Server for this module only -my $pandora_version = "1.3beta3"; -my $pandora_build="PS071008"; +my $pandora_version = "1.3.1"; +my $pandora_build="PS071203"; our $VERSION = $pandora_version." ".$pandora_build; # Setup hash @@ -136,7 +136,7 @@ sub pandora_loadconfig { $pa_config->{"servername"}=~ s/\s//g; # Replace ' ' chars $pa_config->{"networkserver"}=0; $pa_config->{"dataserver"}=0; - $pa_config->{"icmp_checks"}=1; + $pa_config->{"icmp_checks"}=1; # Introduced on 1.3.1 $pa_config->{"reconserver"}=0; $pa_config->{"servermode"}=""; $pa_config->{'snmp_logfile'}="/var/log/pandora/pandora_snmptrap.log";