Re: IPv6 and SNMP: Traps arrive, but not processed by snmptr
Posted: Thu Apr 14, 2016 5:45 pm
I edited my previous post so I'm now out of order... See above. :)
Support for Nagios products and services
https://support.nagios.com/forum/
We suspect it's a combination of how snmptrapd stores the address in the spooled trap along with how snmptt interacts with it. Stay tuned.gormank wrote:Yep, it created a host named: UDP/IPv6: [2001:4888:a03c0
0:190
Code: Select all
host = sys.argv[1]Code: Select all
host = sys.argv[1]
if host.startswith("UDP/IPv6"):
host = host.partition('[')[-1].rpartition(']')[0]Code: Select all
/usr/local/bin/snmptraphandling.py "UDP/IPv6: [2001:4888:a03:311f:c0:a:0:190]:32880" "SNMP Traps" "Normal" "1439269658" "" "My Test"Code: Select all
Generic trap (11003): HP Onboard Administrator Test Trap sent from enclosure: TXSLM2MCHP7004 / sysName.0 (OCTETSTR):TXSLM2MCHP7004-OA cpqHoTrapFlags (INTEGER):1 cpqHoGenericData (OCTETSTR):HP Onboard Administrator Test Trap sent from enclosure: TXSLM2MCHP7004Code: Select all
# diff /usr/local/bin/snmptraphandling.py /usr/local/bin/snmptraphandling.py.org
27,28d26
< if host.startswith("UDP/IPv6"):
< host = host.partition('[')[-1].rpartition(']')[0]Code: Select all
2016-04-15 19:19:22 0.0.0.0(via UDP/IPv6: [2001:4888:a03:311f:c0:a:0:190]:32880) TRAP, SNMP v1, community sp1der
CPQHOST-MIB::compaq Enterprise Specific Trap (CPQHOST-MIB::cpqHo2GenericTrap) Uptime: 3 days, 2:41:31.48
SNMPv2-MIB::sysName.0 = STRING: TXSLM2MCHP7004-OA CPQHOST-MIB::cpqHoTrapFlags = INTEGER: 1 CPQHOST-MIB::cpqHoGenericData = STRING: "HP Onboard Administrator Test Trap sent from enclosure: TXSLM2MCHP7004"Code: Select all
2016-04-15 19:20:02 10.133.133.100(via UDP: [10.133.133.100]:1167->[10.133.133.74]) TRAP, SNMP v1, community sp1der
CPQHOST-MIB::compaq Enterprise Specific Trap (CPQHOST-MIB::cpqHo2GenericTrap) Uptime: 129 days, 8:51:25.25
SNMPv2-MIB::sysName.0 = STRING: OA-7446A0F9190B CPQHOST-MIB::cpqHoTrapFlags = INTEGER: 0 CPQHOST-MIB::cpqHoGenericData = STRING: "HP Onboard Administrator Test Trap sent from enclosure: TXLSM2MCHP7001"Code: Select all
Fri Apr 15 19:19:23 2016 .1.3.6.1.4.1.232.0.11003 MAJOR "Status Events" UDP/IPv6: [2001:4888:a03:311f:c0:a:0:190]:32880 - Generic trap (11003): HP Onboard Administrator Test Trap sent from enclosure: TXSLM2MCHP7004
Code: Select all
Fri Apr 15 19:20:02 2016 .1.3.6.1.4.1.232.0.11003 MAJOR "Status Events" 10.133.133.100 - Generic trap (11003): HP Onboard Administrator Test Trap sent from enclosure: TXLSM2MCHP7001
The problem is not with snmptt, it has to do with the net-snmp library and snmptrapd.gormank wrote:Here are a pair of test traps from blade chassis, one w/ a v6 address and the other a v4 address just for grins. To me it looks like snmptt is not stripping the extra info off the address.
To be very clear about this, the only thing snmptt does with addresses is either dns resolution / manipulation, it does not do any other type of manipulation to the address. We have a situation where we are simply getting an incorrect address in the trap.gormank wrote:To me it looks like snmptt is not stripping the extra info off the address.
This is a valid issue you have raised.gormank wrote:I noticed another v6 feature that Nagios doesn't handle. I know, by now you're ready to strangle me...
The following addresses are the same IPv6. They're not the same to Nagios so a trap arriving as the first on a host defined as the second will be unknown.
2001:4888:a03c0
0:196
2001:4888:a03c0
:196
Code: Select all
EVENT nSvcEvent .1.3.6.1.4.1.20006.1.7 "Status Events" Normal
FORMAT The SNMP trap that is generated as a result of an event with the service $*
EXEC /usr/local/bin/snmptraphandling.py "pink_monkeys" "SNMP Traps" "$s" "$@" "$-*" "The SNMP trap that is generated as a result of an event with the service $*"
MATCH $r: UDP/IPv6: [200:4888:a03:311f:c0:a:0:196]:45418
MATCH $r: 2001:4888:a03:311f:c0:a::196Code: Select all
host = sys.argv[1]Code: Select all
host = sys.argv[1]
if host.startswith("UDP/IPv6"):
try:
import socket
host = socket.gethostbyaddr(sys.argv[1].partition('[')[-1].rpartition(']')[0])[0]
#host = host.partition('.')[0]
except:
host = sys.argv[1].partition('[')[-1].rpartition(']')[0]Code: Select all
host = socket.gethostbyaddr(sys.argv[1].partition('[')[-1].rpartition(']')[0])[0]Code: Select all
#host = host.partition('.')[0]