Check_snmp with ipv6

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
rgreiner
Posts: 4
Joined: Mon Oct 21, 2013 1:34 pm

Check_snmp with ipv6

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Check_snmp with ipv6

Post 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.
Former Nagios employee
rgreiner
Posts: 4
Joined: Mon Oct 21, 2013 1:34 pm

Re: Check_snmp with ipv6

Post by rgreiner »

Ok.

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

Thank you,

Roberto Greiner
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Check_snmp with ipv6

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
rgreiner
Posts: 4
Joined: Mon Oct 21, 2013 1:34 pm

Re: Check_snmp with ipv6

Post 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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Check_snmp with ipv6

Post 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.
Former Nagios employee
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Check_snmp with ipv6

Post by abrist »

I should be pushing some code to a github branch later today to add this feature. More details coming soon.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Check_snmp with ipv6

Post by abrist »

I pushed a commit today to address this:
https://github.com/nagios-plugins/nagio ... /issues/84
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked