2011-09-01 Ramon Novoa <rnovoa@artica.es>

* lib/PandoraFMS/SNMPServer.pm: Kill snmptrapd if it's already running
	  when the SNMP Console starts and launch it again. Fixes bug #3402392.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4876 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
ramonn 2011-09-01 13:50:56 +00:00
parent acf8b9c92d
commit ead00e8ce5
2 changed files with 10 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2011-09-01 Ramon Novoa <rnovoa@artica.es>
* 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 <sergio.martin@artica.es>
* lib/PandoraFMS/Core.pm: Improve the delete modules

View File

@ -56,14 +56,15 @@ sub new ($$;$) {
my $pid = <PIDFILE> + 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;