Page 1 of 1

PNP4NAGIOS: Remove symbols (") from snmp query

Posted: Fri Apr 24, 2015 4:59 pm
by oarias
Hi all

Please I need your help

I am running a command using check_snmp but I am getting: SNMP OK - "4"

How can I create a PNP4NAGIOS template that removes " so I can get only the number so I can plot it.

Thanks
Oscar

Re: PNP4NAGIOS: Remove symbols (") from snmp query

Posted: Mon Apr 27, 2015 12:06 pm
by tgriep
Could you post how the check is configured?
Login to the server and change to the folder where the check_snmp is at and run the following.

Code: Select all

./check_snmp --version

Re: PNP4NAGIOS: Remove symbols (") from snmp query

Posted: Mon Apr 27, 2015 12:27 pm
by oarias
Thanks

Here you are:

./check_snmp --version
check_snmp v2.0.3 (nagios-plugins 2.0.3)

Re: PNP4NAGIOS: Remove symbols (") from snmp query

Posted: Mon Apr 27, 2015 2:11 pm
by abrist
Can you show us the full check command run from the cli with the verbose (-vvv) flag?

Re: PNP4NAGIOS: Remove symbols (") from snmp query

Posted: Mon Apr 27, 2015 3:05 pm
by oarias
Here you are:

/usr/bin/snmpget -Le -t 1 -r 5 -m '' -v 3 [authpriv] 10.33.13.11:161 1.3.6.1.4.1.8072.1.3.2.3.1.1.15.118.105.115.95.111.110.108.105.110.101.95.103.112.114.115
iso.3.6.1.4.1.8072.1.3.2.3.1.1.15.118.105.115.95.111.110.108.105.110.101.95.103.112.114.115 = STRING: "65"
Processing oid 1 (line 1)
oidname: iso.3.6.1.4.1.8072.1.3.2.3.1.1.15.118.105.115.95.111.110.108.105.110.101.95.103.112.114.115
response: STRING: "65"
SNMP OK - "65" |

Re: PNP4NAGIOS: Remove symbols (") from snmp query

Posted: Mon Apr 27, 2015 4:23 pm
by Box293
oarias wrote:Here you are:

/usr/bin/snmpget -Le -t 1 -r 5 -m '' -v 3 [authpriv] 10.33.13.11:161 1.3.6.1.4.1.8072.1.3.2.3.1.1.15.118.105.115.95.111.110.108.105.110.101.95.103.112.114.115
iso.3.6.1.4.1.8072.1.3.2.3.1.1.15.118.105.115.95.111.110.108.105.110.101.95.103.112.114.115 = STRING: "65"
Processing oid 1 (line 1)
oidname: iso.3.6.1.4.1.8072.1.3.2.3.1.1.15.118.105.115.95.111.110.108.105.110.101.95.103.112.114.115
response: STRING: "65"
SNMP OK - "65" |

Can you please give us the full check_snmp command that generated this output.

Re: PNP4NAGIOS: Remove symbols (") from snmp query

Posted: Mon Apr 27, 2015 4:47 pm
by oarias
./check_snmp -H 10.33.13.11 -o 1.3.6.1.4.1.8072.1.3.2.3.1.1.15.118.105.115.95.111.110.108.105.110.101.95.103.112.114.115 -U visadm -A Admin123 -L authNoPriv -P 3 -a MD5 -vvv

Re: PNP4NAGIOS: Remove symbols (") from snmp query

Posted: Tue Apr 28, 2015 9:17 am
by Box293
When I further look at your problem, the source of the problem is apparent in the verbose output:

Code: Select all

response: STRING: "65"
Because it's a STRING that is returned, it does not generate any performance data because it is a sting instead of an INTEGER.

I did a test on my machine:

Code: Select all

/usr/local/nagios/libexec/check_snmp -H 192.168.207.1  -p 161 -o sysName.0 -C public -P 2c -m SNMPv2-MIB -vvv

/usr/bin/snmpget -Le -t 1 -r 5 -m SNMPv2-MIB -v 2c [authpriv] 192.168.207.1:161 sysName.0
SNMPv2-MIB::sysName.0 = STRING: tlea7
Processing oid 1 (line 1)
  oidname: SNMPv2-MIB::sysName.0
  response: STRING: tlea7
SNMP OK - tlea7 |
I found my STRING output did NOT contain quotes, so I believe it is your remote device adding the quotes.

As for removing the quotes, I think you need a wrapper script that runs the check_snmp command and then strips the quotes and returns the original exit code and stripped string.