I have made an easy script that just shows me the uptime of a windows server with snmp.
Here is the script
#! /usr/bin/perl -w
use strict;
check_uptime_server IP COMMUNITY
my $PROGNAME = “Server Uptime”;
my $STATE_CRITICAL = 2;
my $STATE_OK = 0;
my $IP=$ARGV[0];
my $COMMUNITY=$ARGV[1];
my $resultat =snmpwalk -v 1 $IP -c $COMMUNITY hrSystemUptime
;
my @sid;
$resultat =~ s/HOST-RESOURCES-MIB::hrSystemUptime.0 = Timeticks: //g;
if ($resultat) {
print “Server Uptime : $resultat”;
exit $STATE_OK;
} else {
print “System uptime can not be verified\n”;
exit $STATE_CRITICAL;
}
The script gives as result if succesfull :
Server Uptime : (1862701002) 215 days, 14:10:10.02
How can I adjust the script so that (1862701002) is not given???
thanks