Page 1 of 1

Check_snmp with ipv6

Posted: Mon May 18, 2015 9:09 am
by rgreiner
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

Re: Check_snmp with ipv6

Posted: Mon May 18, 2015 9:33 am
by tmcdonald
Would you like to file this as a bug on the Nagios Plugins Github page?

https://github.com/nagios-plugins/nagios-plugins/

Posting issues on the forum is fine, but for plugin bugs specifically it's usually best to put things on Github. That way it gets noticed immediately and the workflow can start sooner.

Re: Check_snmp with ipv6

Posted: Mon May 18, 2015 9:58 am
by rgreiner
Ok.

I've opened an issue in https://github.com/nagios-plugins/nagio ... /issues/84

Thank you,

Roberto Greiner

Re: Check_snmp with ipv6

Posted: Mon May 18, 2015 11:03 am
by abrist
I left a not over on github and am looking into this. Can you try running an snmpget (as check_snmp using snmp-get instead of snmpwalk) with the syntax mentioned on the net-snmp page?
http://www.net-snmp.org/wiki/index.php/ ... cations_28

Re: Check_snmp with ipv6

Posted: Mon May 18, 2015 1:25 pm
by rgreiner
I tried both running snmpget from the command line and modifying check_snmp_cpu (which is script language and not compiled) to use snmpget, and in both cases, adding 'udp6:' worked. Unlike described in the indicated documentation, neither adding quotes nor adding square brackets was not necessary, both for snmpget and check_snmp_cpu.

Re: Check_snmp with ipv6

Posted: Tue May 19, 2015 10:34 am
by tmcdonald
We can continue this discussion on GitHub if need be since an issue has been posted (I added my two cents). I'll be closing this thread now.

Re: Check_snmp with ipv6

Posted: Wed May 20, 2015 9:28 am
by abrist
I should be pushing some code to a github branch later today to add this feature. More details coming soon.

Re: Check_snmp with ipv6

Posted: Fri May 22, 2015 2:02 pm
by abrist
I pushed a commit today to address this:
https://github.com/nagios-plugins/nagio ... /issues/84