SNMP Password limitation

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
JohnFLi
Posts: 559
Joined: Mon Jun 17, 2013 3:11 pm

SNMP Password limitation

Post by JohnFLi »

I am trying to monitor a switch that is using SNMP v3

after using the config wizard for a network switch in XI, I get an output of '(No output on stdout) stderr: /bin/sh: -c: line 0: syntax error near unexpected token `(''

I tried it in the command line as well, and appears to be freaking when it hits the '(' that is part of the password.

is this a known issue? or am I just doing somethign worng?

The command view:

Code: Select all

$USER1$/check_ifoperstatnag $ARG1$ $ARG2$ $HOSTADDRESS$
ARG1 :

Code: Select all

16814080
ARG2:

Code: Select all

-v3 -u sanswitchmonitor.svc -A my(password -a MD5 -l noAuthNoPriv
Everybody is somebody else’s weirdo
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: SNMP Password limitation

Post by Box293 »

In your password try escaping the bracket with a backslash \

Code: Select all

-v3 -u sanswitchmonitor.svc -A my\(password -a MD5 -l noAuthNoPriv
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
JohnFLi
Posts: 559
Joined: Mon Jun 17, 2013 3:11 pm

Re: SNMP Password limitation

Post by JohnFLi »

even though the ( is in the middle of the password?

WHen I tried that...... it just went to the
>
prompt and sat there
Everybody is somebody else’s weirdo
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: SNMP Password limitation

Post by abrist »

You may need to use a $USERn$ macro for this. See:
http://assets.nagios.com/downloads/nagi ... Macros.pdf
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.
User avatar
JohnFLi
Posts: 559
Joined: Mon Jun 17, 2013 3:11 pm

Re: SNMP Password limitation

Post by JohnFLi »

Ok, in resource.cfg I added

Code: Select all

 $USER9$=jdj(kdfsk
changed the command to now read

Code: Select all

$ARG1$      16797696
$ARG2$       -v3 -u sanswitchmonitor.svc -A $USER9$ -a MD5 -l authNoPriv

when I run the test, this is what it returns:

Code: Select all

COMMAND: /usr/local/nagios/libexec/check_ifoperstatnag 16797696 -v3 -u sanswitchmonitor.svc -A \$USER9\$ -a MD5 -l authNoPriv dc-n5k-s2

OUTPUT: Usage /usr/local/nagios/libexec/check_ifoperstatnag: <interface index> <snmpget options>
  Check_ifoperstatus requires that the first argument be the interface index that this interface can be found at under the remote devices snmp tree.
  This should always be a positive integer, or zero.
  All options beyond the first, are arguments that must follow the snmpget command line parameters.
Everybody is somebody else’s weirdo
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: SNMP Password limitation

Post by abrist »

The test is run by apache, which does not, nor should not, have access to the resource.cfg file. Please save the changes and allow the check to run as a normally scheduled nagios check as it will then run as the nagios user which does have access to resource.cfg.
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.
User avatar
JohnFLi
Posts: 559
Joined: Mon Jun 17, 2013 3:11 pm

Re: SNMP Password limitation

Post by JohnFLi »

oy...now i get





Code: Select all

(No output on stdout) stderr: /bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `/usr/local/nagios/libexec/check_ifoperstatnag 16797696 -v3 -u sanswitchmonitor.svc -A "password shows correctly"  -a MD5 -l authNoPriv dc-n5k-s2'
Everybody is somebody else’s weirdo
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: SNMP Password limitation

Post by abrist »

Does it work if just run from the cli?

Code: Select all

/usr/local/nagios/libexec/check_ifoperstatnag 16797696 -v3 -u sanswitchmonitor.svc -A "<your pass here>"  -a MD5 -l authNoPriv dc-n5k-s2
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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: SNMP Password limitation

Post by lmiltchev »

Try escaping the "(" in the resource.cfg. Set up the password as such:

Code: Select all

$USER9$=jdj\(kdfsk
and give it another try.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
JohnFLi
Posts: 559
Joined: Mon Jun 17, 2013 3:11 pm

Re: SNMP Password limitation

Post by JohnFLi »

Code: Select all

Usage /usr/local/nagios/libexec/check_ifoperstatnag:
Check_ifoperstatus requires that the first argument be the interface index that this interface can be found at under the remote devices snmp tree.
This should always be a positive integer, or zero.
All options beyond the first, are arguments that must follow the snmpget command line parameters.


Think I will try to get the admin of the switch to change the password and get rid of the offending character....

Thank you for the try.
Everybody is somebody else’s weirdo
Locked