Page 1 of 5
SNMP Password limitation
Posted: Wed Feb 11, 2015 7:28 pm
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 :
ARG2:
Code: Select all
-v3 -u sanswitchmonitor.svc -A my(password -a MD5 -l noAuthNoPriv
Re: SNMP Password limitation
Posted: Wed Feb 11, 2015 9:15 pm
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
Re: SNMP Password limitation
Posted: Thu Feb 12, 2015 10:59 am
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
Re: SNMP Password limitation
Posted: Thu Feb 12, 2015 11:57 am
by abrist
Re: SNMP Password limitation
Posted: Thu Feb 12, 2015 1:47 pm
by JohnFLi
Ok, in resource.cfg I added
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.
Re: SNMP Password limitation
Posted: Thu Feb 12, 2015 1:52 pm
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.
Re: SNMP Password limitation
Posted: Thu Feb 12, 2015 4:26 pm
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'
Re: SNMP Password limitation
Posted: Thu Feb 12, 2015 4:44 pm
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
Re: SNMP Password limitation
Posted: Thu Feb 12, 2015 4:52 pm
by lmiltchev
Try escaping the "(" in the resource.cfg. Set up the password as such:
and give it another try.
Re: SNMP Password limitation
Posted: Thu Feb 12, 2015 6:02 pm
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.