PNP4NAGIOS: Remove symbols (") from snmp query

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
oarias
Posts: 4
Joined: Fri Apr 24, 2015 4:39 pm

PNP4NAGIOS: Remove symbols (") from snmp query

Post 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
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

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

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
oarias
Posts: 4
Joined: Fri Apr 24, 2015 4:39 pm

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

Post by oarias »

Thanks

Here you are:

./check_snmp --version
check_snmp v2.0.3 (nagios-plugins 2.0.3)
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

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

Post by abrist »

Can you show us the full check command run from the cli with the verbose (-vvv) flag?
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.
oarias
Posts: 4
Joined: Fri Apr 24, 2015 4:39 pm

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

Post 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" |
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

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

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
oarias
Posts: 4
Joined: Fri Apr 24, 2015 4:39 pm

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

Post 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
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

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

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked