SNMP Wizard not working with snmp v3

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
brudnick
Posts: 37
Joined: Mon Feb 17, 2014 3:17 pm

SNMP Wizard not working with snmp v3

Post by brudnick »

I am attempting to use the SNMP wizard to pull some oids from some of our network devices. I have received the OIDs needed to be monitored from my network team. It seems as though the SNMP wizard is not working with v3. Currently my XI SNMP wizard is on version 1.5.2. Is that the current version? If not, where can I find a new version?

After the wizard is complete I am getting usage error on my checks. Here is an example of my output when run through CCM(authpasswords and IPs have been changed for security purposes)

COMMAND: /usr/local/nagios/libexec/check_snmp -H server.ip.com -o .1.3.6.1.4.1.3375.2.1.7.5.2.1.28 -P 3 --seclevel=authPriv --secname=secname --authproto=sha --authpasswd=authpasswd' --privpasswd='privpasswd' --protocols=sha,aes -l "MultiHostCpuUser5m" -u "%" -w 75 -c 90
OUTPUT: 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] [-L seclevel] [-U secname] [-a authproto]
[-A authpasswd] [-x privproto] [-X privpasswd]

Why is the wizard not making correct calls to check_snmp?
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: SNMP Wizard not working with snmp v3

Post by hsmith »

brudnick wrote:authpasswd=authpasswd'
It looks like this is missing an opening single quote. Can you verify that inside of the core configuration manager for that service?
Former Nagios Employee.
me.
brudnick
Posts: 37
Joined: Mon Feb 17, 2014 3:17 pm

Re: SNMP Wizard not working with snmp v3

Post by brudnick »

Yes it is still there, I just edited it for security reasons and accidentaly deleted that quote
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: SNMP Wizard not working with snmp v3

Post by rkennedy »

Can you try running the command over the CLI to see if it works?

While you're there, can you verify what version of check_snmp you are using?

Code: Select all

/usr/local/nagios/libexec/check_snmp -V
Former Nagios Employee
weveland
Posts: 125
Joined: Tue Aug 11, 2015 4:10 pm
Location: cat /dev/urandom > /dev/sda

Re: SNMP Wizard not working with snmp v3

Post by weveland »

I ran into the same issue. The wizard when creating the checks, uses an old format for check_snmp. After some previous testing, if I edit the check command after the wizard creates it and change "--protocols=sha,aes" to "--privproto=aes" this works. The command just needs the proper flags passed to it which the wizard isn't doing.

Hooray for documenting things!

* Edit - Adding the second --authproto=sha is unnecessary as it already exists further forward in the command.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: SNMP Wizard not working with snmp v3

Post by hsmith »

I've been working with one of the developers on this for about the last half hour. I got it working on my box. We had to change a couple of the lines in the SNMP wizard.

Inside of /usr/local/nagiosxi/html/includes/configwizards/snmp/snmp.inc.php

Change lines 523 - 546 to look like mine:

Code: Select all

523                             // snmp v3 stuff
524                             if ($snmpversion == "3") {
525
526                                 $securitylevel = grab_array_var($serviceargs, "v3_security_level");
527                                 $username = grab_array_var($serviceargs, "v3_username");
528                                 $authproto = grab_array_var($serviceargs, "v3_auth_proto");
529                                 $privproto = grab_array_var($serviceargs, "v3_priv_proto");
530                                 $authpassword = grab_array_var($serviceargs, "v3_auth_password");
531                                 $privacypassword = grab_array_var($serviceargs, "v3_privacy_password");
532
533                                 if ($securitylevel != "")
534                                     $cmdargs .= " --seclevel=" . $securitylevel;
535                                 if ($username != "")
536                                     $cmdargs .= " --secname=" . $username;
537                                 if ($authproto!= "")
538                                     $cmdargs .= " --authproto=" . $authproto;
539                                 if ($authpassword != "")
540                                     $cmdargs .= " --authpasswd='" . $authpassword . "'";
541                                 if ($privacypassword != "")
542                                     $cmdargs .= " --privpasswd='" . $privacypassword . "'";
543                                 if ($privproto != "")
544                                     $cmdargs .= " --privproto=" . $privproto;
545                             }
546                             // label
This should work, but you may want to work for the developers to release something 'official', but this code made the wizard work on mine.

Edit: Code without annoying line numbers :)

Code: Select all

 // snmp v3 stuff
                            if ($snmpversion == "3") {

                                $securitylevel = grab_array_var($serviceargs, "v3_security_level");
                                $username = grab_array_var($serviceargs, "v3_username");
                                $authproto = grab_array_var($serviceargs, "v3_auth_proto");
                                $privproto = grab_array_var($serviceargs, "v3_priv_proto");
                                $authpassword = grab_array_var($serviceargs, "v3_auth_password");
                                $privacypassword = grab_array_var($serviceargs, "v3_privacy_password");

                                if ($securitylevel != "")
                                    $cmdargs .= " --seclevel=" . $securitylevel;
                                if ($username != "")
                                    $cmdargs .= " --secname=" . $username;
                                if ($authproto!= "")
                                    $cmdargs .= " --authproto=" . $authproto;
                                if ($authpassword != "")
                                    $cmdargs .= " --authpasswd='" . $authpassword . "'";
                                if ($privacypassword != "")
                                    $cmdargs .= " --privpasswd='" . $privacypassword . "'";
                                if ($privproto != "")
                                    $cmdargs .= " --privproto=" . $privproto;
                            }
                            // label
Former Nagios Employee.
me.
brudnick
Posts: 37
Joined: Mon Feb 17, 2014 3:17 pm

Re: SNMP Wizard not working with snmp v3

Post by brudnick »

check_snmp v2.0.3 (nagios-plugins 2.0.3)

I changed it per @weveland suggestion and the command runs fine. I will change the snmp.php file and see if that works for me. Thanks for everyones' help!
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: SNMP Wizard not working with snmp v3

Post by rkennedy »

No problem. Let us know if you need any further assistance.
Former Nagios Employee
Locked