diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2003-09-17 19:05:49 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2003-09-17 19:05:49 +0000 |
commit | 5b37f0dd4a60cc987ebc38fd7433fb987c6b1771 (patch) | |
tree | 0367771c5a6f5f88f3ecebc960ac5c9153eadb22 /contrib/aix/check_ping | |
parent | dd3498f6b29544bd772ea4e002bb02710a9000f2 (diff) | |
download | monitoring-plugins-5b37f0dd4a60cc987ebc38fd7433fb987c6b1771.tar.gz |
Plugins obsolete from main check_disk and check_ping
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@738 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'contrib/aix/check_ping')
-rw-r--r-- | contrib/aix/check_ping | 117 |
1 files changed, 0 insertions, 117 deletions
diff --git a/contrib/aix/check_ping b/contrib/aix/check_ping deleted file mode 100644 index aaa8c84e..00000000 --- a/contrib/aix/check_ping +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/perl -w - -#================================================================ -# -# This perl script will accept an argument and simply pass it -# to ping. It works by sending 2 ping to the specified host -# and evaluating on the average delta time of those 2 pings. -# -# Author: SpEnTBoY -# Email: lonny@abyss.za.org -# April 5,2000 -# -#================================================================ - -#============================ -# State predefined stuff and -# requirements -#============================ - -require 5.004; -use POSIX; -use strict; - -sub usage; - -my $ipaddr = $ARGV[0]; - -my $TIMEOUT = 15; - -my %ERRORS = ('UNKNOWN' , '-1', - 'OK' , '0', - 'WARNING', '1', - 'CRITICAL', '2'); - -my $remote = shift || &usage(%ERRORS); -my $warning = shift || 750; -my $critical = shift || 1000; - -my $state = "OK"; -my $answer = undef; -my $offset = undef; -my $line = undef; - -#============================================================ -# If theres no response we can exit the bloody thing cleanly -# last thing I want to do is hang an AIX system ;-) -#============================================================ - -$SIG{'ALRM'} = sub { - print ("ERROR: No response from PING! (alarm)\n"); - exit $ERRORS{"UNKNOWN"}; -}; -alarm($TIMEOUT); - -#================================================ -# Pass stddn from $ARGV to the command and parse -# the info we need (namely the value for "max" -#================================================ - - - -open(PING,"/usr/sbin/ping -c 2 '$ipaddr' >&1|"); -while (<PING>) { - $line = $_; - if (/round-trip min\/avg\/max = (.+)\/(.+)\/(.+) ms/) { - $offset = $3; - last; - } -} - -#================================================== -# Do some error checking on the output of the file -# and implement values for <crit> and <warn> -# deffinitions if they were specified by the user -# or sub in the predefined ones -#================================================== - -if (defined $offset) { - if (abs($offset) > $warning) { - if (abs($offset) > $critical) { - $state = "CRITICAL"; - $answer = ": Ping Time $offset MS greater than +/- $critical MS\n"; - } else { - $state = "WARNING"; - $answer = ": Ping Time $offset MS greater than +/- $warning MS\n"; - } - } else { - $state = "OK"; - $answer = ": Ping Time $offset MS\n"; - } -} else { - $state = "UNKNOWN"; - $answer = ": $line\n"; -} -print ("$state$answer"); -exit $ERRORS{$state}; - -sub usage { - print "\n"; - print "#=========================================\n"; - print "Check_Ping 0.02 script by Lonny Selinger\n"; - print "Made with AIX in mind ;-)\n"; - print "#=========================================\n"; - print "\n"; - print "#================================================\n"; - print " I'm going to need a few more arguments from you\n"; - print "#================================================\n"; - print "\n"; - print "#================================================\n"; - print "Usage: check_ping <host> [<warn> [<crit>]\n"; - print "#================================================\n"; - print "\n"; - print "<warn> = Ping in MS at which a warning message will be generated.\n Defaults to 750.\n"; - print "<crit> = Ping in MS at which a critical message will be generated.\n Defaults to 1000.\n\n"; - exit $ERRORS{"UNKNOWN"}; -} - |