Check_snmp with ipv6
Posted: Mon May 18, 2015 9:09 am
Hi,
I´ve tried to use the check_snmp plugins with IPv6, but it didn't work. A quick check into the code of a few o them revealed the issue quite quickly. They all use snmpwalk to make the actual communication. The problem is that to use IPv6, snmpwalk requires that the string "udp6:" must be added to the beginning of the hostname or IPv6 address. For example (in check_snmp_cpu):
...
for NUMERO in `$CMD_SNMPWALK -t 2 -r 2 -v 1 -c $COMMUNITY $HOSTNAME $OID_PROCESSID | $CMD_AWK '{ print $1 }' | $CMD_AWK -F "." '{print $NF}'`
do
....
For the IPv6 case would have to be something like
..
$HOSTNAME="udp6:${HOSTNAME}"
for NUMERO in `$CMD_SNMPWALK -t 2 -r 2 -v 1 -c $COMMUNITY $HOSTNAME $OID_PROCESSID | $CMD_AWK '{ print $1 }' | $CMD_AWK -F "." '{print $NF}'`
do
....
A quick checking logic on the format of the address could add this to the address if IPv6 is detected. Could someone add this to the upstream code in the nagios plugins?
Thank you,
Roberto Greiner
I´ve tried to use the check_snmp plugins with IPv6, but it didn't work. A quick check into the code of a few o them revealed the issue quite quickly. They all use snmpwalk to make the actual communication. The problem is that to use IPv6, snmpwalk requires that the string "udp6:" must be added to the beginning of the hostname or IPv6 address. For example (in check_snmp_cpu):
...
for NUMERO in `$CMD_SNMPWALK -t 2 -r 2 -v 1 -c $COMMUNITY $HOSTNAME $OID_PROCESSID | $CMD_AWK '{ print $1 }' | $CMD_AWK -F "." '{print $NF}'`
do
....
For the IPv6 case would have to be something like
..
$HOSTNAME="udp6:${HOSTNAME}"
for NUMERO in `$CMD_SNMPWALK -t 2 -r 2 -v 1 -c $COMMUNITY $HOSTNAME $OID_PROCESSID | $CMD_AWK '{ print $1 }' | $CMD_AWK -F "." '{print $NF}'`
do
....
A quick checking logic on the format of the address could add this to the address if IPv6 is detected. Could someone add this to the upstream code in the nagios plugins?
Thank you,
Roberto Greiner