Bug 1422993 - check_snmp missing support for IPv6
Summary: check_snmp missing support for IPv6
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: nagios-plugins
Version: epel7
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Stephen John Smoogen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-16 19:04 UTC by Nathan Crawford
Modified: 2017-06-30 03:17 UTC (History)
9 users (show)

Fixed In Version: nagios-plugins-2.2.1-1.el6 nagios-plugins-2.2.1-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-06-29 18:17:01 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Nathan Crawford 2017-02-16 19:04:50 UTC
Description of problem:
check_snmp claims to support a -6/--use-ipv6 option to use an IPv6 connection, but gives "invalid option" error when trying to use it.

The output of './check_snmp --help' includes mention of -6:
-- snip --
 -6, --use-ipv6
    Use IPv6 connection
-- snip --

Version-Release number of selected component (if applicable):
2.1.4-2.el7

How reproducible:
Always

Steps to Reproduce:
1. cd to /usr/lib64/nagios/plugins
2. run ./check_snmp -6 -H (IPv6 addr here) -C (community) -w 2 -c 4 -o .1.3.6.1.4.1.2021.10.1.3.1
3.

Actual results:
./check_snmp: invalid option -- '6'
Usage:
check_snmp -H <ip_address> -o <OID> [-w warn_range] [-c crit_range]
[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]
[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]
[-m miblist] [-P snmp version] [-N context] [-L seclevel] [-U secname]
[-a authproto] [-A authpasswd] [-x privproto] [-X privpasswd]

(Also note that -6 is not one of the options in this list.)


Expected results:
Output from the command should be something like:
SNMP OK - 0.19 | iso.3.6.1.4.1.2021.10.1.3.1=0.19;2;4;2;4;

Additional info:
According to https://support.nagios.com/forum/viewtopic.php?f=35&t=39602 Nagios Plugins version 2.1.2 added IPv6 support to check_snmp.c. And I can see a reference to --with-ipv6 in the build log for nagios-plugins-2.1.4-2.el7.x86_64 on koji.fedoraproject.org, although I don't know how to verify the option is being passed to all the correct build scripts.

Comment 1 Stephen John Smoogen 2017-02-16 19:26:33 UTC
I confirm that this is not working. It does not look to be a compile flag option.. the code does not seem to have ever worked. The problem seems to be that

        while (1) {
                c = getopt_long (argc, argv, "nhvVOt:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:N:L:U:a:x:A:X:",
                                                                         longopts, &option);

does not have the arguments defined even though code later on assumes it does.

Comment 2 Stephen John Smoogen 2017-02-16 19:56:50 UTC
https://github.com/nagios-plugins/nagios-plugins/issues/239

I am putting a fix together and will put builds out later today. Thanks for catching this.

Comment 3 Nathan Crawford 2017-02-16 20:18:34 UTC
No problem, and thanks for the quick response!

Comment 4 Fedora Update System 2017-02-16 20:58:58 UTC
nagios-plugins-2.1.4-6.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-4bf2c82fc6

Comment 5 Fedora Update System 2017-02-16 21:15:17 UTC
nagios-plugins-2.1.4-6.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-b820953367

Comment 6 Nathan Crawford 2017-02-16 22:13:29 UTC
I tested version 2.1.4-6.el7, and it now recognizes the -6 option but gives a different error:
External command error: snmpget: Unknown host (IPv6 addr) (No such file or directory)

Google brought me to https://github.com/nagios-plugins/nagios-plugins/issues/84 which suggests adding "udp6:" in front of the IPv6 address as a workaround.
Running the command './check_snmp -6 -H udp6:(IPv6 addr) -C (community) -w 2 -c 4 -o .1.3.6.1.4.1.2021.10.1.3.1' produces an expected result.

However, the --use-ipv6 option is still not recognized:
'./check_snmp --use-ipv6 -H (IPv6 addr here) -C (community) -w 2 -c 4 -o .1.3.6.1.4.1.2021.10.1.3.1'
Output:
./check_snmp: unrecognized option '--use-ipv6'
Usage:
check_snmp -H <ip_address> -o <OID> [-w warn_range] [-c crit_range]
[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]
[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]
[-m miblist] [-P snmp version] [-N context] [-L seclevel] [-U secname]
[-a authproto] [-A authpasswd] [-x privproto] [-X privpasswd]

It appears there was a commit that was intended to fix this very thing, referenced by the Github issue linked above: https://github.com/nagios-plugins/nagios-plugins/commit/bf9aa4d647281425ba77b287ecf48501aeac9e7d

Comment 7 Stephen John Smoogen 2017-02-16 22:30:13 UTC
Well that is what I get for not having snmp systems.. I read through the code and not the documents so I was testing what I knew the longopts said and not what the documentation used. The code says the option is --ipv6 and not --use-ipv6. The --ipv6 works.. the other of course does not. 


The first one is a bit trickier but I will see what I can patch in this evening.

Comment 8 Stephen John Smoogen 2017-02-16 23:08:29 UTC
OK I am going to be a bit more cautious on this next build. I will build it in koji and if you can test it from there and let me know if that fixes the issue. Thank you so much for the research on the github patch. It looks like they later fixed some code and removed the part that had the %s%s:%s versus %s:%s so part of the code was there but not the useful part. I have put it back in and building an epel with a -7 https://koji.fedoraproject.org/koji/taskinfo?taskID=17903614

Comment 9 Nathan Crawford 2017-02-16 23:25:18 UTC
I tested version 2.1.4-7 with -6, --use-ipv6, -4, --use-ipv4, and without a v4/v6 option, all appear to be working as expected. Thank you for your help!

Comment 10 Fedora Update System 2017-02-16 23:30:33 UTC
nagios-plugins-2.1.4-7.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-d35ac726be

Comment 11 Fedora Update System 2017-02-17 15:30:35 UTC
nagios-plugins-2.1.4-7.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-994c77a4cd

Comment 12 Fedora Update System 2017-02-17 21:18:52 UTC
nagios-plugins-2.1.4-7.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-d35ac726be

Comment 13 Fedora Update System 2017-02-18 00:16:31 UTC
nagios-plugins-2.1.4-7.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-994c77a4cd

Comment 14 Fedora Update System 2017-02-25 21:46:50 UTC
nagios-plugins-2.2.0-3.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-cbb077cc9b

Comment 15 Fedora Update System 2017-02-25 21:52:40 UTC
nagios-plugins-2.2.0-3.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-5d813cd00d

Comment 16 Fedora Update System 2017-02-25 22:27:10 UTC
nagios-plugins-2.2.0-4.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-b0accaba31

Comment 17 Fedora Update System 2017-02-25 22:35:59 UTC
nagios-plugins-2.2.0-4.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-579895db6a

Comment 18 Fedora Update System 2017-02-26 22:48:22 UTC
nagios-plugins-2.2.0-4.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-b0accaba31

Comment 19 Fedora Update System 2017-02-26 22:49:26 UTC
nagios-plugins-2.2.0-4.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-579895db6a

Comment 20 Fedora Update System 2017-03-11 00:47:52 UTC
nagios-plugins-2.2.0-6.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-4a502a08b4

Comment 21 Fedora Update System 2017-03-11 01:03:03 UTC
nagios-plugins-2.2.0-6.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-212f3ef76e

Comment 22 Fedora Update System 2017-03-11 12:47:43 UTC
nagios-plugins-2.2.0-6.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-4a502a08b4

Comment 23 Fedora Update System 2017-03-11 12:50:20 UTC
nagios-plugins-2.2.0-6.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-212f3ef76e

Comment 24 Fedora Update System 2017-03-13 00:38:09 UTC
nagios-plugins-2.2.0-7.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-756fbbf351

Comment 25 Fedora Update System 2017-03-13 13:29:47 UTC
nagios-plugins-2.2.0-7.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-1623674064

Comment 26 Fedora Update System 2017-03-14 00:16:34 UTC
nagios-plugins-2.2.0-7.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-1623674064

Comment 27 Fedora Update System 2017-03-14 00:19:07 UTC
nagios-plugins-2.2.0-7.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-756fbbf351

Comment 28 Fedora Update System 2017-04-21 00:08:41 UTC
nagios-plugins-2.2.1-1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-e452ab1676

Comment 29 Fedora Update System 2017-04-21 00:16:29 UTC
nagios-plugins-2.2.1-1.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-306cbf64b0

Comment 30 Fedora Update System 2017-04-22 21:48:15 UTC
nagios-plugins-2.2.1-1.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-e452ab1676

Comment 31 Fedora Update System 2017-06-29 18:17:01 UTC
nagios-plugins-2.2.1-1.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report.

Comment 32 Fedora Update System 2017-06-30 03:17:29 UTC
nagios-plugins-2.2.1-1.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.