diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index a8366fb7ad..c9b07e264f 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2011-09-01 Ramon Novoa + + * lib/PandoraFMS/SNMPServer.pm: Kill snmptrapd if it's already running + when the SNMP Console starts and launch it again. Fixes bug #3402392. + 2011-09-01 Sergio Martin * lib/PandoraFMS/Core.pm: Improve the delete modules diff --git a/pandora_server/lib/PandoraFMS/SNMPServer.pm b/pandora_server/lib/PandoraFMS/SNMPServer.pm index 67ad794b2b..a11c4d463e 100644 --- a/pandora_server/lib/PandoraFMS/SNMPServer.pm +++ b/pandora_server/lib/PandoraFMS/SNMPServer.pm @@ -56,14 +56,15 @@ sub new ($$;$) { my $pid = + 0; close PIDFILE; - # check if snmptrapd is running + # Check if snmptrapd is running if ($snmptrapd_running = kill (0, $pid)) { - logger ($config, "snmptrapd (pid $pid) is already running, using existing process.", 1); - print_message ($config, "snmptrapd (pid $pid) is already running, using existing process.", 1); + logger ($config, "snmptrapd (pid $pid) is already running, attempting to kill it...", 1); + print_message ($config, "snmptrapd (pid $pid) is already running, attempting to kill it...", 1); + kill (9, $pid); } } - if (!$snmptrapd_running && system ($config->{'snmp_trapd'} . ' -t -On -n -a -Lf ' . $config->{'snmp_logfile'} . ' -p ' . $pid_file . ' -F %4y-%02.2m-%l[**]%02.2h:%02.2j:%02.2k[**]%a[**]%N[**]%w[**]%W[**]%q[**]%v\\\n >/dev/null 2>&1') != 0) { + if (system ($config->{'snmp_trapd'} . ' -t -On -n -a -Lf ' . $config->{'snmp_logfile'} . ' -p ' . $pid_file . ' -F %4y-%02.2m-%l[**]%02.2h:%02.2j:%02.2k[**]%a[**]%N[**]%w[**]%W[**]%q[**]%v\\\n >/dev/null 2>&1') != 0) { logger ($config, " [E] Could not start snmptrapd.", 1); print_message ($config, " [E] Could not start snmptrapd.", 1); return undef;