2012-02-20 Ramon Novoa <rnovoa@artica.es>

* conf/pandora_server.conf,
	  lib/PandoraFMS/SNMPServer.pm,
	  lib/PandoraFMS/Config.pm: Added two new configuration tokens
	  suggested by Koichiro: snmp_ignore_authfailure and snmp_pdu_address.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5623 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2012-02-20 17:47:08 +00:00
parent d0149da3e5
commit fab2cefad5
4 changed files with 31 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2012-02-20 Ramon Novoa <rnovoa@artica.es>
* conf/pandora_server.conf,
lib/PandoraFMS/SNMPServer.pm,
lib/PandoraFMS/Config.pm: Added two new configuration tokens
suggested by Koichiro: snmp_ignore_authfailure and snmp_pdu_address.
2012-02-16 Vanessa Gil <vanessa.gil@artica.es>
* util/pandora_manage.pl: Modify user comment format.

View File

@ -80,6 +80,12 @@ master 1
snmpconsole 1
# snmptrapd will ignore authenticationFailure traps if set to 1.
snmp_ignore_authfailure 1
# snmptrapd will read the PDU source address instead of the agent-addr field is set to 1.
snmp_pdu_address 0
# Activate (1) Pandora Network Server
networkserver 1

View File

@ -231,9 +231,10 @@ sub pandora_load_config {
$pa_config->{"snmpserver"} = 0; # 4.0
$pa_config->{"snmp_threads"} = 3; # 4.0
$pa_config->{"block_size"} = 15; # 4.0
$pa_config->{"max_queue_files"} = 500;
$pa_config->{"snmp_ignore_authfailure"} = 1; # 5.0
$pa_config->{"snmp_pdu_address"} = 0; # 5.0
# Internal MTA for alerts, each server need its own config.
$pa_config->{"mta_address"} = '127.0.0.1'; # Introduced on 2.0
$pa_config->{"mta_port"} = '25'; # Introduced on 2.0
@ -384,6 +385,12 @@ sub pandora_load_config {
elsif ($parametro =~ m/^snmp_logfile\s(.*)/i) {
$pa_config->{'snmp_logfile'}= clean_blank($1);
}
elsif ($parametro =~ m/^snmp_ignore_authfailure\s+([0-1])/i) {
$pa_config->{'snmp_ignore_authfailure'}= clean_blank($1);
}
elsif ($parametro =~ m/^snmp_pdu_address\s+([0-1])/i) {
$pa_config->{'snmp_pdu_address'}= clean_blank($1);
}
elsif ($parametro =~ m/^dbengine\s(.*)/i) {
$pa_config->{'dbengine'}= clean_blank($1);
}

View File

@ -63,9 +63,15 @@ sub new ($$;$) {
kill (9, $pid);
}
}
my $snmptrapd_args = ' -t -On -n -a -Lf ' . $config->{'snmp_logfile'} . ' -p ' . $pid_file;
$snmptrapd_args .= ' --format1=SNMPv1[**]%4y-%02.2m-%l[**]%02.2h:%02.2j:%02.2k[**]%a[**]%N[**]%w[**]%W[**]%q[**]%v\\\n';
# Ignore auth failure traps
my $snmp_ignore_authfailure = ($config->{'snmp_ignore_authfailure'} eq '1' ? ' -a' : '');
# Select agent-addr field of the PDU or PDU source address for V1 traps
my $address_format = ($config->{'snmp_pdu_address'} eq '0' ? '%a' : '%b');
my $snmptrapd_args = ' -t -On -n' . $snmp_ignore_authfailure . ' -Lf ' . $config->{'snmp_logfile'} . ' -p ' . $pid_file;
$snmptrapd_args .= ' --format1=SNMPv1[**]%4y-%02.2m-%l[**]%02.2h:%02.2j:%02.2k[**]' . $address_format . '[**]%N[**]%w[**]%W[**]%q[**]%v\\\n';
$snmptrapd_args .= ' --format2=SNMPv2[**]%4y-%02.2m-%l[**]%02.2h:%02.2j:%02.2k[**]%b[**]%v\\\n';
if (system ($config->{'snmp_trapd'} . $snmptrapd_args . ' >/dev/null 2>&1') != 0) {