SNMP traps processed only from one interface
Posted: Thu Sep 23, 2021 7:47 am
Hello Nagios team.
I found a forum topic that is describing the same problem as do have I. Traps from 2 NICs: https://support.nagios.com/forum/viewto ... 8&#p335481
I am also capturing all the udp packets comming to both our interfaces. But the traps routed to eth1 do not get processed.
root@lv-mon-p-master:~# tcpdump -vvvnn -i any src 10.232.235.11 or 10.12.22.35 and udp
This is the problem trap generated automatically and coming from the monitored vCenter to the interface eth1 (IP 10.230.5.240):
12:20:06.184129 IP (tos 0x0, ttl 62, id 3698, offset 0, flags [DF], proto UDP (17), length 240)
10.232.235.11.50550 > 10.230.5.240.162: [udp sum ok] { SNMPv1 { Trap(195) .1.3.6.1.4.1.6876.4.3 10.230.225.11 enterpriseSpecific s=203 1020073121 .1.3.6.1.4.1.6876.4.3.308.0=2 .1.3.6.1.4.1.6876.4.3.304.0="Yellow" .1.3.6.1.4.1.6876.4.3.305.0="Green" .1.3.6.1.4.1.6876.4.3.306.0="alarm.HostCPUUsageAlarm - Metric CPU Usage = 3%" .1.3.6.1.4.1.6876.4.3.307.0="10.230.220.44" } }
This one is my attempt to replicate the same trap from a linux command line and it comes from my testing CentOS vm which resides in the same network as interface eth0 (IP 10.12.22.11) on my Nagios server:
12:20:19.577380 IP (tos 0x0, ttl 64, id 1383, offset 0, flags [DF], proto UDP (17), length 239)
10.12.22.35.49628 > 10.12.22.11.162: [udp sum ok] { SNMPv1 { Trap(194) .1.3.6.1.4.1.6876.4.3 10.12.22.35 enterpriseSpecific s=203 284794559 .1.3.6.1.4.1.6876.4.3.308.0=2 .1.3.6.1.4.1.6876.4.3.304.0="Green" .1.3.6.1.4.1.6876.4.3.305.0="Yellow" .1.3.6.1.4.1.6876.4.3.306.0="alarm.HostCPUUsageAlarm - Metric CPU Usage = 10%" .1.3.6.1.4.1.6876.4.3.307.0="10.12.22.33" } }
But I can process only the latter, the one received by eth0 interface. It is processed by snmptrapd, logged into a defined file and passed to snmptt which logs it again and which passes it further to Nagios.
This is my actual /etc/sysconfig/snmptrapd setting:
OPTIONS="-On -tLf /var/log/snmptrapd.log"
I tried also to run it as /usr/sbin/snmptrapd -On -tLf /var/log/snmptrapd.log udp:127.0.0.1:162 udp:10.12.22.11:162 udp:10.230.5.240:162 -f
In debug mode /usr/sbin/snmptrapd -On -DALL -tLf /var/log/snmptrapd.log -f
- This is the only thing that looked like an error: "netsnmp_unix_transport: couldn't connect to "/var/agentx/master", errno 2 (No such file or directory)"
Neither this simple setting of /etc/snmp/snmptrapd.conf did help:
disableAuthorization yes
traphandle default /usr/sbin/snmptthandler
Disabling firewall had no effect either.
Still no traps from eth1.
What else might interest you:
root@lv-mon-p-master:~# ss -ulpn | grep 162
UNCONN 0 0 *:162 *:* users:(("snmptrapd",pid=12048,fd=8))
root@lv-mon-p-master:~# ps -ef | grep trap
root 12048 1 0 13:54 ? 00:00:00 /usr/sbin/snmptrapd -On -tLf /var/log/snmptrapd.log -f
root@lv-mon-p-master:~# grep release /etc/*release
/etc/centos-release:CentOS Linux release 7.9.2009 (Core)
root@lv-mon-p-master:~# uname -a
Linux lv-mon-p-master 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Please, let me know how have you solved the ticket related to the "Traps from 2 NICs" forum thread.
Thanks
Jaroslav
I found a forum topic that is describing the same problem as do have I. Traps from 2 NICs: https://support.nagios.com/forum/viewto ... 8&#p335481
I am also capturing all the udp packets comming to both our interfaces. But the traps routed to eth1 do not get processed.
root@lv-mon-p-master:~# tcpdump -vvvnn -i any src 10.232.235.11 or 10.12.22.35 and udp
This is the problem trap generated automatically and coming from the monitored vCenter to the interface eth1 (IP 10.230.5.240):
12:20:06.184129 IP (tos 0x0, ttl 62, id 3698, offset 0, flags [DF], proto UDP (17), length 240)
10.232.235.11.50550 > 10.230.5.240.162: [udp sum ok] { SNMPv1 { Trap(195) .1.3.6.1.4.1.6876.4.3 10.230.225.11 enterpriseSpecific s=203 1020073121 .1.3.6.1.4.1.6876.4.3.308.0=2 .1.3.6.1.4.1.6876.4.3.304.0="Yellow" .1.3.6.1.4.1.6876.4.3.305.0="Green" .1.3.6.1.4.1.6876.4.3.306.0="alarm.HostCPUUsageAlarm - Metric CPU Usage = 3%" .1.3.6.1.4.1.6876.4.3.307.0="10.230.220.44" } }
This one is my attempt to replicate the same trap from a linux command line and it comes from my testing CentOS vm which resides in the same network as interface eth0 (IP 10.12.22.11) on my Nagios server:
12:20:19.577380 IP (tos 0x0, ttl 64, id 1383, offset 0, flags [DF], proto UDP (17), length 239)
10.12.22.35.49628 > 10.12.22.11.162: [udp sum ok] { SNMPv1 { Trap(194) .1.3.6.1.4.1.6876.4.3 10.12.22.35 enterpriseSpecific s=203 284794559 .1.3.6.1.4.1.6876.4.3.308.0=2 .1.3.6.1.4.1.6876.4.3.304.0="Green" .1.3.6.1.4.1.6876.4.3.305.0="Yellow" .1.3.6.1.4.1.6876.4.3.306.0="alarm.HostCPUUsageAlarm - Metric CPU Usage = 10%" .1.3.6.1.4.1.6876.4.3.307.0="10.12.22.33" } }
But I can process only the latter, the one received by eth0 interface. It is processed by snmptrapd, logged into a defined file and passed to snmptt which logs it again and which passes it further to Nagios.
This is my actual /etc/sysconfig/snmptrapd setting:
OPTIONS="-On -tLf /var/log/snmptrapd.log"
I tried also to run it as /usr/sbin/snmptrapd -On -tLf /var/log/snmptrapd.log udp:127.0.0.1:162 udp:10.12.22.11:162 udp:10.230.5.240:162 -f
In debug mode /usr/sbin/snmptrapd -On -DALL -tLf /var/log/snmptrapd.log -f
- This is the only thing that looked like an error: "netsnmp_unix_transport: couldn't connect to "/var/agentx/master", errno 2 (No such file or directory)"
Neither this simple setting of /etc/snmp/snmptrapd.conf did help:
disableAuthorization yes
traphandle default /usr/sbin/snmptthandler
Disabling firewall had no effect either.
Still no traps from eth1.
What else might interest you:
root@lv-mon-p-master:~# ss -ulpn | grep 162
UNCONN 0 0 *:162 *:* users:(("snmptrapd",pid=12048,fd=8))
root@lv-mon-p-master:~# ps -ef | grep trap
root 12048 1 0 13:54 ? 00:00:00 /usr/sbin/snmptrapd -On -tLf /var/log/snmptrapd.log -f
root@lv-mon-p-master:~# grep release /etc/*release
/etc/centos-release:CentOS Linux release 7.9.2009 (Core)
root@lv-mon-p-master:~# uname -a
Linux lv-mon-p-master 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Please, let me know how have you solved the ticket related to the "Traps from 2 NICs" forum thread.
Thanks
Jaroslav