check_snmp uptime no longer working

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: check_snmp uptime no longer working

Post by lmiltchev »

It seems the check is returning perfdata. Is the RRD for this service updating? Go to: "/usr/local/nagios/share/perfdata/<host_name>", run "ls -la" and show us the output.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: check_snmp uptime no longer working

Post by WillemDH »

The output of the ls -la command :

total 5324
drwxrwxr-x 2 nagios nagios 4096 Jul 19 13:27 .
drwxrwxr-x. 188 nagios nagios 12288 Jul 18 13:17 ..
-rwxrwxr-x 1 nagios nagios 384952 Jul 3 13:13 CPU_Usage.rrd
-rwxrwxr-x 1 nagios nagios 2264 Jul 3 13:13 CPU_Usage.xml
-rwxrwxr-x 1 nagios nagios 384952 Jul 3 13:13 __Disk_Usage.rrd
-rwxrwxr-x 1 nagios nagios 2319 Jul 3 13:13 __Disk_Usage.xml
-rwxrwxr-x 1 nagios nagios 768224 Jul 19 13:23 _HOST_.rrd
-rw-rw-rw- 1 nagios nagios 2768 Jul 19 13:23 _HOST_.xml
-rwxrwxr-x 1 nagios nagios 384952 Jul 19 13:24 LIN_CPU_Usage.rrd
-rw-rw-rw- 1 nagios nagios 2308 Jul 19 13:24 LIN_CPU_Usage.xml
-rwxrwxr-x 1 nagios nagios 384952 Jul 19 13:24 LIN___Disk_Usage.rrd
-rw-rw-rw- 1 nagios nagios 2363 Jul 19 13:24 LIN___Disk_Usage.xml
-rwxrwxr-x 1 nagios nagios 384952 Jul 19 13:27 LIN_Memory_Usage.rrd
-rw-rw-rw- 1 nagios nagios 2407 Jul 19 13:27 LIN_Memory_Usage.xml
-rwxrwxr-x 1 nagios nagios 384952 Jul 3 13:13 Memory_Usage.rrd
-rwxrwxr-x 1 nagios nagios 2363 Jul 3 13:13 Memory_Usage.xml
-rwxrwxr-x 1 nagios nagios 768224 Jul 3 13:13 Ping.rrd
-rwxrwxr-x 1 nagios nagios 2807 Jul 3 13:13 Ping.xml
-rwxrwxr-x 1 nagios nagios 384952 Jul 19 13:13 SNMP_CUCM_Registered_Phones.rrd
-rw-rw-rw- 1 nagios nagios 2394 Jul 19 13:13 SNMP_CUCM_Registered_Phones.xml
-rwxrwxr-x 1 nagios nagios 384952 Jul 19 13:17 SNMP_Registered_Phones.rrd
-rw-rw-rw- 1 nagios nagios 2482 Jul 19 13:17 SNMP_Registered_Phones.xml
-rwxrwxr-x 1 nagios nagios 768224 Jul 19 13:24 SRV_Ping.rrd
-rw-rw-rw- 1 nagios nagios 2857 Jul 19 13:24 SRV_Ping.xml

Seems the rrd is updating, the graph is showing some info, but not correctly, as the number of registered phones is still 148 since I added the service.
You do not have the required permissions to view the files attached to this post.
Nagios XI 5.8.1
https://outsideit.net
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_snmp uptime no longer working

Post by scottwilkerson »

This looks like a language setting problem. Can you show the output of the following command

Code: Select all

cat /etc/sysconfig/i18n
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: check_snmp uptime no longer working

Post by WillemDH »

cat /etc/sysconfig/i18n

LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"
Nagios XI 5.8.1
https://outsideit.net
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: check_snmp uptime no longer working

Post by scottwilkerson »

this is weird, can you post the output of

Code: Select all

# locale
Also, are your other graphs updating?
What does the advanced tab on the service detail page show for "performance data?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: check_snmp uptime no longer working

Post by WillemDH »

Output of locale:

LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

The advanced tab of the service shows the following:
Performance Data:
iso.3.6.1.4.1.9.9.156.1.5.5.0=144c

Yes, I think most of our graphs are working fine.
Nagios XI 5.8.1
https://outsideit.net
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: check_snmp uptime no longer working

Post by abrist »

WillemDH wrote:iso.3.6.1.4.1.9.9.156.1.5.5.0=144c
Could the issue here be that the oid returns a string, not a numerical value? "144c" will not be properly graphed. To get around this, you may need to write a small script to cleanup the output. Does the oid always return <value>+c ?
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
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: check_snmp uptime no longer working

Post by WillemDH »

Apparently yes, there seems to be a 'c' behind the value... Is there any guide or example about how to write a wrapper script. I have no idea how to start writing this wrapper script. As it's an snmp get, this should be a pearl script on the Nagios server?
Nagios XI 5.8.1
https://outsideit.net
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: check_snmp uptime no longer working

Post by abrist »

You either want the script to call the check_snmp plugin, return the output and clean it up, or write a new script to check the oid and subsequently cleanup the output.
For example, snmp_wrapper.sh:

Code: Select all

#!/bin/bash

HOSTADDRESS=$1
OID=$2
COMMUNITY=$3
VERSION=$4

/usr/local/nagios/libexec/check_snmp -H $HOSTADDRESS -o $OID -C $COMMUNITY -P $VERSION | sed 's/c//'
call it with:

Code: Select all

snmp_wrapper.sh <ip> <oid>  <community> 1
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
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: check_snmp uptime no longer working

Post by WillemDH »

Andy,

I finally managed to test this wrapper script. Made some small changes and this seems to work ok now. This is the wrapper script I'm using atm:

Code: Select all

#!/bin/bash

Hostaddress=$1
Oid=$2
Community=$3
Version=$4
Item=$5
Warning=$6
Critical=$7
Output="$(/usr/local/nagios/libexec/check_snmp -H $Hostaddress -o $Oid -C $Community -P $Version -l $Item -w $Warning -c $Critical)"
CleanOutput="$(sed 's/c//' <<<$Output)"
echo $CleanOutput

This thread can be closed.

Thanks and grtz

Willem
Nagios XI 5.8.1
https://outsideit.net
Locked