SNMP configuration issue from Nagios XI

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: SNMP configuration issue from Nagios XI

Post by jdalrymple »

You're on the right track, Nagios only honers $USER1$ through $USER255$ though.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: SNMP configuration issue from Nagios XI

Post by Box293 »

raamardhani7 wrote:password is having exclamatory mark ! in it and whenever snmpwalk command is coming across ! it is terminating.

snmpwalk -v 3 -u username -l authPriv -a sha -A A*ABC!FM$!Tue&A -x aes -X P*QRS!FM$!Tue&P xx.xx.xx.xx

-bash: !FM$!Tue: event not found.
IF the snmpwalk fails at the command line then you need to resolve this first before playing with Nagios configs.

You *might* be able to escape them with a backslash.

Code: Select all

snmpwalk -v 3 -u username -l authPriv -a sha -A A*ABC\!FM$\!Tue&A -x aes -X P*QRS\!FM$\!Tue&P xx.xx.xx.xx
Once you get it working at the command line, proceed to using user macros in resource.cfg. You will need to escape them in the user macros as well.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
raamardhani7
Posts: 459
Joined: Tue Jun 02, 2015 12:36 am

Re: SNMP configuration issue from Nagios XI

Post by raamardhani7 »

Box293 wrote:
raamardhani7 wrote:password is having exclamatory mark ! in it and whenever snmpwalk command is coming across ! it is terminating.

snmpwalk -v 3 -u username -l authPriv -a sha -A A*ABC!FM$!Tue&A -x aes -X P*QRS!FM$!Tue&P xx.xx.xx.xx

-bash: !FM$!Tue: event not found.
IF the snmpwalk fails at the command line then you need to resolve this first before playing with Nagios configs.

You *might* be able to escape them with a backslash.

Code: Select all

snmpwalk -v 3 -u username -l authPriv -a sha -A A*ABC\!FM$\!Tue&A -x aes -X P*QRS\!FM$\!Tue&P xx.xx.xx.xx
Once you get it working at the command line, proceed to using user macros in resource.cfg. You will need to escape them in the user macros as well.
Hi Box,

Please find the output of it after escaping the !,


[root@lussvpnagiosxi00 libexec]# snmpwalk -v 3 -u username -l authPriv -a sha -A A*ABC\!FM$\!Tue&A -x aes -X P*QRS\!FM$\!Tue&P xx.xx.xx.xx
[1] 4588
[2] 4589
-bash: A: command not found
-bash: P: command not found
[2]+ Exit 127 A -x aes -X P*QRS\!FM$\!Tue&P
[root@lussvpnagiosxi00 libexec]# No hostname specified.
USAGE: snmpwalk [OPTIONS] AGENT [OID]

Version: 5.5
Web: http://www.net-snmp.org/
Email: [email protected]

OPTIONS:
-h, --help display this help message
-H display configuration file directives understood
-v 1|2c|3 specifies SNMP version to use
-V, --version display package version number
SNMP Version 1 or 2c specific
-c COMMUNITY set the community string
SNMP Version 3 specific
========================================================================
Have made necessary changes updated in the resource.cfg and ram the command.

[root@lussvpnagiosxi00 etc]# snmpwalk -v 3 -u username -l authPriv -a sha -A USER33 -x aes -X USER44 xx.xx.xx.xx
No log handling enabled - turning on stderr logging
Error: passphrase chosen is below the length requirements of the USM (min=8).
snmpwalk: (The supplied password length is too short.)
Error generating a key (Ku) from the supplied authentication pass phrase.
[root@lussvpnagiosxi00 etc]# snmpwalk -v 3 -u username -l authPriv -a sha -A $USER33$ -x aes -X $USER44$ xx.xx.xx.xx
No log handling enabled - turning on stderr logging
Error: passphrase chosen is below the length requirements of the USM (min=8).
snmpwalk: (The supplied password length is too short.)
Error generating a key (Ku) from the supplied authentication pass phrase.

Could you please advise here. thanks.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: SNMP configuration issue from Nagios XI

Post by Box293 »

So now it's getting past the ! but I think it's getting stuck on the &. Try escaping it as well:

Code: Select all

snmpwalk -v 3 -u username -l authPriv -a sha -A A*ABC\!FM$\!Tue\&A -x aes -X P*QRS\!FM$\!Tue\&P xx.xx.xx.xx
raamardhani7 wrote:ave made necessary changes updated in the resource.cfg and ram the command.

[root@lussvpnagiosxi00 etc]# snmpwalk -v 3 -u username -l authPriv -a sha -A USER33 -x aes -X USER44 xx.xx.xx.xx
No log handling enabled - turning on stderr logging
Error: passphrase chosen is below the length requirements of the USM (min=8).
snmpwalk: (The supplied password length is too short.)
Error generating a key (Ku) from the supplied authentication pass phrase.
[root@lussvpnagiosxi00 etc]# snmpwalk -v 3 -u username -l authPriv -a sha -A $USER33$ -x aes -X $USER44$ xx.xx.xx.xx
No log handling enabled - turning on stderr logging
Error: passphrase chosen is below the length requirements of the USM (min=8).
snmpwalk: (The supplied password length is too short.)
Error generating a key (Ku) from the supplied authentication pass phrase.

Could you please advise here. thanks.
The $USERxx$ macros do not work at the command line, they only work when Nagios Core evaluates them. Make sure it works at the command line before proceeding to Nagios, if it doesn't work at the command line it's not going to work in Nagios.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
raamardhani7
Posts: 459
Joined: Tue Jun 02, 2015 12:36 am

Re: SNMP configuration issue from Nagios XI

Post by raamardhani7 »

Box293 wrote:So now it's getting past the ! but I think it's getting stuck on the &. Try escaping it as well:

Code: Select all

snmpwalk -v 3 -u username -l authPriv -a sha -A A*ABC\!FM$\!Tue\&A -x aes -X P*QRS\!FM$\!Tue\&P xx.xx.xx.xx
raamardhani7 wrote:ave made necessary changes updated in the resource.cfg and ram the command.

[root@lussvpnagiosxi00 etc]# snmpwalk -v 3 -u username -l authPriv -a sha -A USER33 -x aes -X USER44 xx.xx.xx.xx
No log handling enabled - turning on stderr logging
Error: passphrase chosen is below the length requirements of the USM (min=8).
snmpwalk: (The supplied password length is too short.)
Error generating a key (Ku) from the supplied authentication pass phrase.
[root@lussvpnagiosxi00 etc]# snmpwalk -v 3 -u username -l authPriv -a sha -A $USER33$ -x aes -X $USER44$ xx.xx.xx.xx
No log handling enabled - turning on stderr logging
Error: passphrase chosen is below the length requirements of the USM (min=8).
snmpwalk: (The supplied password length is too short.)
Error generating a key (Ku) from the supplied authentication pass phrase.

Could you please advise here. thanks.
The $USERxx$ macros do not work at the command line, they only work when Nagios Core evaluates them. Make sure it works at the command line before proceeding to Nagios, if it doesn't work at the command line it's not going to work in Nagios.
Hi Box293,

Below is the output after escaping & and !

SNMPv2-MIB::sysDescr.0 = STRING: POSLab
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.12356.101.1.1403
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (894190324) 103 days, 11:51:43.24
SNMPv2-MIB::sysContact.0 = STRING:
SNMPv2-MIB::sysName.0 = STRING: PoS_Lab
SNMPv2-MIB::sysLocation.0 = STRING: CS Lab
SNMPv2-MIB::sysServices.0 = INTEGER: 78
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORIndex.1 = INTEGER: 1
SNMPv2-MIB::sysORID.1 = OID: SNMPv2-SMI::zeroDotZero.0
SNMPv2-MIB::sysORDescr.1 = STRING:
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (0) 0:00:00.00

========================================
But when running with the below command,

./check_snmp -H xx.xx.xx.xx -o ".1.3.6.1.4.1.12356.101.1.1403" -V 3 -u username -l authPriv -a sha -A A*ABC\!FM$\!Tue\&A -x aes -X P*QRS\!FM$\!Tue\&P
check_snmp v2.0.3 (nagios-plugins 2.0.3)

It is immediately throwing this output with OID.

And when using the below command, please find the output..
./check_snmp -H xx.xx.xx.xx -o ".1.3.6.1.4.1.12356.101.1.1403" -P 3 -U username -l authPriv -a sha -A A*ABC\!FM$\!Tue\&A -x aes -X P*QRS\!FM$\!Tue\&P
External command error: Timeout: No Response from xx.xx.xx.xx:161.

Could you please let us know how can we take it forward. Thanks..
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: SNMP configuration issue from Nagios XI

Post by tgriep »

The authlevel command is a capital L. Try running the command below and see if it works for you.

Code: Select all

./check_snmp -H xx.xx.xx.xx -o ".1.3.6.1.4.1.12356.101.1.1403" -P 3 -U username -L authPriv -a sha -A A*ABC\!FM$\!Tue\&A -x aes -X P*QRS\!FM$\!Tue\&P
Be sure to check out our Knowledgebase for helpful articles and solutions!
raamardhani7
Posts: 459
Joined: Tue Jun 02, 2015 12:36 am

Re: SNMP configuration issue from Nagios XI

Post by raamardhani7 »

tgriep wrote:The authlevel command is a capital L. Try running the command below and see if it works for you.

Code: Select all

./check_snmp -H xx.xx.xx.xx -o ".1.3.6.1.4.1.12356.101.1.1403" -P 3 -U username -L authPriv -a sha -A A*ABC\!FM$\!Tue\&A -x aes -X P*QRS\!FM$\!Tue\&P
Thanks a lot Tgriep,

Please find the output from the XI server:

./check_snmp -H xx.xx.xx.xx -o ".1.3.6.1.4.1.12356.101.1.1403" -P 3 -U username -L authPriv -a sha -A A*ABC\!FM$\!Tue\&A -x aes -X P*QRS\!FM$\!Tue\&P
SNMP OK - Such Object available on this agent at this OID |

This is the output I got from XI portal. Could you please help me here.

COMMAND: /usr/local/nagios/libexec/check_snmp -H xx.xx.xx.xx -o ".1.3.6.1.4.1.12356.101.1.1403" -P 3 -U username -L authPriv -a sha -A A*ABC\!FM$\!Tue\&A\
OUTPUT: Required parameter: privpasswd
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: SNMP configuration issue from Nagios XI

Post by tgriep »

This message could be because the MIB file for that device isn't installed on the XI system

Code: Select all

SNMP OK - Such Object available on this agent at this OID |
Have you done that?
If not, do you have the MIB file and can you upload it to the XI server?
Go to Admin > Manage MIBs and upload it there.

This message
OUTPUT: Required parameter: privpasswd
Means that the following is missing from the command definition. Add this and it will take care of that error.

Code: Select all

-x aes -X P*QRS\!FM$\!Tue\&P
Another thing to note, Nagios XI uses the ! as a special character and it may not work for you and you may have to change it in your passwords.
Be sure to check out our Knowledgebase for helpful articles and solutions!
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: SNMP configuration issue from Nagios XI

Post by ssax »

Here is how you set it up so it will work.

Edit this file:

Code: Select all

/usr/local/nagios/etc/resource.cfg
Add your special character passwords:

Code: Select all

$USER9$=A*ABC!FM$!Tue&A
$USER10$=P*QRS!FM$!Tue&P
Restart nagios:

Code: Select all

service nagios restart
Setup your service like this:

Check command:

Code: Select all

check_snmp
$ARG1$:

Code: Select all

-o '.1.3.6.1.4.1.12356.101.1.1403' -P 3 -U username -L authPriv -a sha -A '$USER9$' -x aes -X '$USER10$'
It won't work when you click test but it should work when the service check runs.
raamardhani7
Posts: 459
Joined: Tue Jun 02, 2015 12:36 am

Re: SNMP configuration issue from Nagios XI

Post by raamardhani7 »

ssax wrote:Here is how you set it up so it will work.

Edit this file:

Code: Select all

/usr/local/nagios/etc/resource.cfg
Add your special character passwords:

Code: Select all

$USER9$=A*ABC!FM$!Tue&A
$USER10$=P*QRS!FM$!Tue&P
Restart nagios:

Code: Select all

service nagios restart
Setup your service like this:

Check command:

Code: Select all

check_snmp
$ARG1$:

Code: Select all

-o '.1.3.6.1.4.1.12356.101.1.1403' -P 3 -U username -L authPriv -a sha -A '$USER9$' -x aes -X '$USER10$'
It won't work when you click test but it should work when the service check runs.
Hi Ssax,

I have created the password in resource.cfg,
And added the same command which you updated above in the portal and the output is as below.

COMMAND: /usr/local/nagios/libexec/check_snmp -H xx.xx.xx.xx -o '.1.3.6.1.4.1.12356.101.1.1403' -P 3 -U username -L authPriv -a sha -A '\$USER9\$' -x aes -X '\$USER10\$'
OUTPUT: External command error: snmpget: Timeout

SInce my password is having ! in it, I have tested by adding \ for escaping it. Below is the output from XI portal.

/usr/local/nagios/libexec/check_snmp -H xx.xx.xx.xx -o '.1.3.6.1.4.1.12356.101.1.1403' -P 3 -U username -L authPriv -a sha -A '\$USER9\$' -x aes -X '\$USER10\$'
External command error: Timeout: No Response from xx.xx.xx.xx:161.

what should I do for $USER9$ and $USER10$ in resource.cfg, shall I use \ for escaping ! and & in the password entry or do you want me to keep the password as it is?

Please advise on the outputs updated above. thanks.
Locked