Page 2 of 2

Re: check_snmp uptime no longer working

Posted: Thu Jul 18, 2013 1:41 pm
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.

Re: check_snmp uptime no longer working

Posted: Fri Jul 19, 2013 6:33 am
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.

Re: check_snmp uptime no longer working

Posted: Fri Jul 19, 2013 9:09 am
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

Re: check_snmp uptime no longer working

Posted: Mon Jul 29, 2013 6:51 am
by WillemDH
cat /etc/sysconfig/i18n

LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"

Re: check_snmp uptime no longer working

Posted: Mon Jul 29, 2013 6:59 pm
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?

Re: check_snmp uptime no longer working

Posted: Tue Jul 30, 2013 4:24 am
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.

Re: check_snmp uptime no longer working

Posted: Tue Jul 30, 2013 12:22 pm
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 ?

Re: check_snmp uptime no longer working

Posted: Tue Aug 06, 2013 4:17 am
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?

Re: check_snmp uptime no longer working

Posted: Tue Aug 06, 2013 1:12 pm
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

Re: check_snmp uptime no longer working

Posted: Sat May 30, 2015 12:41 pm
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