2011-05-23 Ramon Novoa <rnovoa@artica.es>

* lib/PandoraFMS/SNMPServer.pm: Applied Koichiro's patch to reuse an
	  already running snmptrapd.

	* lib/PandoraFMS/DataServer.pm: Do not update the configuration of
	  policy modules.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4376 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2011-05-23 13:13:34 +00:00
parent 15e449cdc4
commit bb9cd2023f
3 changed files with 27 additions and 3 deletions

View File

@ -1,3 +1,11 @@
2011-05-23 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/SNMPServer.pm: Applied Koichiro's patch to reuse an
already running snmptrapd.
* lib/PandoraFMS/DataServer.pm: Do not update the configuration of
policy modules.
2011-05-23 Sergio Martin <sergio.martin@artica.es>
* lib/PandoraFMS/DB.pm

View File

@ -550,8 +550,8 @@ sub process_module_data ($$$$$$$$$) {
$module_conf->{'id_module_group'} = ($conf_group_id == -1) ? $module->{'id_module_group'} : $conf_group_id;
}
# Update module configuration if in learning mode
if ($agent->{'modo'} eq '1') {
# Update module configuration if in learning mode and not a policy module
if ($agent->{'modo'} eq '1' && $module->{'id_policy_module'} == 0) {
update_module_configuration ($pa_config, $dbh, $module, $module_conf);
}

View File

@ -47,7 +47,23 @@ sub new ($$;$) {
return undef unless $config->{'snmpconsole'} == 1;
# Start snmptrapd
if (system ($config->{'snmp_trapd'} . ' -t -On -n -a -Lf ' . $config->{'snmp_logfile'} . ' -p /var/run/pandora_snmptrapd.pid -F %4y-%02.2m-%l[**]%02.2h:%02.2j:%02.2k[**]%a[**]%N[**]%w[**]%W[**]%q[**]%v\\\n >/dev/null 2>&1') != 0) {
my $pid_file = '/var/run/pandora_snmptrapd.pid';
my $snmptrapd_running = 0;
if ( -e $pid_file && open (PIDFILE, $pid_file)) {
my $pid = <PIDFILE> + 0;
close PIDFILE;
# 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);
}
}
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) {
logger ($config, " [E] Could not start snmptrapd.", 1);
print_message ($config, " [E] Could not start snmptrapd.", 1);
return undef;