Capturing perf data from check_snmp

James Whittington James.Whittington at vc3.com
Thu Apr 14 18:50:03 CEST 2005


I'm using Nagios version 1.3 with Plugins version 1.4-2 on a debian
sarge system.

I am using perfparse to capture performance data to mysql.

I am trying to capture an rfinput value of a wireless device through the
check_snmp plugin and write it to a mysql db for reporting.

 

Since check_snmp does not currently write performance data in the output
I was trying to write a simple perl script to use check_snmp but add the
performance data to the output.

To make a long story short my simple perl script is adding performance
data to the output and perfparse is picking it up, but I noticed that
the service status in Nagios is always "OK" even when the Status
Information says otherwise.

Host  
<http://monitor2.conterrawireless.com/nagios/cgi-bin/status.cgi?hostgrou
p=Test-group&style=detail&sorttype=1&sortoption=1>  
<http://monitor2.conterrawireless.com/nagios/cgi-bin/status.cgi?hostgrou
p=Test-group&style=detail&sorttype=2&sortoption=1> 

Service  
<http://monitor2.conterrawireless.com/nagios/cgi-bin/status.cgi?hostgrou
p=Test-group&style=detail&sorttype=1&sortoption=2>  
<http://monitor2.conterrawireless.com/nagios/cgi-bin/status.cgi?hostgrou
p=Test-group&style=detail&sorttype=2&sortoption=2> 

Status  
<http://monitor2.conterrawireless.com/nagios/cgi-bin/status.cgi?hostgrou
p=Test-group&style=detail&sorttype=1&sortoption=3>  
<http://monitor2.conterrawireless.com/nagios/cgi-bin/status.cgi?hostgrou
p=Test-group&style=detail&sorttype=2&sortoption=3> 

Last Check  
<http://monitor2.conterrawireless.com/nagios/cgi-bin/status.cgi?hostgrou
p=Test-group&style=detail&sorttype=1&sortoption=4>  
<http://monitor2.conterrawireless.com/nagios/cgi-bin/status.cgi?hostgrou
p=Test-group&style=detail&sorttype=2&sortoption=4> 

Duration  
<http://monitor2.conterrawireless.com/nagios/cgi-bin/status.cgi?hostgrou
p=Test-group&style=detail&sorttype=1&sortoption=6>  
<http://monitor2.conterrawireless.com/nagios/cgi-bin/status.cgi?hostgrou
p=Test-group&style=detail&sorttype=2&sortoption=6> 

Attempt  
<http://monitor2.conterrawireless.com/nagios/cgi-bin/status.cgi?hostgrou
p=Test-group&style=detail&sorttype=1&sortoption=5>  
<http://monitor2.conterrawireless.com/nagios/cgi-bin/status.cgi?hostgrou
p=Test-group&style=detail&sorttype=2&sortoption=5> 

Status Information

RadioA

  <http://log2.isi-support.com/demo.html> 

check_rfinput_alt
<http://monitor2.conterrawireless.com/nagios/cgi-bin/extinfo.cgi?type=2&
host=SC-Flo3-Ace-Main&service=check_rfinput_alt> 

 

OK

04-14-2005 12:24:58

0d 2h 48m 22s

1/4

SNMP WARNING - *55* neg-dbm 

 

 

Here's how it looks through check_snmp

./check_snmp -H10.0.10.12
-oSNMPv2-SMI::enterprises.2378.1.1.2.1.2.80.1.1.3.5 -w 22:50

SNMP WARNING - *51*

 

Here's the modified output from the perl script that triggers perfdata
but kills status funtionallity in Nagios.  

./check_rfinput3 -H10.0.10.12

SNMP WARNING - *54* neg-dbm|rf-input=54

 

Here's the very very basic script that did the damage.

/usr/lib/nagios/plugins# more check_rfinput3

#!/usr/bin/perl

if ($ARGV[0] eq "") {

       print "Hostaddress required\n";

        print "ie.. script.pl 123.123.123.123\n";

}else{

        $HOSTADDRESS = $ARGV[0];

        $HOSTADDRESS =~ s/-H//;

$RFINPUT = `/usr/lib/nagios/plugins/check_snmp -H$HOSTADDRESS
-oSNMPv2-SMI::enterprises.2378.1.1.2.1.2.80.1.1.3.5 -w 22:48 -c 20:55 -u
neg-db

m`;

$RFRAW = $RFINPUT;

$RFRAW =~s/[^0-9]//g;

chomp($RFINPUT);

print "$RFINPUT|rf-input=$RFRAW";

}

 

 

 

 

 

I even tried to modify the check_snmp source code which fixed the status
info but did not get me perfdata for some reason.

./nagios-plugins-1.4/plugins/check_snmp -H10.0.10.12  -oSNMPv2-SMI::
enterprises.2378.1.1.2.1.2.80.1.1.3.5 -w 22:60

 54

SNMP OK - 54|SNMP= 54

 

The output from the perl wrapper looks pretty much the same and the
output from plugins that have perf data built in to them so I am at a
loss as to why it doesn't work.

I'm not a not a perl of nagios guru yet, so I figured I would through
this out to the list to see how other folks many have solved this
problem already.

 

Thanks for any guidance you all may provide.

 

James Whittington

VC3 Inc. 

803-978-2723 direct

800-787-1160 main

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20050414/b3b2ad9a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.gif
Type: image/gif
Size: 846 bytes
Desc: image002.gif
URL: <https://www.monitoring-lists.org/archive/users/attachments/20050414/b3b2ad9a/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 848 bytes
Desc: image001.gif
URL: <https://www.monitoring-lists.org/archive/users/attachments/20050414/b3b2ad9a/attachment-0001.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.jpg
Type: image/jpeg
Size: 823 bytes
Desc: image003.jpg
URL: <https://www.monitoring-lists.org/archive/users/attachments/20050414/b3b2ad9a/attachment.jpg>


More information about the Users mailing list