Check No Output status


#1

Hi,
I’ve modified/created a perl plugin for chech mib entry.
th plugin is this:

#!/usr/bin/perl

Author : jakubowski Benjamin

Date : 19/12/2005

sub print_usage {
print " IP COMMUNITY \n";
}

$PROGNAME = “UptimeDL360G5”;

if ( @ARGV[0] eq “” || @ARGV[1] eq “” || @ARGV[2] eq “” ) {
print_usage();
exit 0;
}

$STATE_CRITICAL = 2;
$STATE_WARNING = 1;
$STATE_UNKNONW = 3;

$STATE_OK = 0;

$IP=@ARGV[0];
$COMMUNITY=@ARGV[1];
$warning=@ARGV[2];
$critical=@ARGV[3];
$resultat =snmpwalk -v 1 -c $COMMUNITY $IP 1.3.6.1.2.1.25.3.3.1.2;

if ( $resultat ) {
@pourcentage = split (/\n/,$resultat);
$j=0;

Getting Individual Value

    $i=0;
    foreach ( @pourcentage ) {
    s/HOST-RESOURCES-MIB::hrSystemUptime.0 = [Timeticks://g;](Timeticks://g;)
    $cpuuse=$_;
    print "Server Up from: $cpuuse";
    }

} else {
print “Unknown : No response\n”;
exit $STATE_UNKNONW;
}
print $RETVAL;
exit $RETVAL;

When I launch the check via prompt command the result is :
Server Up from: (83166406) 9 days, 15:01:04.060

but when th check run with nagios the current status is critical and Status information
is equal to “(No Output)”

The service line is:

define service{
use 5mNOC
host_name MioPc
service_description Available
check_command Check_snmpUptime
}

And checkcommands:
define command{
command_name Check_snmpUptime
command_line $USER1$/UptimeDL360G5 $HOSTADDRESS$ sgdnoc
}

Can help me??

bye and Tanks
~
"


#2

Run the script by hand again, but this time, as user nagios. If it fails, it’s due to permissions.


#3

i’ve already tested with nagios user and the hand test is ok !!