diff --git a/checkers/check_bl b/checkers/check_bl deleted file mode 100755 index f0632d27e1..0000000000 --- a/checkers/check_bl +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/perl -w -# -# check_bl plugin for nagios -# $Revision: 1.0 $ -# -# Nagios plugin designed to warn you if you mail servers appear in one of the -# many anti-spam 'blacklists' -# -# By Sam Bashton, Bashton Ltd -# bashton.com/content/nagios-plugins -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -use strict; -use lib "/usr/lib/nagios/plugins"; -use utils qw($TIMEOUT %ERRORS &print_revision &support); -use Net::DNS; -use vars qw($PROGNAME); -my ($verbose,$host),; -my ($opt_V,$opt_h,$opt_B,$opt_H,$opt_c); -$opt_V = $opt_h = $opt_B = $opt_H = $opt_c = ''; -my $state = 'UNKNOWN'; -sub print_help(); -sub print_usage(); - -$PROGNAME = "check_bl"; - -$ENV{'BASH_ENV'}=''; -$ENV{'ENV'}=''; -$ENV{'PATH'}=''; -$ENV{'LC_ALL'}='C'; - -use Getopt::Long; -Getopt::Long::Configure('bundling'); -GetOptions( - "V" => \$opt_V, "version" => \$opt_V, - "h" => \$opt_h, "help" => \$opt_h, - "H=s" => \$opt_H, "hostname=s" => \$opt_H, - "B=s" => \$opt_B, "blacklists=s" => \$opt_B, - "c=s" => \$opt_c, "critical=s" => \$opt_c -); - -# -h means display verbose help screen -if ($opt_h) { print_help(); exit $ERRORS{'OK'}; } - -# -V means display version number -if ($opt_V) { - print_revision($PROGNAME,'$Revision: 1.0 $ '); - exit $ERRORS{'OK'}; -} - -# First check the hostname is OK.. -unless ($opt_H) { print_usage(); exit $ERRORS{'UNKNOWN'}; } - -if (! utils::is_hostname($opt_H)){ - print "$opt_H is not a valid host name\n"; - print_usage(); - exit $ERRORS{"UNKNOWN"}; -}else{ - if ($opt_H =~ /[a-zA-Z]/ ) - # If the host contains letters we assume it's a hostname, not an IP - { - $host = lookup($opt_H); - } - else { $host = $opt_H } -} - - -# $opt_c is a count of the blacklists a mail server is in, -# after which state will be CRITICAL rather than WARNING -# By default any listing is CRITICAL -my $critcount = 0; -if ($opt_c) { $critcount = $opt_c }; - -# $opt_B is a comma seperated list of blacklists -$opt_B = shift unless ($opt_B); -unless ($opt_B) { print_usage(); exit -1 } -my @bls = split(/,/, $opt_B); - - -# Just in case of problems, let's not hang Nagios -$SIG{'ALRM'} = sub { - print ("ERROR: No response from BL server (alarm)\n"); - exit $ERRORS{"UNKNOWN"}; -}; -alarm($TIMEOUT); - -my %listed; # Hash of blacklists we're listed in. -foreach(@bls) -{ - if (blcheck($host,$_)) { $listed{$_} = 1 } -} - -if (scalar(keys(%listed)) == 0) { $state = 'OK' } -elsif (scalar(keys(%listed)) < $critcount) { $state = 'WARNING' } -else { $state = 'CRITICAL' } - -if (%listed) -{ - print "Listed at"; - foreach (keys(%listed)) { print " $_" } - print "\n"; -} -else { print "Not black-listed\n" } - -exit $ERRORS{$state}; - - -######## Subroutines ========================== - - -sub print_help() { - print_revision($PROGNAME,'$Revision: 1.0 $ '); - print "\n"; - support(); -} - -sub print_usage () { - print "Usage: \n"; - print " $PROGNAME -H host -B [blacklist1],[blacklist2] [-c critnum]\n"; - print " $PROGNAME [-h | --help]\n"; - print " $PROGNAME [-V | --version]\n"; -} - -sub blcheck -{ - my ($ip, $bl) = @_; - my $lookupip = $ip; - $lookupip =~ - s/([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/$4.$3.$2.$1.$bl/; - if (lookup($lookupip)) { return 1 } - else { return 0 } -} - -sub lookup -{ - my $tolookup = shift; - my $res = Net::DNS::Resolver->new; - my $query = $res->search($tolookup); - if ($query) - { - foreach my $rr ($query->answer) - { - next unless $rr->type eq "A"; # We're not interested in TXT records - return $rr->address; - } - } -} diff --git a/checkers/check_breeze b/checkers/check_breeze deleted file mode 100755 index 990e981636..0000000000 --- a/checkers/check_breeze +++ /dev/null @@ -1,87 +0,0 @@ -#! /usr/bin/perl -wT - - -use strict; -use Getopt::Long; -use vars qw($opt_V $opt_h $opt_w $opt_c $opt_H $opt_C $PROGNAME); -use lib "/usr/lib/nagios/plugins" ; -use utils qw(%ERRORS &print_revision &support &usage); - -$PROGNAME = "check_breeze"; - -sub print_help (); -sub print_usage (); - -$ENV{'PATH'}=''; -$ENV{'BASH_ENV'}=''; -$ENV{'ENV'}=''; - -Getopt::Long::Configure('bundling'); -GetOptions - ("V" => \$opt_V, "version" => \$opt_V, - "h" => \$opt_h, "help" => \$opt_h, - "w=s" => \$opt_w, "warning=s" => \$opt_w, - "c=s" => \$opt_c, "critical=s" => \$opt_c, - "H=s" => \$opt_H, "hostname=s" => \$opt_H, - "C=s" => \$opt_C, "community=s" => \$opt_C); - -if ($opt_V) { - print_revision($PROGNAME,'$Revision: 1.5 $'); - exit $ERRORS{'OK'}; -} - -if ($opt_h) {print_help(); exit $ERRORS{'OK'};} - -($opt_H) || usage("Host name/address not specified\n"); -my $host = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/); -($host) || usage("Invalid host: $opt_H\n"); - -($opt_w) || usage("Warning threshold not specified\n"); -my $warning = $1 if ($opt_w =~ /([0-9]{1,2}|100)+/); -($warning) || usage("Invalid warning threshold: $opt_w\n"); - -($opt_c) || usage("Critical threshold not specified\n"); -my $critical = $1 if ($opt_c =~ /([0-9]{1,2}|100)/); -($critical) || usage("Invalid critical threshold: $opt_c\n"); - -($opt_C) || ($opt_C = "public") ; - -my $sig=0; -$sig = `/usr/bin/snmpget $host $opt_C .1.3.6.1.4.1.710.3.2.3.1.3.0`; -my @test=split(/ /,$sig); -$sig=$test[2]; -$sig=int($sig); -if ($sig>100){$sig=100} - -print "Signal Strength at: $sig%\n"; - -exit $ERRORS{'CRITICAL'} if ($sig<$critical); -exit $ERRORS{'WARNING'} if ($sig<$warning); -exit $ERRORS{'OK'}; - - -sub print_usage () { - print "Usage: $PROGNAME -H [-C community] -w -c \n"; -} - -sub print_help () { - print_revision($PROGNAME,'$Revision: 1.5 $'); - print "Copyright (c) 2000 Jeffrey Blank/Karl DeBisschop - -This plugin reports the signal strength of a Breezecom wireless equipment - -"; - print_usage(); - print " --H, --hostname=HOST - Name or IP address of host to check --C, --community=community - SNMPv1 community (default public) --w, --warning=INTEGER - Percentage strength below which a WARNING status will result --c, --critical=INTEGER - Percentage strength below which a CRITICAL status will result - -"; - support(); -} diff --git a/checkers/check_by_ssh b/checkers/check_by_ssh deleted file mode 100755 index 9d3d1e5b18..0000000000 Binary files a/checkers/check_by_ssh and /dev/null differ diff --git a/checkers/check_dhcp b/checkers/check_dhcp deleted file mode 100755 index 9a4e4a3ef1..0000000000 Binary files a/checkers/check_dhcp and /dev/null differ diff --git a/checkers/check_dig b/checkers/check_dig deleted file mode 100755 index cd9af25c86..0000000000 Binary files a/checkers/check_dig and /dev/null differ diff --git a/checkers/check_disk b/checkers/check_disk deleted file mode 100755 index 26f20d852d..0000000000 Binary files a/checkers/check_disk and /dev/null differ diff --git a/checkers/check_disk_smb b/checkers/check_disk_smb deleted file mode 100755 index 80b3e2d930..0000000000 --- a/checkers/check_disk_smb +++ /dev/null @@ -1,296 +0,0 @@ -#! /usr/bin/perl -w -# -# -# check_disk.pl [warn] [critical] [port] -# -# Nagios host script to get the disk usage from a SMB share -# -# Changes and Modifications -# ========================= -# 7-Aug-1999 - Michael Anthon -# Created from check_disk.pl script provided with netsaint_statd (basically -# cause I was too lazy (or is that smart?) to write it from scratch) -# 8-Aug-1999 - Michael Anthon -# Modified [warn] and [critical] parameters to accept format of nnn[M|G] to -# allow setting of limits in MBytes or GBytes. Percentage settings for large -# drives is a pain in the butt -# 2-May-2002 - SGhosh fix for embedded perl -# -# $Id: check_disk_smb.pl,v 1.12 2005/04/17 22:22:41 seanius Exp $ -# - -require 5.004; -use POSIX; -use strict; -use Getopt::Long; -use vars qw($opt_P $opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $opt_a $verbose); -use vars qw($PROGNAME); -use lib "/usr/lib/nagios/plugins" ; -use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); - -sub print_help (); -sub print_usage (); - -$PROGNAME = "check_disk_smb"; - -$ENV{'PATH'}=''; -$ENV{'BASH_ENV'}=''; -$ENV{'ENV'}=''; - -Getopt::Long::Configure('bundling'); -GetOptions - ("v" => \$verbose, "verbose" => \$verbose, - "P=s" => \$opt_P, "port=s" => \$opt_P, - "V" => \$opt_V, "version" => \$opt_V, - "h" => \$opt_h, "help" => \$opt_h, - "w=s" => \$opt_w, "warning=s" => \$opt_w, - "c=s" => \$opt_c, "critical=s" => \$opt_c, - "p=s" => \$opt_p, "password=s" => \$opt_p, - "u=s" => \$opt_u, "username=s" => \$opt_u, - "s=s" => \$opt_s, "share=s" => \$opt_s, - "W=s" => \$opt_W, "workgroup=s" => \$opt_W, - "H=s" => \$opt_H, "hostname=s" => \$opt_H, - "a=s" => \$opt_a, "address=s" => \$opt_a); - -if ($opt_V) { - print_revision($PROGNAME,'$Revision: 1.12 $'); #' - exit $ERRORS{'OK'}; -} - -if ($opt_h) {print_help(); exit $ERRORS{'OK'};} - -my $smbclient= "$utils::PATH_TO_SMBCLIENT " ; -my $smbclientoptions= $opt_P ? "-p $opt_P " : ""; - - -# Options checking - -($opt_H) || ($opt_H = shift) || usage("Host name not specified\n"); -my $host = $1 if ($opt_H =~ /^([-_.A-Za-z0-9 ]+\$?)$/); -($host) || usage("Invalid host: $opt_H\n"); - -($opt_s) || ($opt_s = shift) || usage("Share volume not specified\n"); -my $share = $1 if ($opt_s =~ /^([-_.A-Za-z0-9]+\$?)$/); -($share) || usage("Invalid share: $opt_s\n"); - -($opt_u) || ($opt_u = shift) || ($opt_u = "guest"); -my $user = $1 if ($opt_u =~ /^([-_.A-Za-z0-9\\]+)$/); -($user) || usage("Invalid user: $opt_u\n"); - -($opt_p) || ($opt_p = shift) || ($opt_p = ""); -my $pass = $1 if ($opt_p =~ /(.*)/); - -($opt_w) || ($opt_w = shift) || ($opt_w = 85); -my $warn = $1 if ($opt_w =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/); -($warn) || usage("Invalid warning threshold: $opt_w\n"); - -($opt_c) || ($opt_c = shift) || ($opt_c = 95); -my $crit = $1 if ($opt_c =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/); -($crit) || usage("Invalid critical threshold: $opt_c\n"); - -# split the type from the unit value -#Check $warn and $crit for type (%/M/G) and set up for tests -#P = Percent, K = KBytes -my $warn_type; -my $crit_type; - -if ($opt_w =~ /^([0-9]+)\%?$/) { - $warn = "$1"; - $warn_type = "P"; -} elsif ($opt_w =~ /^([0-9]+)k$/) { - $warn_type = "K"; - $warn = $1; -} elsif ($opt_w =~ /^([0-9]+)M$/) { - $warn_type = "K"; - $warn = $1 * 1024; -} elsif ($opt_w =~ /^([0-9]+)G$/) { - $warn_type = "K"; - $warn = $1 * 1048576; -} -if ($opt_c =~ /^([0-9]+)\%?$/) { - $crit = "$1"; - $crit_type = "P"; -} elsif ($opt_c =~ /^([0-9]+)k$/) { - $crit_type = "K"; - $crit = $1; -} elsif ($opt_c =~ /^([0-9]+)M$/) { - $crit_type = "K"; - $crit = $1 * 1024; -} elsif ($opt_c =~ /^([0-9]+)G$/) { - $crit_type = "K"; - $crit = $1 * 1048576; -} - -# check if both warning and critical are percentage or size -unless( ( $warn_type eq "P" && $crit_type eq "P" ) || ( $warn_type ne "P" && $crit_type ne "P" ) ){ - $opt_w =~ s/\%/\%\%/g; - $opt_c =~ s/\%/\%\%/g; - usage("Both warning and critical should be same type- warning: $opt_w critical: $opt_c \n"); -} - -# verify warning is less than critical -if ( $warn_type eq "K") { - unless ( $warn > $crit) { - usage("Disk size: warning ($opt_w) should be greater than critical ($opt_c) \n"); - } -}else{ - unless ( $warn < $crit) { - $opt_w =~ s/\%/\%\%/g; - $opt_c =~ s/\%/\%\%/g; - usage("Percentage: warning ($opt_w) should be less than critical ($opt_c) \n"); - } -} - -my $workgroup = $1 if (defined($opt_W) && $opt_W =~ /(.*)/); - -my $address = $1 if (defined($opt_a) && $opt_a =~ /(.*)/); - -# end of options checking - - -my $state = "OK"; -my $answer = undef; -my $res = undef; -my @lines = undef; - -# Just in case of problems, let's not hang Nagios -$SIG{'ALRM'} = sub { - print "No Answer from Client\n"; - exit $ERRORS{"UNKNOWN"}; -}; -alarm($TIMEOUT); - -# Execute an "ls" on the share using smbclient program -# get the results into $res -if (defined($workgroup)) { - if (defined($address)) { - print "$smbclient " . "\/\/$host\/$share" ." $pass -W $workgroup -U $user $smbclientoptions -I $address -c ls\n" if ($verbose); - $res = qx/$smbclient "\/\/$host\/$share" $pass -W $workgroup -U $user $smbclientoptions -I $address -c ls/; - } else { - print "$smbclient " . "\/\/$host\/$share" ." $pass -W $workgroup -U $user $smbclientoptions -c ls\n" if ($verbose); - $res = qx/$smbclient "\/\/$host\/$share" $pass -W $workgroup -U $user $smbclientoptions -c ls/; - } -} else { - if (defined($address)) { - print "$smbclient " . "\/\/$host\/$share" ." $pass -U $user $smbclientoptions -I $address -c ls\n" if ($verbose); - $res = qx/$smbclient "\/\/$host\/$share" $pass -U $user $smbclientoptions -I $address -c ls/; - } else { - print "$smbclient " . "\/\/$host\/$share" ." $pass -U $user $smbclientoptions -c ls\n" if ($verbose); - $res = qx/$smbclient "\/\/$host\/$share" $pass -U $user $smbclientoptions -c ls/; - } -} -#Turn off alarm -alarm(0); - -#Split $res into an array of lines -@lines = split /\n/, $res; - -#Get the last line into $_ -$_ = $lines[$#lines]; -#print "$_\n"; - -#Process the last line to get free space. -#If line does not match required regexp, return an UNKNOWN error -if (/\s*(\d*) blocks of size (\d*)\. (\d*) blocks available/) { - - my ($avail) = ($3*$2)/1024; - my ($avail_bytes) = $avail; - my ($capper) = int(($3/$1)*100); - my ($mountpt) = "\\\\$host\\$share"; - - - if (int($avail / 1024) > 0) { - $avail = int($avail / 1024); - if (int($avail /1024) > 0) { - $avail = (int(($avail / 1024)*100))/100; - $avail = $avail ."G"; - } else { - $avail = $avail ."M"; - } - } else { - $avail = $avail ."K"; - } - -#print ":$warn:$warn_type:\n"; -#print ":$crit:$crit_type:\n"; -#print ":$avail:$avail_bytes:$capper:$mountpt:\n"; - - if ((($warn_type eq "P") && (100 - $capper) < $warn) || (($warn_type eq "K") && ($avail_bytes > $warn))) { - $answer = "Disk ok - $avail ($capper%) free on $mountpt\n"; - } elsif ((($crit_type eq "P") && (100 - $capper) < $crit) || (($crit_type eq "K") && ($avail_bytes > $crit))) { - $state = "WARNING"; - $answer = "WARNING: Only $avail ($capper%) free on $mountpt\n"; - } else { - $state = "CRITICAL"; - $answer = "CRITICAL: Only $avail ($capper%) free on $mountpt\n"; - } -} else { - $answer = "Result from smbclient not suitable\n"; - $state = "UNKNOWN"; - foreach (@lines) { - if (/(Access denied|NT_STATUS_LOGON_FAILURE)/) { - $answer = "Access Denied\n"; - $state = "CRITICAL"; - last; - } - if (/(Unknown host \w*|Connection.*failed)/) { - $answer = "$1\n"; - $state = "CRITICAL"; - last; - } - if (/(You specified an invalid share name|NT_STATUS_BAD_NETWORK_NAME)/) { - $answer = "Invalid share name \\\\$host\\$share\n"; - $state = "CRITICAL"; - last; - } - } -} - - -print $answer; -print "$state\n" if ($verbose); -exit $ERRORS{$state}; - -sub print_usage () { - print "Usage: $PROGNAME -H -s -u -p - -w -c [-W ] [-P ] [-a ]\n"; -} - -sub print_help () { - print_revision($PROGNAME,'$Revision: 1.12 $'); - print "Copyright (c) 2000 Michael Anthon/Karl DeBisschop - -Perl Check SMB Disk plugin for Nagios - -"; - print_usage(); - print " --H, --hostname=HOST - NetBIOS name of the server --s, --share=STRING - Share name to be tested --W, --workgroup=STRING - Workgroup or Domain used (Defaults to \"WORKGROUP\") --a, --address=IP - IP-address of HOST (only necessary if HOST is in another network) --u, --user=STRING - Username to log in to server. (Defaults to \"guest\") --p, --password=STRING - Password to log in to server. (Defaults to an empty password) --w, --warning=INTEGER or INTEGER[kMG] - Percent of used space at which a warning will be generated (Default: 85%) - --c, --critical=INTEGER or INTEGER[kMG] - Percent of used space at which a critical will be generated (Defaults: 95%) --P, --port=INTEGER - Port to be used to connect to. Some Windows boxes use 139, others 445 (Defaults to smbclient default) - - If thresholds are followed by either a k, M, or G then check to see if that - much disk space is available (kilobytes, Megabytes, Gigabytes) - - Warning percentage should be less than critical - Warning (remaining) disk space should be greater than critical. - -"; - support(); -} diff --git a/checkers/check_dns b/checkers/check_dns deleted file mode 100755 index 02e164e79f..0000000000 Binary files a/checkers/check_dns and /dev/null differ diff --git a/checkers/check_dummy b/checkers/check_dummy deleted file mode 100755 index e1d1319712..0000000000 Binary files a/checkers/check_dummy and /dev/null differ diff --git a/checkers/check_file_age b/checkers/check_file_age deleted file mode 100755 index a1ed17cebb..0000000000 --- a/checkers/check_file_age +++ /dev/null @@ -1,113 +0,0 @@ -#! /usr/bin/perl -w -# $Id: check_file_age.pl,v 1.2 2003/10/21 15:56:35 tonvoon Exp $ - -# check_file_age.pl Copyright (C) 2003 Steven Grimm -# -# Checks a file's size and modification time to make sure it's not empty -# and that it's sufficiently recent. -# -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# you should have received a copy of the GNU General Public License -# along with this program (or with Nagios); if not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA - -use strict; -use English; -use Getopt::Long; -use File::stat; -use vars qw($PROGNAME); -use lib "/usr/lib/nagios/plugins"; -use utils qw (%ERRORS &print_revision &support); - -sub print_help (); -sub print_usage (); - -my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V); -my ($result, $message, $age, $size, $st); - -$PROGNAME="check_file_age"; - -$opt_w = 240; -$opt_c = 600; -$opt_W = 0; -$opt_C = 0; -$opt_f = ""; - -Getopt::Long::Configure('bundling'); -GetOptions( - "V" => \$opt_V, "version" => \$opt_V, - "h" => \$opt_h, "help" => \$opt_h, - "f=s" => \$opt_f, "file" => \$opt_f, - "w=f" => \$opt_w, "warning-age=f" => \$opt_w, - "W=f" => \$opt_W, "warning-size=f" => \$opt_W, - "c=f" => \$opt_c, "critical-age=f" => \$opt_c, - "C=f" => \$opt_C, "critical-size=f" => \$opt_C); - -if ($opt_V) { - print_revision($PROGNAME, '$Id: check_file_age.pl,v 1.2 2003/10/21 15:56:35 tonvoon Exp $'); - exit $ERRORS{'OK'}; -} - -if ($opt_h) { - print_help(); - exit $ERRORS{'OK'}; -} - -$opt_f = shift unless ($opt_f); - -if (! $opt_f) { - print "No file specified\n"; - exit $ERRORS{'UNKNOWN'}; -} - -# Examine the file. -unless (-f $opt_f) { - print "$opt_f: File not found\n"; - exit $ERRORS{'UNKNOWN'}; -} - -$st = File::stat::stat($opt_f); -$age = time - $st->mtime; -$size = $st->size; - - -$result = 'OK'; - -if (($opt_c and $age > $opt_c) or ($opt_C and $size < $opt_C)) { - $result = 'CRITICAL'; -} -elsif (($opt_w and $age > $opt_w) or ($opt_W and $size < $opt_W)) { - $result = 'WARNING'; -} - -print "$result - $opt_f is $age seconds old and $size bytes\n"; -exit $ERRORS{$result}; - -sub print_usage () { - print "Usage:\n"; - print " $PROGNAME [-w ] [-c ] [-W ] [-C ] -f \n"; - print " $PROGNAME [-h | --help]\n"; - print " $PROGNAME [-V | --version]\n"; -} - -sub print_help () { - print_revision($PROGNAME, '$Id: check_file_age.pl,v 1.2 2003/10/21 15:56:35 tonvoon Exp $'); - print "Copyright (c) 2003 Steven Grimm\n\n"; - print_usage(); - print "\n"; - print " File must be no more than this many seconds old\n"; - print " File must be at least this many bytes long\n"; - print "\n"; - support(); -} diff --git a/checkers/check_flexlm b/checkers/check_flexlm deleted file mode 100755 index f77478a37d..0000000000 --- a/checkers/check_flexlm +++ /dev/null @@ -1,245 +0,0 @@ -#! /usr/bin/perl -w -# -# usage: -# check_flexlm.pl license_file -# -# Check available flexlm license managers. -# Use lmstat to check the status of the license server -# described by the license file given as argument. -# Check and interpret the output of lmstat -# and create returncodes and output. -# -# Contrary to the nagios concept, this script takes -# a file, not a hostname as an argument and returns -# the status of hosts and services described in that -# file. Use these hosts.cfg entries as an example -# -#host[anchor]=any host will do;some.address.com;;check-host-alive;3;120;24x7;1;1;1; -#service[anchor]=yodel;24x7;3;5;5;unix-admin;60;24x7;1;1;1;;check_flexlm!/opt/lic/licfiles/yodel_lic -#service[anchor]=yeehaw;24x7;3;5;5;unix-admin;60;24x7;1;1;1;;check_flexlm!/opt/lic/licfiles/yeehaw_lic -#command[check_flexlm]=/some/path/libexec/check_flexlm.pl $ARG1$ -# -# Notes: -# - you need the lmstat utility which comes with flexlm. -# - set the correct path in the variable $lmstat. -# -# initial version: 9-10-99 Ernst-Dieter Martin edmt@infineon.com -# -# License: GPL -# $Id: check_flexlm.pl,v 1.6 2003/02/04 06:16:16 sghosh Exp $ -# -# lmstat output patches from Steve Rigler/Cliff Rice 13-Apr-2002 -# srigler@marathonoil.com,cerice@marathonoil.com - - - -use strict; -use Getopt::Long; -use vars qw($opt_V $opt_h $opt_F $opt_t $verbose $PROGNAME); -use lib "/usr/lib/nagios/plugins"; -use utils qw(%ERRORS &print_revision &support &usage); - -$PROGNAME="check_flexlm"; - -sub print_help (); -sub print_usage (); - -$ENV{'PATH'}=''; -$ENV{'BASH_ENV'}=''; -$ENV{'ENV'}=''; - -Getopt::Long::Configure('bundling'); -GetOptions - ("V" => \$opt_V, "version" => \$opt_V, - "h" => \$opt_h, "help" => \$opt_h, - "v" => \$verbose, "verbose" => \$verbose, - "F=s" => \$opt_F, "filename=s" => \$opt_F, - "t=i" => \$opt_t, "timeout=i" => \$opt_t); - -if ($opt_V) { - print_revision($PROGNAME,'$Revision: 1.6 $'); - exit $ERRORS{'OK'}; -} - -unless (defined $opt_t) { - $opt_t = $utils::TIMEOUT ; # default timeout -} - - -if ($opt_h) {print_help(); exit $ERRORS{'OK'};} - -unless (defined $opt_F) { - print "Missing license.dat file\n"; - print_usage(); - exit $ERRORS{'UNKNOWN'}; -} -# Just in case of problems, let's not hang Nagios -$SIG{'ALRM'} = sub { - print "Timeout: No Answer from Client\n"; - exit $ERRORS{'UNKNOWN'}; -}; -alarm($opt_t); - -my $lmstat = $utils::PATH_TO_LMSTAT ; -unless (-x $lmstat ) { - print "Cannot find \"lmstat\"\n"; - exit $ERRORS{'UNKNOWN'}; -} - -($opt_F) || ($opt_F = shift) || usage("License file not specified\n"); -my $licfile = $1 if ($opt_F =~ /^(.*)$/); -($licfile) || usage("Invalid filename: $opt_F\n"); - -print "$licfile\n" if $verbose; - -if ( ! open(CMD,"$lmstat -c $licfile |") ) { - print "ERROR: Could not open \"$lmstat -c $licfile\" ($!)\n"; - exit exit $ERRORS{'UNKNOWN'}; -} - -my $serverup = 0; -my @upsrv; -my @downsrv; # list of servers up and down - -#my ($ls1,$ls2,$ls3,$lf1,$lf2,$lf3,$servers); - -# key off of the term "license server" and -# grab the status. Keep going until "Vendor" is found -# - -# -# Collect list of license servers by their status -# Vendor daemon status is ignored for the moment. - -while ( ) { - next if (/^lmstat/); # ignore 1st line - copyright - next if (/^Flexible/); # ignore 2nd line - timestamp - (/^Vendor/) && last; # ignore Vendor daemon status - print $_ if $verbose; - - if ($_ =~ /license server /) { # matched 1 (of possibly 3) license server - s/^\s*//; #some servers start at col 1, other have whitespace - # strip staring whitespace if any - if ( $_ =~ /UP/) { - $_ =~ /^(.*):/ ; - push(@upsrv, $1); - print "up:$1:\n" if $verbose; - } else { - $_ =~ /^(.*):/; - push(@downsrv, $1); - print "down:$1:\n" if $verbose; - } - - } - - -# if ( /^License server status: [0-9]*@([-0-9a-zA-Z_]*),[0-9]*@([-0-9a-zA-Z_]*),[0-9]*@([-0-9a-zA-Z_]*)/ ) { -# $ls1 = $1; -# $ls2 = $2; -# $ls3 = $3; -# $lf1 = $lf2 = $lf3 = 0; -# $servers = 3; -# } elsif ( /^License server status: [0-9]*@([-0-9a-zA-Z_]*)/ ) { -# $ls1 = $1; -# $ls2 = $ls3 = ""; -# $lf1 = $lf2 = $lf3 = 0; -# $servers = 1; -# } elsif ( / *$ls1: license server UP/ ) { -# print "$ls1 UP, "; -# $lf1 = 1 -# } elsif ( / *$ls2: license server UP/ ) { -# print "$ls2 UP, "; -# $lf2 = 1 -# } elsif ( / *$ls3: license server UP/ ) { -# print "$ls3 UP, "; -# $lf3 = 1 -# } elsif ( / *([^:]*: UP .*)/ ) { -# print " license server for $1\n"; -# $serverup = 1; -# } - -} - -#if ( $serverup == 0 ) { -# print " license server not running\n"; -# exit 2; -#} - -close CMD; - -if ($verbose) { - print "License Servers running: ".scalar(@upsrv) ."\n"; - foreach my $upserver (@upsrv) { - print "$upserver\n"; - } - print "License servers not running: ".scalar(@downsrv)."\n"; - foreach my $downserver (@downsrv) { - print "$downserver\n"; - } -} - -# -# print list of servers which are up. -# -if (scalar(@upsrv) > 0) { - print "License Servers running:"; - foreach my $upserver (@upsrv) { - print "$upserver,"; - } -} -# -# Ditto for those which are down. -# -if (scalar(@downsrv) > 0) { - print "License servers NOT running:"; - foreach my $downserver (@downsrv) { - print "$downserver,"; - } -} - -# perfdata -print "\n|flexlm::up:".scalar(@upsrv).";down:".scalar(@downsrv)."\n"; - -exit $ERRORS{'OK'} if ( scalar(@downsrv) == 0 ); -exit $ERRORS{'WARNING'} if ( (scalar(@upsrv) > 0) && (scalar(@downsrv) > 0)); - -#exit $ERRORS{'OK'} if ( $servers == $lf1 + $lf2 + $lf3 ); -#exit $ERRORS{'WARNING'} if ( $servers == 3 && $lf1 + $lf2 + $lf3 == 2 ); -exit $ERRORS{'CRITICAL'}; - - -sub print_usage () { - print "Usage: - $PROGNAME -F [-v] [-t] [-V] [-h] - $PROGNAME --help - $PROGNAME --version -"; -} - -sub print_help () { - print_revision($PROGNAME,'$Revision: 1.6 $'); - print "Copyright (c) 2000 Ernst-Dieter Martin/Karl DeBisschop - -Check available flexlm license managers - -"; - print_usage(); - print " --F, --filename=FILE - Name of license file (usually \"license.dat\") --v, --verbose - Print some extra debugging information (not advised for normal operation) --t, --timeout - Plugin time out in seconds (default = $utils::TIMEOUT ) --V, --version - Show version and license information --h, --help - Show this help screen - -Flexlm license managers usually run as a single server or three servers and a -quorum is needed. The plugin return OK if 1 (single) or 3 (triple) servers -are running, CRITICAL if 1(single) or 3 (triple) servers are down, and WARNING -if 1 or 2 of 3 servers are running\n -"; - support(); -} diff --git a/checkers/check_fping b/checkers/check_fping deleted file mode 100755 index 27f4bf8179..0000000000 Binary files a/checkers/check_fping and /dev/null differ diff --git a/checkers/check_ftp b/checkers/check_ftp deleted file mode 120000 index e838da97eb..0000000000 --- a/checkers/check_ftp +++ /dev/null @@ -1 +0,0 @@ -check_tcp \ No newline at end of file diff --git a/checkers/check_game b/checkers/check_game deleted file mode 100755 index f1b47bb4e5..0000000000 Binary files a/checkers/check_game and /dev/null differ diff --git a/checkers/check_hpjd b/checkers/check_hpjd deleted file mode 100755 index e59a7c1f8d..0000000000 Binary files a/checkers/check_hpjd and /dev/null differ diff --git a/checkers/check_http b/checkers/check_http deleted file mode 100755 index a0520d4e60..0000000000 Binary files a/checkers/check_http and /dev/null differ diff --git a/checkers/check_icmp b/checkers/check_icmp deleted file mode 100755 index aba7da4579..0000000000 Binary files a/checkers/check_icmp and /dev/null differ diff --git a/checkers/check_ifoperstatus b/checkers/check_ifoperstatus deleted file mode 100755 index 91c9b333c0..0000000000 --- a/checkers/check_ifoperstatus +++ /dev/null @@ -1,505 +0,0 @@ -#! /usr/bin/perl -w -# -# check_ifoperstatus.pl - nagios plugin -# -# Copyright (C) 2000 Christoph Kron, -# Modified 5/2002 to conform to updated Nagios Plugin Guidelines -# Added support for named interfaces per Valdimir Ivaschenko (S. Ghosh) -# Added SNMPv3 support (10/2003) -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# -# Report bugs to: nagiosplug-help@lists.sourceforge.net -# -# 11.01.2000 Version 1.0 -# $Id: check_ifoperstatus.pl,v 1.6 2004/12/07 03:13:14 mattkent Exp $ -# -# Patches from Guy Van Den Bergh to warn on ifadminstatus down interfaces -# instead of critical. -# -# Primary MIB reference - RFC 2863 - - -use POSIX; -use strict; -use lib "/usr/lib/nagios/plugins" ; -use utils qw($TIMEOUT %ERRORS &print_revision &support); - -use Net::SNMP; -use Getopt::Long; -&Getopt::Long::config('bundling'); - -my $PROGNAME = "check_ifoperstatus"; -sub print_help (); -sub usage (); -sub process_arguments (); - -my $timeout; -my $status; -my %ifOperStatus = ('1','up', - '2','down', - '3','testing', - '4','unknown', - '5','dormant', - '6','notPresent', - '7','lowerLayerDown'); # down due to the state of lower layer interface(s) - -my $state = "UNKNOWN"; -my $answer = ""; -my $snmpkey = 0; -my $community = "public"; -my $maxmsgsize = 1472 ; # Net::SNMP default is 1472 -my ($seclevel, $authproto, $secname, $authpass, $privpass, $auth, $priv, $context); -my $port = 161; -my @snmpoids; -my $sysUptime = '1.3.6.1.2.1.1.3.0'; -my $snmpIfDescr = '1.3.6.1.2.1.2.2.1.2'; -my $snmpIfAdminStatus = '1.3.6.1.2.1.2.2.1.7'; -my $snmpIfOperStatus = '1.3.6.1.2.1.2.2.1.8'; -my $snmpIfName = '1.3.6.1.2.1.31.1.1.1.1'; -my $snmpIfLastChange = '1.3.6.1.2.1.2.2.1.9'; -my $snmpIfAlias = '1.3.6.1.2.1.31.1.1.1.18'; -my $snmpLocIfDescr = '1.3.6.1.4.1.9.2.2.1.1.28'; -my $hostname; -my $ifName; -my $session; -my $error; -my $response; -my $snmp_version = 1 ; -my $ifXTable; -my $opt_h ; -my $opt_V ; -my $ifdescr; -my $key; -my $lastc; -my $dormantWarn; -my $adminWarn; -my $name; - -### Validate Arguments - -$status = process_arguments(); - - -# Just in case of problems, let's not hang Nagios -$SIG{'ALRM'} = sub { - print ("ERROR: No snmp response from $hostname (alarm)\n"); - exit $ERRORS{"UNKNOWN"}; -}; - -alarm($timeout); - - -## map ifdescr to ifindex - should look at being able to cache this value - -if (defined $ifdescr) { - # escape "/" in ifdescr - very common in the Cisco world - $ifdescr =~ s/\//\\\//g; - - $status=fetch_ifdescr(); # if using on device with large number of interfaces - # recommend use of SNMP v2 (get-bulk) - if ($status==0) { - $state = "UNKNOWN"; - printf "$state: could not retrive ifdescr snmpkey - $status-$snmpkey\n"; - $session->close; - exit $ERRORS{$state}; - } -} - - -## Main function - -$snmpIfAdminStatus = $snmpIfAdminStatus . "." . $snmpkey; -$snmpIfOperStatus = $snmpIfOperStatus . "." . $snmpkey; -$snmpIfDescr = $snmpIfDescr . "." . $snmpkey; -$snmpIfName = $snmpIfName . "." . $snmpkey ; -$snmpIfAlias = $snmpIfAlias . "." . $snmpkey ; - -push(@snmpoids,$snmpIfAdminStatus); -push(@snmpoids,$snmpIfOperStatus); -push(@snmpoids,$snmpIfDescr); -push(@snmpoids,$snmpIfName) if (defined $ifXTable) ; -push(@snmpoids,$snmpIfAlias) if (defined $ifXTable) ; - - if (!defined($response = $session->get_request(@snmpoids))) { - $answer=$session->error; - $session->close; - $state = 'WARNING'; - print ("$state: SNMP error: $answer\n"); - exit $ERRORS{$state}; - } - - $answer = sprintf("host '%s', %s(%s) is %s\n", - $hostname, - $response->{$snmpIfDescr}, - $snmpkey, - $ifOperStatus{$response->{$snmpIfOperStatus}} - ); - - - ## Check to see if ifName match is requested and it matches - exit if no match - ## not the interface we want to monitor - if ( defined $name && not ($response->{$snmpIfName} eq $name) ) { - $state = 'UNKNOWN'; - $answer = "Interface name ($name) doesn't match snmp value ($response->{$snmpIfName}) (index $snmpkey)"; - print ("$state: $answer"); - exit $ERRORS{$state}; - } - - ## define the interface name - if (defined $ifXTable) { - $name = $response->{$snmpIfName} ." - " .$response->{$snmpIfAlias} ; - }else{ - $name = $response->{$snmpIfDescr} ; - } - - ## if AdminStatus is down - some one made a consious effort to change config - ## - if ( not ($response->{$snmpIfAdminStatus} == 1) ) { - $answer = "Interface $name (index $snmpkey) is administratively down."; - if ( not defined $adminWarn or $adminWarn eq "w" ) { - $state = 'WARNING'; - } elsif ( $adminWarn eq "i" ) { - $state = 'OK'; - } elsif ( $adminWarn eq "c" ) { - $state = 'CRITICAL'; - } else { # If wrong value for -a, say warning - $state = 'WARNING'; - } - } - ## Check operational status - elsif ( $response->{$snmpIfOperStatus} == 2 ) { - $state = 'CRITICAL'; - $answer = "Interface $name (index $snmpkey) is down."; - } elsif ( $response->{$snmpIfOperStatus} == 5 ) { - if (defined $dormantWarn ) { - if ($dormantWarn eq "w") { - $state = 'WARNING'; - $answer = "Interface $name (index $snmpkey) is dormant."; - }elsif($dormantWarn eq "c") { - $state = 'CRITICAL'; - $answer = "Interface $name (index $snmpkey) is dormant."; - }elsif($dormantWarn eq "i") { - $state = 'OK'; - $answer = "Interface $name (index $snmpkey) is dormant."; - } - }else{ - # dormant interface - but warning/critical/ignore not requested - $state = 'CRITICAL'; - $answer = "Interface $name (index $snmpkey) is dormant."; - } - } elsif ( $response->{$snmpIfOperStatus} == 6 ) { - $state = 'CRITICAL'; - $answer = "Interface $name (index $snmpkey) notPresent - possible hotswap in progress."; - } elsif ( $response->{$snmpIfOperStatus} == 7 ) { - $state = 'CRITICAL'; - $answer = "Interface $name (index $snmpkey) down due to lower layer being down."; - - } elsif ( $response->{$snmpIfOperStatus} == 3 || $response->{$snmpIfOperStatus} == 4 ) { - $state = 'CRITICAL'; - $answer = "Interface $name (index $snmpkey) down (testing/unknown)."; - - } else { - $state = 'OK'; - $answer = "Interface $name (index $snmpkey) is up."; - } - - - -print ("$state: $answer"); -exit $ERRORS{$state}; - - -### subroutines - -sub fetch_ifdescr { - if (!defined ($response = $session->get_table($snmpIfDescr))) { - $answer=$session->error; - $session->close; - $state = 'CRITICAL'; - printf ("$state: SNMP error with snmp version $snmp_version ($answer)\n"); - $session->close; - exit $ERRORS{$state}; - } - - foreach $key ( keys %{$response}) { - if ($response->{$key} =~ /^$ifdescr$/) { - $key =~ /.*\.(\d+)$/; - $snmpkey = $1; - #print "$ifdescr = $key / $snmpkey \n"; #debug - } - } - unless (defined $snmpkey) { - $session->close; - $state = 'CRITICAL'; - printf "$state: Could not match $ifdescr on $hostname\n"; - exit $ERRORS{$state}; - } - - return $snmpkey; -} - -sub usage() { - printf "\nMissing arguments!\n"; - printf "\n"; - printf "usage: \n"; - printf "check_ifoperstatus -k -H [-C ]\n"; - printf "Copyright (C) 2000 Christoph Kron\n"; - printf "check_ifoperstatus.pl comes with ABSOLUTELY NO WARRANTY\n"; - printf "This programm is licensed under the terms of the "; - printf "GNU General Public License\n(check source code for details)\n"; - printf "\n\n"; - exit $ERRORS{"UNKNOWN"}; -} - -sub print_help() { - printf "check_ifoperstatus plugin for Nagios monitors operational \n"; - printf "status of a particular network interface on the target host\n"; - printf "\nUsage:\n"; - printf " -H (--hostname) Hostname to query - (required)\n"; - printf " -C (--community) SNMP read community (defaults to public,\n"; - printf " used with SNMP v1 and v2c\n"; - printf " -v (--snmp_version) 1 for SNMP v1 (default)\n"; - printf " 2 for SNMP v2c\n"; - printf " SNMP v2c will use get_bulk for less overhead\n"; - printf " if monitoring with -d\n"; - printf " -L (--seclevel) choice of \"noAuthNoPriv\", \"authNoPriv\", or \"authPriv\"\n"; - printf " -U (--secname) username for SNMPv3 context\n"; - printf " -c (--context) SNMPv3 context name (default is empty string)"; - printf " -A (--authpass) authentication password (cleartext ascii or localized key\n"; - printf " in hex with 0x prefix generated by using \"snmpkey\" utility\n"; - printf " auth password and authEngineID\n"; - printf " -a (--authproto) Authentication protocol ( MD5 or SHA1)\n"; - printf " -X (--privpass) privacy password (cleartext ascii or localized key\n"; - printf " in hex with 0x prefix generated by using \"snmpkey\" utility\n"; - printf " privacy password and authEngineID\n"; - printf " -k (--key) SNMP IfIndex value\n"; - printf " -d (--descr) SNMP ifDescr value\n"; - printf " -p (--port) SNMP port (default 161)\n"; - printf " -I (--ifmib) Agent supports IFMIB ifXTable. Do not use if\n"; - printf " you don't know what this is. \n"; - printf " -n (--name) the value should match the returned ifName\n"; - printf " (Implies the use of -I)\n"; - printf " -w (--warn =i|w|c) ignore|warn|crit if the interface is dormant (default critical)\n"; - printf " -D (--admin-down =i|w|c) same for administratively down interfaces (default warning)\n"; - printf " -M (--maxmsgsize) Max message size - usefull only for v1 or v2c\n"; - printf " -t (--timeout) seconds before the plugin times out (default=$TIMEOUT)\n"; - printf " -V (--version) Plugin version\n"; - printf " -h (--help) usage help \n\n"; - printf " -k or -d must be specified\n\n"; - printf "Note: either -k or -d must be specified and -d is much more network \n"; - printf "intensive. Use it sparingly or not at all. -n is used to match against\n"; - printf "a much more descriptive ifName value in the IfXTable to verify that the\n"; - printf "snmpkey has not changed to some other network interface after a reboot.\n\n"; - print_revision($PROGNAME, '$Revision: 1.6 $'); - -} - -sub process_arguments() { - $status = GetOptions( - "V" => \$opt_V, "version" => \$opt_V, - "h" => \$opt_h, "help" => \$opt_h, - "v=i" => \$snmp_version, "snmp_version=i" => \$snmp_version, - "C=s" => \$community, "community=s" => \$community, - "L=s" => \$seclevel, "seclevel=s" => \$seclevel, - "a=s" => \$authproto, "authproto=s" => \$authproto, - "U=s" => \$secname, "secname=s" => \$secname, - "A=s" => \$authpass, "authpass=s" => \$authpass, - "X=s" => \$privpass, "privpass=s" => \$privpass, - "c=s" => \$context, "context=s" => \$context, - "k=i" => \$snmpkey, "key=i",\$snmpkey, - "d=s" => \$ifdescr, "descr=s" => \$ifdescr, - "l=s" => \$lastc, "lastchange=s" => \$lastc, - "p=i" => \$port, "port=i" =>\$port, - "H=s" => \$hostname, "hostname=s" => \$hostname, - "I" => \$ifXTable, "ifmib" => \$ifXTable, - "n=s" => \$ifName, "name=s" => \$ifName, - "w=s" => \$dormantWarn, "warn=s" => \$dormantWarn, - "D=s" => \$adminWarn, "admin-down=s" => \$adminWarn, - "M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize, - "t=i" => \$timeout, "timeout=i" => \$timeout, - ); - - - - if ($status == 0){ - print_help(); - exit $ERRORS{'OK'}; - } - - if ($opt_V) { - print_revision($PROGNAME,'$Revision: 1.6 $ '); - exit $ERRORS{'OK'}; - } - - if ($opt_h) { - print_help(); - exit $ERRORS{'OK'}; - } - - if (! utils::is_hostname($hostname)){ - usage(); - exit $ERRORS{"UNKNOWN"}; - } - - - unless ($snmpkey > 0 || defined $ifdescr){ - printf "Either a valid snmpkey key (-k) or a ifDescr (-d) must be provided)\n"; - usage(); - exit $ERRORS{"UNKNOWN"}; - } - - - if (defined $name) { - $ifXTable=1; - } - - if (defined $dormantWarn) { - unless ($dormantWarn =~ /^(w|c|i)$/ ) { - printf "Dormant alerts must be one of w|c|i \n"; - exit $ERRORS{'UNKNOWN'}; - } - } - - unless (defined $timeout) { - $timeout = $TIMEOUT; - } - - if ($snmp_version =~ /3/ ) { - # Must define a security level even though default is noAuthNoPriv - # v3 requires a security username - if (defined $seclevel && defined $secname) { - - # Must define a security level even though defualt is noAuthNoPriv - unless ($seclevel eq ('noAuthNoPriv' || 'authNoPriv' || 'authPriv' ) ) { - usage(); - exit $ERRORS{"UNKNOWN"}; - } - - # Authentication wanted - if ($seclevel eq ('authNoPriv' || 'authPriv') ) { - - unless ($authproto eq ('MD5' || 'SHA1') ) { - usage(); - exit $ERRORS{"UNKNOWN"}; - } - - if ( !defined $authpass) { - usage(); - exit $ERRORS{"UNKNOWN"}; - }else{ - if ($authpass =~ /^0x/ ) { - $auth = "-authkey => $authpass" ; - }else{ - $auth = "-authpassword => $authpass"; - } - } - - } - - # Privacy (DES encryption) wanted - if ($seclevel eq 'authPriv' ) { - if (! defined $privpass) { - usage(); - exit $ERRORS{"UNKNOWN"}; - }else{ - if ($privpass =~ /^0x/){ - $priv = "-privkey => $privpass"; - }else{ - $priv = "-privpassword => $privpass"; - } - } - } - - # Context name defined or default - - unless ( defined $context) { - $context = ""; - } - - - - }else { - usage(); - exit $ERRORS{'UNKNOWN'}; ; - } - } # end snmpv3 - - - if ( $snmp_version =~ /[12]/ ) { - ($session, $error) = Net::SNMP->session( - -hostname => $hostname, - -community => $community, - -port => $port, - -version => $snmp_version, - -maxmsgsize => $maxmsgsize - ); - - if (!defined($session)) { - $state='UNKNOWN'; - $answer=$error; - print ("$state: $answer"); - exit $ERRORS{$state}; - } - - }elsif ( $snmp_version =~ /3/ ) { - - if ($seclevel eq 'noAuthNoPriv') { - ($session, $error) = Net::SNMP->session( - -hostname => $hostname, - -port => $port, - -version => $snmp_version, - -username => $secname, - ); - - }elsif ( $seclevel eq 'authNoPriv' ) { - ($session, $error) = Net::SNMP->session( - -hostname => $hostname, - -port => $port, - -version => $snmp_version, - -username => $secname, - $auth, - -authprotocol => $authproto, - ); - }elsif ($seclevel eq 'authPriv' ) { - ($session, $error) = Net::SNMP->session( - -hostname => $hostname, - -port => $port, - -version => $snmp_version, - -username => $secname, - $auth, - -authprotocol => $authproto, - $priv - ); - } - - - if (!defined($session)) { - $state='UNKNOWN'; - $answer=$error; - print ("$state: $answer"); - exit $ERRORS{$state}; - } - - }else{ - $state='UNKNOWN'; - print ("$state: No support for SNMP v$snmp_version yet\n"); - exit $ERRORS{$state}; - } - -} -## End validation - diff --git a/checkers/check_ifstatus b/checkers/check_ifstatus deleted file mode 100755 index 3f3d70234f..0000000000 --- a/checkers/check_ifstatus +++ /dev/null @@ -1,459 +0,0 @@ -#! /usr/bin/perl -w -# -# check_ifstatus.pl - nagios plugin -# -# -# Copyright (C) 2000 Christoph Kron -# Modified 5/2002 to conform to updated Nagios Plugin Guidelines (S. Ghosh) -# Added -x option (4/2003) -# Added -u option (4/2003) -# Added -M option (10/2003) -# Added SNMPv3 support (10/2003) -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# -# Report bugs to: ck@zet.net, nagiosplug-help@lists.sf.net -# -# 11.01.2000 Version 1.0 -# -# $Id: check_ifstatus.pl,v 1.9 2004/08/18 19:51:35 tonvoon Exp $ - -use POSIX; -use strict; -use lib "/usr/lib/nagios/plugins" ; -use utils qw($TIMEOUT %ERRORS &print_revision &support); - -use Net::SNMP; -use Getopt::Long; -Getopt::Long::Configure('bundling'); - -my $PROGNAME = "check_ifstatus"; - -sub print_help (); -sub usage (); -sub process_arguments (); - - -my $status; -my %ifOperStatus = ('1','up', - '2','down', - '3','testing', - '4','unknown', - '5','dormant', - '6','notPresent', - '7','lowerLayerDown'); # down due to the state of lower layer interface(s)); - -my $timeout ; -my $state = "UNKNOWN"; -my $answer = ""; -my $snmpkey=0; -my $snmpoid=0; -my $key=0; -my $community = "public"; -my $maxmsgsize = 1472 ; # Net::SNMP default is 1472 -my ($seclevel, $authproto, $secname, $authpass, $privpass, $auth, $priv, $context); -my $port = 161; -my @snmpoids; -my $snmpIfAdminStatus = '1.3.6.1.2.1.2.2.1.7'; -my $snmpIfDescr = '1.3.6.1.2.1.2.2.1.2'; -my $snmpIfOperStatus = '1.3.6.1.2.1.2.2.1.8'; -my $snmpIfName = '1.3.6.1.2.1.31.1.1.1.1'; -my $snmpIfAlias = '1.3.6.1.2.1.31.1.1.1.18'; -my $snmpLocIfDescr = '1.3.6.1.4.1.9.2.2.1.1.28'; -my $snmpIfType = '1.3.6.1.2.1.2.2.1.3'; -my $hostname; -my $session; -my $error; -my $response; -my %ifStatus; -my $ifup =0 ; -my $ifdown =0; -my $ifdormant = 0; -my $ifexclude = 0 ; -my $ifunused = 0; -my $ifmessage = ""; -my $snmp_version = 1; -my $ifXTable; -my $opt_h ; -my $opt_V ; -my $opt_u; -my $opt_x ; -my %excluded ; -my @unused_ports ; - - - - - -# Just in case of problems, let's not hang Nagios -$SIG{'ALRM'} = sub { - print ("ERROR: No snmp response from $hostname (alarm timeout)\n"); - exit $ERRORS{"UNKNOWN"}; -}; - - -#Option checking -$status = process_arguments(); - -if ($status != 0) -{ - print_help() ; - exit $ERRORS{'OK'}; -} - - -alarm($timeout); - -push(@snmpoids,$snmpIfOperStatus); -push(@snmpoids,$snmpIfAdminStatus); -push(@snmpoids,$snmpIfDescr); -push(@snmpoids,$snmpIfType); -push(@snmpoids,$snmpIfName) if ( defined $ifXTable); -push(@snmpoids,$snmpIfAlias) if ( defined $ifXTable); - - - - -foreach $snmpoid (@snmpoids) { - - if (!defined($response = $session->get_table($snmpoid))) { - $answer=$session->error; - $session->close; - $state = 'CRITICAL'; - if ( ( $snmpoid =~ $snmpIfName ) && defined $ifXTable ) { - print ("$state: Device does not support ifTable - try without -I option\n"); - }else{ - print ("$state: $answer for $snmpoid with snmp version $snmp_version\n"); - } - exit $ERRORS{$state}; - } - - foreach $snmpkey (keys %{$response}) { - $snmpkey =~ /.*\.(\d+)$/; - $key = $1; - $ifStatus{$key}{$snmpoid} = $response->{$snmpkey}; - } -} - - -$session->close; - -alarm(0); - -foreach $key (keys %ifStatus) { - - # skip unused interfaces - if (!defined($ifStatus{$key}{'notInUse'})) { - # check only if interface is administratively up - if ($ifStatus{$key}{$snmpIfAdminStatus} == 1 ) { - - # check only if interface type is not listed in %excluded - if (!defined $excluded{$ifStatus{$key}{$snmpIfType}} ) { - if ($ifStatus{$key}{$snmpIfOperStatus} == 1 ) { $ifup++ ;} - if ($ifStatus{$key}{$snmpIfOperStatus} == 2 ) { - $ifdown++ ; - if (defined $ifXTable) { - $ifmessage .= sprintf("%s: down -> %s
", - $ifStatus{$key}{$snmpIfName}, - $ifStatus{$key}{$snmpIfAlias}); - }else{ - $ifmessage .= sprintf("%s: down
", - $ifStatus{$key}{$snmpIfDescr}); - } - } - if ($ifStatus{$key}{$snmpIfOperStatus} == 5 ) { $ifdormant++ ;} - }else{ - $ifexclude++; - } - - } - }else{ - $ifunused++; - } -} - - if ($ifdown > 0) { - $state = 'CRITICAL'; - $answer = sprintf("host '%s', interfaces up: %d, down: %d, dormant: %d, excluded: %d, unused: %d
", - $hostname, - $ifup, - $ifdown, - $ifdormant, - $ifexclude, - $ifunused); - $answer = $answer . $ifmessage . "\n"; - } - else { - $state = 'OK'; - $answer = sprintf("host '%s', interfaces up: %d, down: %d, dormant: %d, excluded: %d, unused: %d", - $hostname, - $ifup, - $ifdown, - $ifdormant, - $ifexclude, - $ifunused); - } -my $perfdata = sprintf("up=%d,down=%d,dormant=%d,excluded=%d,unused=%d",$ifup,$ifdown,$ifdormant,$ifexclude,$ifunused); -print ("$state: $answer |$perfdata\n"); -exit $ERRORS{$state}; - - -sub usage (){ - printf "\nMissing arguments!\n"; - printf "\n"; - printf "check_ifstatus -C -p -H \n"; - printf "Copyright (C) 2000 Christoph Kron\n"; - printf "Updates 5/2002 Subhendu Ghosh\n"; - printf "\n\n"; - support(); - exit $ERRORS{"UNKNOWN"}; -} - -sub print_help (){ - printf "check_ifstatus plugin for Nagios monitors operational \n"; - printf "status of each network interface on the target host\n"; - printf "\nUsage:\n"; - printf " -H (--hostname) Hostname to query - (required)\n"; - printf " -C (--community) SNMP read community (defaults to public,\n"; - printf " used with SNMP v1 and v2c\n"; - printf " -v (--snmp_version) 1 for SNMP v1 (default)\n"; - printf " 2 for SNMP v2c\n"; - printf " SNMP v2c will use get_bulk for less overhead\n"; - printf " 3 for SNMPv3 (requires -U option)"; - printf " -p (--port) SNMP port (default 161)\n"; - printf " -I (--ifmib) Agent supports IFMIB ifXTable. For Cisco - this will provide\n"; - printf " the descriptive name. Do not use if you don't know what this is. \n"; - printf " -x (--exclude) A comma separated list of ifType values that should be excluded \n"; - printf " from the report (default for an empty list is PPP(23).\n"; - printf " -u (--unused_ports) A comma separated list of ifIndex values that should be excluded \n"; - printf " from the report (default is an empty exclusion list).\n"; - printf " See the IANAifType-MIB for a list of interface types.\n"; - printf " -L (--seclevel) choice of \"noAuthNoPriv\", \"authNoPriv\", or \"authPriv\"\n"; - printf " -U (--secname) username for SNMPv3 context\n"; - printf " -c (--context) SNMPv3 context name (default is empty string)"; - printf " -A (--authpass) authentication password (cleartext ascii or localized key\n"; - printf " in hex with 0x prefix generated by using \"snmpkey\" utility\n"; - printf " auth password and authEngineID\n"; - printf " -a (--authproto) Authentication protocol ( MD5 or SHA1)\n"; - printf " -X (--privpass) privacy password (cleartext ascii or localized key\n"; - printf " in hex with 0x prefix generated by using \"snmpkey\" utility\n"; - printf " privacy password and authEngineID\n"; - printf " -M (--maxmsgsize) Max message size - usefull only for v1 or v2c\n"; - printf " -t (--timeout) seconds before the plugin times out (default=$TIMEOUT)\n"; - printf " -V (--version) Plugin version\n"; - printf " -h (--help) usage help \n\n"; - print_revision($PROGNAME, '$Revision: 1.9 $'); - -} - -sub process_arguments() { - $status = GetOptions( - "V" => \$opt_V, "version" => \$opt_V, - "h" => \$opt_h, "help" => \$opt_h, - "v=i" => \$snmp_version, "snmp_version=i" => \$snmp_version, - "C=s" => \$community,"community=s" => \$community, - "L=s" => \$seclevel, "seclevel=s" => \$seclevel, - "a=s" => \$authproto, "authproto=s" => \$authproto, - "U=s" => \$secname, "secname=s" => \$secname, - "A=s" => \$authpass, "authpass=s" => \$authpass, - "X=s" => \$privpass, "privpass=s" => \$privpass, - "c=s" => \$context, "context=s" => \$context, - "p=i" =>\$port, "port=i" => \$port, - "H=s" => \$hostname, "hostname=s" => \$hostname, - "I" => \$ifXTable, "ifmib" => \$ifXTable, - "x:s" => \$opt_x, "exclude:s" => \$opt_x, - "u=s" => \$opt_u, "unused_ports=s" => \$opt_u, - "M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize, - "t=i" => \$timeout, "timeout=i" => \$timeout, - ); - - if ($status == 0){ - print_help() ; - exit $ERRORS{'OK'}; - } - if ($opt_V) { - print_revision($PROGNAME,'$Revision: 1.9 $ '); - exit $ERRORS{'OK'}; - } - - if ($opt_h) { - print_help(); - exit $ERRORS{'OK'}; - } - - unless (defined $timeout) { - $timeout = $TIMEOUT; - } - - if ($snmp_version =~ /3/ ) { - # Must define a security level even though default is noAuthNoPriv - # v3 requires a security username - if (defined $seclevel && defined $secname) { - - # Must define a security level even though defualt is noAuthNoPriv - unless ($seclevel eq ('noAuthNoPriv' || 'authNoPriv' || 'authPriv' ) ) { - usage(); - exit $ERRORS{"UNKNOWN"}; - } - - # Authentication wanted - if ($seclevel eq ('authNoPriv' || 'authPriv') ) { - - unless ($authproto eq ('MD5' || 'SHA1') ) { - usage(); - exit $ERRORS{"UNKNOWN"}; - } - - if ( !defined $authpass) { - usage(); - exit $ERRORS{"UNKNOWN"}; - }else{ - if ($authpass =~ /^0x/ ) { - $auth = "-authkey => $authpass" ; - }else{ - $auth = "-authpassword => $authpass"; - } - } - - } - - # Privacy (DES encryption) wanted - if ($seclevel eq 'authPriv' ) { - if (! defined $privpass) { - usage(); - exit $ERRORS{"UNKNOWN"}; - }else{ - if ($privpass =~ /^0x/){ - $priv = "-privkey => $privpass"; - }else{ - $priv = "-privpassword => $privpass"; - } - } - } - - # Context name defined or default - - unless ( defined $context) { - $context = ""; - } - - - - }else { - usage(); - exit $ERRORS{'UNKNOWN'}; ; - } - } # end snmpv3 - - # for snmp v1 & v2c we default to community = "public" - - # Excluded interfaces types (ifType) (backup interfaces, dial-on demand interfaces, PPP interfaces - if (defined $opt_x) { - my @x = split(/,/, $opt_x); - if ( @x) { - foreach $key (@x){ - $excluded{$key} = 1; - } - }else{ - $excluded{23} = 1; # default PPP(23) if empty list - note (AIX seems to think PPP is 22 according to a post) - } - } - - # Excluded interface ports (ifIndex) - management reasons - if ($opt_u) { - @unused_ports = split(/,/,$opt_u); - foreach $key (@unused_ports) { - $ifStatus{$key}{'notInUse'}++ ; - } - } - - if (! utils::is_hostname($hostname)){ - usage(); - exit $ERRORS{"UNKNOWN"}; - } - - # create SNMP session handle based on options passed. - - if ( ! $snmp_version ) { - $snmp_version =1 ; - }else{ - if ( $snmp_version =~ /[12]/ ) { - - ($session, $error) = Net::SNMP->session( - -hostname => $hostname, - -community => $community, - -port => $port, - -version => $snmp_version, - -maxmsgsize => $maxmsgsize - ); - - if (!defined($session)) { - $state='UNKNOWN'; - $answer=$error; - print ("$state: $answer"); - exit $ERRORS{$state}; - } - - - }elsif ( $snmp_version =~ /3/ ) { - - if ($seclevel eq 'noAuthNoPriv') { - ($session, $error) = Net::SNMP->session( - -hostname => $hostname, - -port => $port, - -version => $snmp_version, - -username => $secname, - ); - - }elsif ( $seclevel eq 'authNoPriv' ) { - ($session, $error) = Net::SNMP->session( - -hostname => $hostname, - -port => $port, - -version => $snmp_version, - -username => $secname, - -authprotocol => $authproto, - $auth - ); - }elsif ($seclevel eq 'authPriv' ) { - ($session, $error) = Net::SNMP->session( - -hostname => $hostname, - -port => $port, - -version => $snmp_version, - -username => $secname, - -authprotocol => $authproto, - $auth, - $priv - ); - } - - - if (!defined($session)) { - $state='UNKNOWN'; - $answer=$error; - print ("$state: $answer"); - exit $ERRORS{$state}; - } - - }else{ - $state='UNKNOWN'; - print ("$state: No support for SNMP v$snmp_version yet\n"); - exit $ERRORS{$state}; - } -} - -return $ERRORS{"OK"}; - -} diff --git a/checkers/check_imap b/checkers/check_imap deleted file mode 120000 index e838da97eb..0000000000 --- a/checkers/check_imap +++ /dev/null @@ -1 +0,0 @@ -check_tcp \ No newline at end of file diff --git a/checkers/check_ircd b/checkers/check_ircd deleted file mode 100755 index 8900b8aeeb..0000000000 --- a/checkers/check_ircd +++ /dev/null @@ -1,250 +0,0 @@ -#! /usr/bin/perl -wT - -# ----------------------------------------------------------------------------- -# File Name: check_ircd.pl -# -# Author: Richard Mayhew - South Africa -# -# Date: 1999/09/20 -# -# $Id: check_ircd.pl,v 1.3 2002/05/07 05:35:49 sghosh Exp $ -# -# Description: This script will check to see if an IRCD is running -# about how many users it has -# -# Email: netsaint@splash.co.za -# -# ----------------------------------------------------------------------------- -# Copyright 1999 (c) Richard Mayhew -# -# Credits go to Ethan Galstad for coding Nagios -# -# If any changes are made to this script, please mail me a copy of the -# changes :) -# -# Some code taken from Charlie Cook (check_disk.pl) -# -# License GPL -# -# ----------------------------------------------------------------------------- -# Date Author Reason -# ---- ------ ------ -# -# 1999/09/20 RM Creation -# -# 1999/09/20 TP Changed script to use strict, more secure by -# specifying $ENV variables. The bind command is -# still insecure through. Did most of my work -# with perl -wT and 'use strict' -# -# test using check_ircd.pl (irc-2.mit.edu|irc.erols.com|irc.core.com) -# 2002/05/02 SG Fixed for Embedded Perl -# - -# ----------------------------------------------------------------[ Require ]-- - -require 5.004; - -# -------------------------------------------------------------------[ Uses ]-- - -use Socket; -use strict; -use Getopt::Long; -use vars qw($opt_V $opt_h $opt_t $opt_p $opt_H $opt_w $opt_c $verbose); -use vars qw($PROGNAME); -use lib "/usr/lib/nagios/plugins"; -use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); - -# ----------------------------------------------------[ Function Prototypes ]-- - -sub print_help (); -sub print_usage (); -sub connection ($$$$); -sub bindRemote ($$$); - -# -------------------------------------------------------------[ Enviroment ]-- - -$ENV{PATH} = ""; -$ENV{ENV} = ""; -$ENV{BASH_ENV} = ""; - -# -----------------------------------------------------------------[ Global ]-- - -$PROGNAME = "check_ircd"; -my $NICK="ircd$$"; -my $USER_INFO="monitor localhost localhost : "; - -# -------------------------------------------------------------[ connection ]-- -sub connection ($$$$) -{ - my ($in_remotehost,$in_users,$in_warn,$in_crit) = @_; - my $state; - my $answer; - - print "connection(debug): users = $in_users\n" if $verbose; - $in_users =~ s/\ //g; - - if ($in_users >= 0) { - - if ($in_users > $in_crit) { - $state = "CRITICAL"; - $answer = "Critical Number Of Clients Connected : $in_users (Limit = $in_crit)\n"; - - } elsif ($in_users > $in_warn) { - $state = "WARNING"; - $answer = "Warning Number Of Clients Connected : $in_users (Limit = $in_warn)\n"; - - } else { - $state = "OK"; - $answer = "IRCD ok - Current Local Users: $in_users\n"; - } - - } else { - $state = "UNKNOWN"; - $answer = "Server $in_remotehost has less than 0 users! Something is Really WRONG!\n"; - } - - print ClientSocket "quit\n"; - print $answer; - exit $ERRORS{$state}; -} - -# ------------------------------------------------------------[ print_usage ]-- - -sub print_usage () { - print "Usage: $PROGNAME -H [-w ] [-c ] [-p ]\n"; -} - -# -------------------------------------------------------------[ print_help ]-- - -sub print_help () -{ - print_revision($PROGNAME,'$Revision: 1.3 $ '); - print "Copyright (c) 2000 Richard Mayhew/Karl DeBisschop - -Perl Check IRCD plugin for Nagios - -"; - print_usage(); - print " --H, --hostname=HOST - Name or IP address of host to check --w, --warning=INTEGER - Number of connected users which generates a warning state (Default: 50) --c, --critical=INTEGER - Number of connected users which generates a critical state (Default: 100) --p, --port=INTEGER - Port that the ircd daemon is running on (Default: 6667) --v, --verbose - Print extra debugging information -"; -} - -# -------------------------------------------------------------[ bindRemote ]-- - -sub bindRemote ($$$) -{ - my ($in_remotehost, $in_remoteport, $in_hostname) = @_; - my $proto = getprotobyname('tcp'); - my $sockaddr; - my $this; - my $that; - my ($name, $aliases,$type,$len,$thataddr) = gethostbyname($in_remotehost); -# ($name,$aliases,$type,$len,$thisaddr) = gethostbyname($in_hostname); - - if (!socket(ClientSocket,AF_INET, SOCK_STREAM, $proto)) { - print "IRCD UNKNOWN: Could not start socket ($!)\n"; - exit $ERRORS{"UNKNOWN"}; - } - $sockaddr = 'S n a4 x8'; - $this = pack($sockaddr, AF_INET, 0, INADDR_ANY); - $that = pack($sockaddr, AF_INET, $in_remoteport, $thataddr); - if (!bind(ClientSocket, $this)) { - print "IRCD UNKNOWN: Could not bind socket ($!)\n"; - exit $ERRORS{"UNKNOWN"}; - } - if (!connect(ClientSocket, $that)) { - print "IRCD UNKNOWN: Could not connect socket ($!)\n"; - exit $ERRORS{"UNKNOWN"}; - } - select(ClientSocket); $| = 1; select(STDOUT); - return \*ClientSocket; -} - -# ===================================================================[ MAIN ]== - -MAIN: -{ - my $hostname; - - Getopt::Long::Configure('bundling'); - GetOptions - ("V" => \$opt_V, "version" => \$opt_V, - "h" => \$opt_h, "help" => \$opt_h, - "v" => \$verbose,"verbose" => \$verbose, - "t=i" => \$opt_t, "timeout=i" => \$opt_t, - "w=i" => \$opt_w, "warning=i" => \$opt_w, - "c=i" => \$opt_c, "critical=i" => \$opt_c, - "p=i" => \$opt_p, "port=i" => \$opt_p, - "H=s" => \$opt_H, "hostname=s" => \$opt_H); - - if ($opt_V) { - print_revision($PROGNAME,'$Revision: 1.3 $ '); - exit $ERRORS{'OK'}; - } - - if ($opt_h) {print_help(); exit $ERRORS{'OK'};} - - ($opt_H) || ($opt_H = shift) || usage("Host name/address not specified\n"); - my $remotehost = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/); - ($remotehost) || usage("Invalid host: $opt_H\n"); - - ($opt_w) || ($opt_w = shift) || ($opt_w = 50); - my $warn = $1 if ($opt_w =~ /^([0-9]+)$/); - ($warn) || usage("Invalid warning threshold: $opt_w\n"); - - ($opt_c) || ($opt_c = shift) || ($opt_c = 100); - my $crit = $1 if ($opt_c =~ /^([0-9]+)$/); - ($crit) || usage("Invalid critical threshold: $opt_c\n"); - - ($opt_p) || ($opt_p = shift) || ($opt_p = 6667); - my $remoteport = $1 if ($opt_p =~ /^([0-9]+)$/); - ($remoteport) || usage("Invalid port: $opt_p\n"); - - if ($opt_t && $opt_t =~ /^([0-9]+)$/) { $TIMEOUT = $1; } - - # Just in case of problems, let's not hang Nagios - $SIG{'ALRM'} = sub { - print "Somthing is Taking a Long Time, Increase Your TIMEOUT (Currently Set At $TIMEOUT Seconds)\n"; - exit $ERRORS{"UNKNOWN"}; - }; - - alarm($TIMEOUT); - - chomp($hostname = `/bin/hostname`); - $hostname = $1 if ($hostname =~ /([-.a-zA-Z0-9]+)/); - my ($name, $alias, $proto) = getprotobyname('tcp'); - print "MAIN(debug): hostname = $hostname\n" if $verbose; - - print "MAIN(debug): binding to remote host: $remotehost -> $remoteport -> $hostname\n" if $verbose; - my $ClientSocket = &bindRemote($remotehost,$remoteport,$hostname); - - print ClientSocket "NICK $NICK\nUSER $USER_INFO\n"; - - while () { - print "MAIN(debug): default var = $_\n" if $verbose; - - # DALnet,LagNet,UnderNet etc. Require this! - # Replies with a PONG when presented with a PING query. - # If a server doesn't require it, it will be ignored. - - if (m/^PING (.*)/) {print ClientSocket "PONG $1\n";} - - alarm(0); - - # Look for pattern in IRCD Output to gather Client Connections total. - connection($remotehost,$1,$warn,$crit) if (m/:I have\s+(\d+)/); - } - print "IRCD UNKNOWN: Unknown error - maybe could not authenticate\n"; - exit $ERRORS{"UNKNOWN"}; -} diff --git a/checkers/check_jabber b/checkers/check_jabber deleted file mode 120000 index e838da97eb..0000000000 --- a/checkers/check_jabber +++ /dev/null @@ -1 +0,0 @@ -check_tcp \ No newline at end of file diff --git a/checkers/check_ldap b/checkers/check_ldap deleted file mode 100755 index d7afad1d5b..0000000000 Binary files a/checkers/check_ldap and /dev/null differ diff --git a/checkers/check_ldaps b/checkers/check_ldaps deleted file mode 100755 index d7afad1d5b..0000000000 Binary files a/checkers/check_ldaps and /dev/null differ diff --git a/checkers/check_load b/checkers/check_load deleted file mode 100755 index 4430d49cd5..0000000000 Binary files a/checkers/check_load and /dev/null differ diff --git a/checkers/check_log b/checkers/check_log deleted file mode 100755 index 8f55865af8..0000000000 --- a/checkers/check_log +++ /dev/null @@ -1,217 +0,0 @@ -#! /bin/sh -# -# Log file pattern detector plugin for Nagios -# Written by Ethan Galstad (nagios@nagios.org) -# Last Modified: 07-31-1999 -# -# Usage: ./check_log -# -# Description: -# -# This plugin will scan a log file (specified by the option) -# for a specific pattern (specified by the option). Successive -# calls to the plugin script will only report *new* pattern matches in the -# log file, since an copy of the log file from the previous run is saved -# to . -# -# Output: -# -# On the first run of the plugin, it will return an OK state with a message -# of "Log check data initialized". On successive runs, it will return an OK -# state if *no* pattern matches have been found in the *difference* between the -# log file and the older copy of the log file. If the plugin detects any -# pattern matches in the log diff, it will return a CRITICAL state and print -# out a message is the following format: "(x) last_match", where "x" is the -# total number of pattern matches found in the file and "last_match" is the -# last entry in the log file which matches the pattern. -# -# Notes: -# -# If you use this plugin make sure to keep the following in mind: -# -# 1. The "max_attempts" value for the service should be 1, as this -# will prevent Nagios from retrying the service check (the -# next time the check is run it will not produce the same results). -# -# 2. The "notify_recovery" value for the service should be 0, so that -# Nagios does not notify you of "recoveries" for the check. Since -# pattern matches in the log file will only be reported once and not -# the next time, there will always be "recoveries" for the service, even -# though recoveries really don't apply to this type of check. -# -# 3. You *must* supply a different for each service that -# you define to use this plugin script - even if the different services -# check the same for pattern matches. This is necessary -# because of the way the script operates. -# -# Examples: -# -# Check for login failures in the syslog... -# -# check_log /var/log/messages ./check_log.badlogins.old "LOGIN FAILURE" -# -# Check for port scan alerts generated by Psionic's PortSentry software... -# -# check_log /var/log/message ./check_log.portscan.old "attackalert" -# - -# Paths to commands used in this script. These -# may have to be modified to match your system setup. - -PATH="" - -ECHO="/bin/echo" -GREP="/bin/grep" -DIFF="/usr/bin/diff" -TAIL="/usr/bin/tail" -CAT="/bin/cat" -RM="/bin/rm" - -PROGNAME=`/usr/bin/basename $0` -PROGPATH=`echo $0 | /bin/sed -e 's,[\\/][^\\/][^\\/]*$,,'` -REVISION=`echo '$Revision: 1.4 $' | /bin/sed -e 's/[^0-9.]//g'` - -. $PROGPATH/utils.sh - -print_usage() { - echo "Usage: $PROGNAME -F logfile -O oldlog -q query" - echo "Usage: $PROGNAME --help" - echo "Usage: $PROGNAME --version" -} - -print_help() { - print_revision $PROGNAME $REVISION - echo "" - print_usage - echo "" - echo "Log file pattern detector plugin for Nagios" - echo "" - support -} - -# Make sure the correct number of command line -# arguments have been supplied - -if [ $# -lt 1 ]; then - print_usage - exit $STATE_UNKNOWN -fi - -# Grab the command line arguments - -#logfile=$1 -#oldlog=$2 -#query=$3 -exitstatus=$STATE_WARNING #default -while test -n "$1"; do - case "$1" in - --help) - print_help - exit $STATE_OK - ;; - -h) - print_help - exit $STATE_OK - ;; - --version) - print_revision $PROGNAME $VERSION - exit $STATE_OK - ;; - -V) - print_revision $PROGNAME $VERSION - exit $STATE_OK - ;; - --filename) - logfile=$2 - shift - ;; - -F) - logfile=$2 - shift - ;; - --oldlog) - oldlog=$2 - shift - ;; - -O) - oldlog=$2 - shift - ;; - --query) - query=$2 - shift - ;; - -q) - query=$2 - shift - ;; - -x) - exitstatus=$2 - shift - ;; - --exitstatus) - exitstatus=$2 - shift - ;; - *) - echo "Unknown argument: $1" - print_usage - exit $STATE_UNKNOWN - ;; - esac - shift -done - -# If the source log file doesn't exist, exit - -if [ ! -e $logfile ]; then - $ECHO "Log check error: Log file $logfile does not exist!\n" - exit $STATE_UNKNOWN -elif [ ! -r $logfile ] ; then - $ECHO "Log check error: Log file $logfile is not readable!\n" - exit $STATE_UNKNOWN -fi - -# If the old log file doesn't exist, this must be the first time -# we're running this test, so copy the original log file over to -# the old diff file and exit - -if [ ! -e $oldlog ]; then - $CAT $logfile > $oldlog - $ECHO "Log check data initialized...\n" - exit $STATE_OK -fi - -# The old log file exists, so compare it to the original log now - -# The temporary file that the script should use while -# processing the log file. -if [ -x /bin/mktemp ]; then - tempdiff=`/bin/mktemp /tmp/check_log.XXXXXXXXXX` -else - tempdiff=`/bin/date '+%H%M%S'` - tempdiff="/tmp/check_log.${tempdiff}" - /bin/touch $tempdiff - chmod 600 $tempdiff -fi - -$DIFF $logfile $oldlog > $tempdiff - -# Count the number of matching log entries we have -count=`$GREP -c "$query" $tempdiff` - -# Get the last matching entry in the diff file -lastentry=`$GREP "$query" $tempdiff | $TAIL --lines=1` - -$RM -f $tempdiff -$CAT $logfile > $oldlog - -if [ "$count" = "0" ]; then # no matches, exit with no error - $ECHO "Log check ok - 0 pattern matches found\n" - exitstatus=$STATE_OK -else # Print total matche count and the last entry we found - $ECHO "($count) $lastentry" - exitstatus=$STATE_CRITICAL -fi - -exit $exitstatus diff --git a/checkers/check_mailq b/checkers/check_mailq deleted file mode 100755 index a455665d6a..0000000000 --- a/checkers/check_mailq +++ /dev/null @@ -1,610 +0,0 @@ -#! /usr/bin/perl -w - -# check_mailq - check to see how many messages are in the smtp queue awating -# transmittal. -# -# Initial version support sendmail's mailq command -# Support for mutiple sendmail queues (Carlos Canau) -# Support for qmail (Benjamin Schmid) - -# License Information: -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# $Id: check_mailq.pl,v 1.6 2005/04/14 04:13:13 seanius Exp $ -# -############################################################################ - -use POSIX; -use strict; -use Getopt::Long; -use vars qw($opt_V $opt_h $opt_v $verbose $PROGNAME $opt_w $opt_c $opt_t - $opt_M $mailq $status $state $msg $msg_q $msg_p $opt_W $opt_C $mailq @lines - %srcdomains %dstdomains); -use lib "/usr/lib/nagios/plugins"; -use utils qw(%ERRORS &print_revision &support &usage ); - - -sub print_help (); -sub print_usage (); -sub process_arguments (); - -$ENV{'PATH'}=''; -$ENV{'BASH_ENV'}=''; -$ENV{'ENV'}=''; -$PROGNAME = "check_mailq"; -$mailq = 'sendmail'; # default -$msg_q = 0 ; -$msg_p = 0 ; -$state = $ERRORS{'UNKNOWN'}; - -Getopt::Long::Configure('bundling'); -$status = process_arguments(); -if ($status){ - print "ERROR: processing arguments\n"; - exit $ERRORS{"UNKNOWN"}; -} - -$SIG{'ALRM'} = sub { - print ("ERROR: timed out waiting for $utils::PATH_TO_MAILQ \n"); - exit $ERRORS{"WARNING"}; -}; -alarm($opt_t); - -# switch based on MTA - -if ($mailq eq "sendmail") { - - ## open mailq - if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { - if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { - print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; - exit $ERRORS{'UNKNOWN'}; - } - }elsif( defined $utils::PATH_TO_MAILQ){ - unless (-x $utils::PATH_TO_MAILQ) { - print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($)))\n"; - exit $ERRORS{'UNKNOWN'}; - } - } else { - print "ERROR: \$utils::PATH_TO_MAILQ is not defined\n"; - exit $ERRORS{'UNKNOWN'}; - } -# single queue empty -##/var/spool/mqueue is empty -# single queue: 1 -## /var/spool/mqueue (1 request) -##----Q-ID---- --Size-- -----Q-Time----- ------------Sender/Recipient------------ -##h32E30p01763 2782 Wed Apr 2 15:03 -## 8BITMIME -## - -# multi queue empty -##/var/spool/mqueue/q0/df is empty -##/var/spool/mqueue/q1/df is empty -##/var/spool/mqueue/q2/df is empty -##/var/spool/mqueue/q3/df is empty -##/var/spool/mqueue/q4/df is empty -##/var/spool/mqueue/q5/df is empty -##/var/spool/mqueue/q6/df is empty -##/var/spool/mqueue/q7/df is empty -##/var/spool/mqueue/q8/df is empty -##/var/spool/mqueue/q9/df is empty -##/var/spool/mqueue/qA/df is empty -##/var/spool/mqueue/qB/df is empty -##/var/spool/mqueue/qC/df is empty -##/var/spool/mqueue/qD/df is empty -##/var/spool/mqueue/qE/df is empty -##/var/spool/mqueue/qF/df is empty -## Total Requests: 0 -# multi queue: 1 -##/var/spool/mqueue/q0/df is empty -##/var/spool/mqueue/q1/df is empty -##/var/spool/mqueue/q2/df is empty -## /var/spool/mqueue/q3/df (1 request) -##----Q-ID---- --Size-- -----Q-Time----- ------------Sender/Recipient------------ -##h32De2f23534* 48 Wed Apr 2 14:40 nocol -## nouserATEUnet.pt -## canau -##/var/spool/mqueue/q4/df is empty -##/var/spool/mqueue/q5/df is empty -##/var/spool/mqueue/q6/df is empty -##/var/spool/mqueue/q7/df is empty -##/var/spool/mqueue/q8/df is empty -##/var/spool/mqueue/q9/df is empty -##/var/spool/mqueue/qA/df is empty -##/var/spool/mqueue/qB/df is empty -##/var/spool/mqueue/qC/df is empty -##/var/spool/mqueue/qD/df is empty -##/var/spool/mqueue/qE/df is empty -##/var/spool/mqueue/qF/df is empty -## Total Requests: 1 - - - while () { - - # match email addr on queue listing - if ( (/<.*@.*\.(\w+\.\w+)>/) || (/<.*@(\w+\.\w+)>/) ) { - my $domain = $1; - if (/^\w+/) { - print "$utils::PATH_TO_MAILQ = srcdomain = $domain \n" if $verbose ; - $srcdomains{$domain} ++; - } - next; - } - - # - # ... - # sendmail considers a message with more than one destiny, say N, to the same MX - # to have N messages in queue. - # we will only consider one in this code - if (( /\s\(reply:\sread\serror\sfrom\s.*\.(\w+\.\w+)\.$/ ) || ( /\s\(reply:\sread\serror\sfrom\s(\w+\.\w+)\.$/ ) || - ( /\s\(timeout\swriting\smessage\sto\s.*\.(\w+\.\w+)\.:/ ) || ( /\s\(timeout\swriting\smessage\sto\s(\w+\.\w+)\.:/ ) || - ( /\s\(host\smap:\slookup\s\(.*\.(\w+\.\w+)\):/ ) || ( /\s\(host\smap:\slookup\s\((\w+\.\w+)\):/ ) || - ( /\s\(Deferred:\s.*\s.*\.(\w+\.\w+)\.\)/ ) || ( /\s\(Deferred:\s.*\s(\w+\.\w+)\.\)/ ) ) { - - print "$utils::PATH_TO_MAILQ = dstdomain = $1 \n" if $verbose ; - $dstdomains{$1} ++; - } - - if (/\s+\(I\/O\serror\)/) { - print "$utils::PATH_TO_MAILQ = dstdomain = UNKNOWN \n" if $verbose ; - $dstdomains{'UNKNOWN'} ++; - } - - # Finally look at the overall queue length - # - if (/mqueue/) { - print "$utils::PATH_TO_MAILQ = $_ "if $verbose ; - if (/ \((\d+) request/) { - # - # single queue: first line - # multi queue: one for each queue. overwrite on multi queue below - $msg_q = $1 ; - } - } elsif (/^\s+Total\sRequests:\s(\d+)$/i) { - print "$utils::PATH_TO_MAILQ = $_ \n" if $verbose ; - # - # multi queue: last line - $msg_q = $1 ; - } - - } - - - ## close mailq - - close (MAILQ); - # declare an error if we also get a non-zero return code from mailq - # unless already set to critical - if ( $? ) { - $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ; - print "STDERR $?: $!\n" if $verbose; - $msg = "$state: (stderr)\n"; - } - - ## shut off the alarm - alarm(0); - - - - ## now check the queue length(s) - - if ($msg_q == 0) { - $msg = "OK: mailq is empty"; - $state = $ERRORS{'OK'}; - } else { - print "msg_q = $msg_q warn=$opt_w crit=$opt_c\n" if $verbose; - - # overall queue length - if ($msg_q < $opt_w) { - $msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)"; - $state = $ERRORS{'OK'}; - }elsif ($msg_q >= $opt_w && $msg_q < $opt_c) { - $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)"; - $state = $ERRORS{'WARNING'}; - }else { - $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)"; - $state = $ERRORS{'CRITICAL'}; - } - - # check for domain specific queue lengths if requested - if (defined $opt_W) { - - # Apply threshold to queue lengths FROM domain - my @srckeys = sort { $srcdomains{$b} <=> $srcdomains{$a} } keys %srcdomains; - my $srcmaxkey = $srckeys[0]; - print "src max is $srcmaxkey with $srcdomains{$srcmaxkey} messages\n" if $verbose; - - if ($srcdomains{$srcmaxkey} >= $opt_W && $srcdomains{$srcmaxkey} < $opt_C) { - if ($state == $ERRORS{'OK'}) { - $msg = "WARNING: $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold W = $opt_W)"; - $state = $ERRORS{'WARNING'}; - } elsif (($state == $ERRORS{'WARNING'}) || ($state == $ERRORS{'CRITICAL'})){ - $msg .= " -and- $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold W = $opt_W)"; - } else { - $msg = "WARNING: $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold W = $opt_W)"; - $state = $ERRORS{'WARNING'}; - } - } elsif ($srcdomains{$srcmaxkey} >= $opt_C) { - if ($state == $ERRORS{'OK'}) { - $msg = "CRITICAL: $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold C = $opt_C)"; - $state = $ERRORS{'CRITICAL'}; - } elsif ($state == $ERRORS{'WARNING'}) { - $msg = "CRITICAL: $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold C = $opt_C) -and- " . $msg; - $msg =~ s/WARNING: //; - } elsif ($state == $ERRORS{'CRITICAL'}) { - $msg .= " -and- $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold W = $opt_W)"; - } else { - $msg = "CRITICAL: $srcdomains{$srcmaxkey} messages in queue FROM $srcmaxkey (threshold W = $opt_W)"; - $state = $ERRORS{'CRITICAL'}; - } - } else { - if ($srcdomains{$srcmaxkey} > 0) { - $msg .= " $srcdomains{$srcmaxkey} msgs. FROM $srcmaxkey is below threshold ($opt_W/$opt_C)"; - } - } - - # Apply threshold to queue lengths TO domain - my @dstkeys = sort { $dstdomains{$b} <=> $dstdomains{$a} } keys %dstdomains; - my $dstmaxkey = $dstkeys[0]; - print "dst max is $dstmaxkey with $dstdomains{$dstmaxkey} messages\n" if $verbose; - - if ($dstdomains{$dstmaxkey} >= $opt_W && $dstdomains{$dstmaxkey} < $opt_C) { - if ($state == $ERRORS{'OK'}) { - $msg = "WARNING: $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold W = $opt_W)"; - $state = $ERRORS{'WARNING'}; - } elsif (($state == $ERRORS{'WARNING'}) || ($state == $ERRORS{'CRITICAL'})){ - $msg .= " -and- $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold W = $opt_W)"; - } else { - $msg = "WARNING: $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold W = $opt_W)"; - $state = $ERRORS{'WARNING'}; - } - } elsif ($dstdomains{$dstmaxkey} >= $opt_C) { - if ($state == $ERRORS{'OK'}) { - $msg = "CRITICAL: $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold C = $opt_C)"; - $state = $ERRORS{'CRITICAL'}; - } elsif ($state == $ERRORS{'WARNING'}) { - $msg = "CRITICAL: $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold C = $opt_C) -and- " . $msg; - $msg =~ s/WARNING: //; - } elsif ($state == $ERRORS{'CRITICAL'}) { - $msg .= " -and- $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold W = $opt_W)"; - } else { - $msg = "CRITICAL: $dstdomains{$dstmaxkey} messages in queue TO $dstmaxkey (threshold W = $opt_W)"; - $state = $ERRORS{'CRITICAL'}; - } - } else { - if ($dstdomains{$dstmaxkey} > 0) { - $msg .= " $dstdomains{$dstmaxkey} msgs. TO $dstmaxkey is below threshold ($opt_W/$opt_C)"; - } - } - - } # End of queue length thresholds - - } - -} # end of ($mailq eq "sendmail") -elsif ( $mailq eq "postfix" ) { - - ## open mailq - if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { - if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { - print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; - exit $ERRORS{'UNKNOWN'}; - } - }elsif( defined $utils::PATH_TO_MAILQ){ - unless (-x $utils::PATH_TO_MAILQ) { - print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($)))\n"; - exit $ERRORS{'UNKNOWN'}; - } - } else { - print "ERROR: \$utils::PATH_TO_MAILQ is not defined\n"; - exit $ERRORS{'UNKNOWN'}; - } - - - @lines = reverse ; - - # close qmail-qstat - close MAILQ; - # declare an error if we also get a non-zero return code from mailq - # unless already set to critical - if ( $? ) { - $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ; - print "STDERR $?: $!\n" if $verbose; - $msg = "$state: (stderr)\n"; - } - - ## shut off the alarm - alarm(0); - - # check queue length - if ($lines[0]=~/Kbytes in (\d+)/) { - $msg_q = $1 ; - }elsif ($lines[0]=~/Mail queue is empty/) { - $msg_q = 0; - }else{ - print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n"; - exit $ERRORS{'UNKNOWN'}; - } - - # check messages not processed - #if ($lines[1]=~/^messages in queue but not yet preprocessed: (\d+)/) { - # my $msg_p = $1; - #}else{ - # print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n"; - # exit $ERRORS{'UNKNOWN'}; - #} - - # check queue length(s) - if ($msg_q == 0){ - $msg = "OK: mailq reports queue is empty"; - $state = $ERRORS{'OK'}; - } else { - print "msg_q = $msg_q warn=$opt_w crit=$opt_c\n" if $verbose; - - # overall queue length - if ($msg_q < $opt_w) { - $msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)"; - $state = $ERRORS{'OK'}; - }elsif ($msg_q >= $opt_w && $msg_q < $opt_c) { - $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)"; - $state = $ERRORS{'WARNING'}; - }else { - $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)"; - $state = $ERRORS{'CRITICAL'}; - } - - # check messages not yet preprocessed (only compare is $opt_W and $opt_C - # are defined) - - #if (defined $opt_W) { - # $msg .= "[Preprocessed = $msg_p]"; - # if ($msg_p >= $opt_W && $msg_p < $opt_C ) { - # $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ; - # }elsif ($msg_p >= $opt_C ) { - # $state = $ERRORS{"CRITICAL"} ; - # } - #} - } -} # end of ($mailq eq "postfixl") -elsif ( $mailq eq "qmail" ) { - - # open qmail-qstat - if ( defined $utils::PATH_TO_QMAIL_QSTAT && -x $utils::PATH_TO_QMAIL_QSTAT ) { - if (! open (MAILQ, "$utils::PATH_TO_QMAIL_QSTAT | " ) ) { - print "ERROR: could not open $utils::PATH_TO_QMAIL_QSTAT \n"; - exit $ERRORS{'UNKNOWN'}; - } - }elsif( defined $utils::PATH_TO_QMAIL_QSTAT){ - unless (-x $utils::PATH_TO_QMAIL_QSTAT) { - print "ERROR: $utils::PATH_TO_QMAIL_QSTAT is not executable by (uid $>:gid($)))\n"; - exit $ERRORS{'UNKNOWN'}; - } - } else { - print "ERROR: \$utils::PATH_TO_QMAIL_QSTAT is not defined\n"; - exit $ERRORS{'UNKNOWN'}; - } - - @lines = ; - - # close qmail-qstat - close MAILQ; - # declare an error if we also get a non-zero return code from mailq - # unless already set to critical - if ( $? ) { - $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ; - print "STDERR $?: $!\n" if $verbose; - $msg = "$state: (stderr)\n"; - } - - ## shut off the alarm - alarm(0); - - # check queue length - if ($lines[0]=~/^messages in queue: (\d+)/) { - $msg_q = $1 ; - }else{ - print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n"; - exit $ERRORS{'UNKNOWN'}; - } - - # check messages not processed - if ($lines[1]=~/^messages in queue but not yet preprocessed: (\d+)/) { - my $msg_p = $1; - }else{ - print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n"; - exit $ERRORS{'UNKNOWN'}; - } - - - # check queue length(s) - if ($msg_q == 0){ - $msg = "OK: qmail-qstat reports queue is empty"; - $state = $ERRORS{'OK'}; - } else { - print "msg_q = $msg_q warn=$opt_w crit=$opt_c\n" if $verbose; - - # overall queue length - if ($msg_q < $opt_w) { - $msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)"; - $state = $ERRORS{'OK'}; - }elsif ($msg_q >= $opt_w && $msg_q < $opt_c) { - $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)"; - $state = $ERRORS{'WARNING'}; - }else { - $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)"; - $state = $ERRORS{'CRITICAL'}; - } - - # check messages not yet preprocessed (only compare is $opt_W and $opt_C - # are defined) - - if (defined $opt_W) { - $msg .= "[Preprocessed = $msg_p]"; - if ($msg_p >= $opt_W && $msg_p < $opt_C ) { - $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ; - }elsif ($msg_p >= $opt_C ) { - $state = $ERRORS{"CRITICAL"} ; - } - } - } - - - -} # end of ($mailq eq "qmail") -elsif ( $mailq eq "exim" ) { - ## open mailq - if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { - if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { - print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; - exit $ERRORS{'UNKNOWN'}; - } - }elsif( defined $utils::PATH_TO_MAILQ){ - unless (-x $utils::PATH_TO_MAILQ) { - print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($)))\n"; - exit $ERRORS{'UNKNOWN'}; - } - } else { - print "ERROR: \$utils::PATH_TO_MAILQ is not defined\n"; - exit $ERRORS{'UNKNOWN'}; - } - - while () { - #22m 1.7K 19aEEr-0007hx-Dy <> *** frozen *** - #root@exlixams.glups.fr - - if (/\s[\w\d]{6}-[\w\d]{6}-[\w\d]{2}\s/) { # message id 19aEEr-0007hx-Dy - $msg_q++ ; - } - } - close(MAILQ) ; - if ($msg_q < $opt_w) { - $msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)"; - $state = $ERRORS{'OK'}; - }elsif ($msg_q >= $opt_w && $msg_q < $opt_c) { - $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)"; - $state = $ERRORS{'WARNING'}; - }else { - $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)"; - $state = $ERRORS{'CRITICAL'}; - } -} # end of ($mailq eq "exim") - -# Perfdata support -print "$msg|unsent=$msg_q;$opt_w;$opt_c;0\n"; -exit $state; - - -##################################### -#### subs - - -sub process_arguments(){ - GetOptions - ("V" => \$opt_V, "version" => \$opt_V, - "v" => \$opt_v, "verbose" => \$opt_v, - "h" => \$opt_h, "help" => \$opt_h, - "M:s" => \$opt_M, "mailserver:s" => \$opt_M, # mailserver (default sendmail) - "w=i" => \$opt_w, "warning=i" => \$opt_w, # warning if above this number - "c=i" => \$opt_c, "critical=i" => \$opt_c, # critical if above this number - "t=i" => \$opt_t, "timeout=i" => \$opt_t - ); - - if ($opt_V) { - print_revision($PROGNAME,'$Revision: 1.6 $ '); - exit $ERRORS{'OK'}; - } - - if ($opt_h) { - print_help(); - exit $ERRORS{'OK'}; - } - - if (defined $opt_v ){ - $verbose = $opt_v; - } - - unless (defined $opt_t) { - $opt_t = $utils::TIMEOUT ; # default timeout - } - - unless ( defined $opt_w && defined $opt_c ) { - print_usage(); - exit $ERRORS{'UNKNOWN'}; - } - - if ( $opt_w >= $opt_c) { - print "Warning (-w) cannot be greater than Critical (-c)!\n"; - exit $ERRORS{'UNKNOWN'}; - } - - if (defined $opt_W && ! defined !$opt_C) { - print "Need -C if using -W\n"; - exit $ERRORS{'UNKNOWN'}; - }elsif(defined $opt_W && defined $opt_C) { - if ($opt_W >= $opt_C) { - print "Warning (-W) cannot be greater than Critical (-C)!\n"; - exit $ERRORS{'UNKNOWN'}; - } - } - - if (defined $opt_M) { - if ($opt_M =~ /^(sendmail|qmail|postfix|exim)$/) { - $mailq = $opt_M ; - }elsif( $opt_M eq ''){ - $mailq = 'sendmail'; - }else{ - print "-M: $opt_M is not supported\n"; - exit $ERRORS{'UNKNOWN'}; - } - }else{ - $mailq = 'sendmail' ; - } - - return $ERRORS{'OK'}; -} - -sub print_usage () { - print "Usage: $PROGNAME -w -c [-W ] [-C ] [-M ] [-t ] [-v verbose]\n"; -} - -sub print_help () { - print_revision($PROGNAME,'$Revision: 1.6 $'); - print "Copyright (c) 2002 Subhendu Ghosh/Carlos Canau/Benjamin Schmid\n"; - print "\n"; - print_usage(); - print "\n"; - print " Checks the number of messages in the mail queue (supports multiple sendmail queues, qmail)\n"; - print " Feedback/patches to support non-sendmail mailqueue welcome\n\n"; - print "-w (--warning) = Min. number of messages in queue to generate warning\n"; - print "-c (--critical) = Min. number of messages in queu to generate critical alert ( w < c )\n"; - print "-W (--Warning) = Min. number of messages for same domain in queue to generate warning\n"; - print "-C (--Critical) = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n"; - print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n"; - print "-M (--mailserver) = [ sendmail | qmail | postfix | exim ] (default = sendmail)\n"; - print "-h (--help)\n"; - print "-V (--version)\n"; - print "-v (--verbose) = debugging output\n"; - print "\n\n"; - print "Note: -w and -c are required arguments. -W and -C are optional.\n"; - print " -W and -C are applied to domains listed on the queues - both FROM and TO. (sendmail)\n"; - print " -W and -C are applied message not yet preproccessed. (qmail)\n"; - print " This plugin uses the system mailq command (sendmail) or qmail-stat (qmail)\n"; - print " to look at the queues. Mailq can usually only be accessed by root or \n"; - print " a TrustedUser. You will have to set appropriate permissions for the plugin to work.\n"; - print ""; - print "\n\n"; - support(); -} diff --git a/checkers/check_mrtg b/checkers/check_mrtg deleted file mode 100755 index b5e0198b4d..0000000000 Binary files a/checkers/check_mrtg and /dev/null differ diff --git a/checkers/check_mrtgtraf b/checkers/check_mrtgtraf deleted file mode 100755 index 05670a29b9..0000000000 Binary files a/checkers/check_mrtgtraf and /dev/null differ diff --git a/checkers/check_mysql b/checkers/check_mysql deleted file mode 100755 index 7a15d43772..0000000000 Binary files a/checkers/check_mysql and /dev/null differ diff --git a/checkers/check_nagios b/checkers/check_nagios deleted file mode 100755 index 30b2d0cc28..0000000000 Binary files a/checkers/check_nagios and /dev/null differ diff --git a/checkers/check_nntp b/checkers/check_nntp deleted file mode 120000 index e838da97eb..0000000000 --- a/checkers/check_nntp +++ /dev/null @@ -1 +0,0 @@ -check_tcp \ No newline at end of file diff --git a/checkers/check_nntps b/checkers/check_nntps deleted file mode 120000 index e838da97eb..0000000000 --- a/checkers/check_nntps +++ /dev/null @@ -1 +0,0 @@ -check_tcp \ No newline at end of file diff --git a/checkers/check_nt b/checkers/check_nt deleted file mode 100755 index 907e3e19f1..0000000000 Binary files a/checkers/check_nt and /dev/null differ diff --git a/checkers/check_ntp b/checkers/check_ntp deleted file mode 100755 index f8a503ceaf..0000000000 --- a/checkers/check_ntp +++ /dev/null @@ -1,465 +0,0 @@ -#! /usr/bin/perl -w - -# (c)1999 Ian Cass, Knowledge Matters Ltd. -# Read the GNU copyright stuff for all the legalese -# -# Check NTP time servers plugin. This plugin requires the ntpdate utility to -# be installed on the system, however since it's part of the ntp suite, you -# should already have it installed. -# -# $Id: check_ntp.pl,v 1.29 2005/05/25 14:05:41 sghosh Exp $ -# -# Nothing clever done in this program - its a very simple bare basics hack to -# get the job done. -# -# Things to do... -# check @words[9] for time differences greater than +/- x secs & return a -# warning. -# -# (c) 1999 Mark Jewiss, Knowledge Matters Limited -# 22-9-1999, 12:45 -# -# Modified script to accept 2 parameters or set defaults. -# Now issues warning or critical alert is time difference is greater than the -# time passed. -# -# These changes have not been tested completely due to the unavailability of a -# server with the incorrect time. -# -# (c) 1999 Bo Kersey, VirCIO - Managed Server Solutions -# 22-10-99, 12:17 -# -# Modified the script to give useage if no parameters are input. -# -# Modified the script to check for negative as well as positive -# time differences. -# -# Modified the script to work with ntpdate 3-5.93e Wed Apr 14 20:23:03 EDT 1999 -# -# Modified the script to work with ntpdate's that return adjust or offset... -# -# -# Script modified 2000 June 01 by William Pietri -# -# Modified script to handle weird cases: -# o NTP server doesn't respond (e.g., has died) -# o Server has correct time but isn't suitable synchronization -# source. This happens while starting up and if contact -# with master has been lost. -# -# Modifed to run under Embedded Perl (sghosh@users.sf.net) -# - combined logic some blocks together.. -# -# Added ntpdate check for stratum 16 desynch peer (James Fidell) Feb 03, 2003 -# -# ntpdate - offset is in seconds -# changed ntpdc to ntpq - jitter/dispersion is in milliseconds -# -# Patch for for regex for stratum1 refid. - -require 5.004; -use POSIX; -use strict; -use Getopt::Long; -use vars qw($opt_V $opt_h $opt_H $opt_t $opt_w $opt_c $opt_O $opt_j $opt_k $verbose $PROGNAME $def_jitter $ipv4 $ipv6); -use lib "/usr/lib/nagios/plugins"; -use utils qw($TIMEOUT %ERRORS &print_revision &support); - -$PROGNAME="check_ntp"; - -sub print_help (); -sub print_usage (); - -$ENV{'PATH'}=''; -$ENV{'BASH_ENV'}=''; -$ENV{'ENV'}=''; - -# defaults in sec -my $DEFAULT_OFFSET_WARN = 60; # 1 minute -my $DEFAULT_OFFSET_CRIT = 120; # 2 minutes -# default in millisec -my $DEFAULT_JITTER_WARN = 5000; # 5 sec -my $DEFAULT_JITTER_CRIT = 10000; # 10 sec - -Getopt::Long::Configure('bundling'); -GetOptions - ("V" => \$opt_V, "version" => \$opt_V, - "h" => \$opt_h, "help" => \$opt_h, - "v" => \$verbose, "verbose" => \$verbose, - "4" => \$ipv4, "use-ipv4" => \$ipv4, - "6" => \$ipv6, "use-ipv6" => \$ipv6, - "w=f" => \$opt_w, "warning=f" => \$opt_w, # offset|adjust warning if above this number - "c=f" => \$opt_c, "critical=f" => \$opt_c, # offset|adjust critical if above this number - "O" => \$opt_O, "zero-offset" => \$opt_O, # zero-offset bad - "j=s" => \$opt_j, "jwarn=i" => \$opt_j, # jitter warning if above this number - "k=s" => \$opt_k, "jcrit=i" => \$opt_k, # jitter critical if above this number - "t=s" => \$opt_t, "timeout=i" => \$opt_t, - "H=s" => \$opt_H, "hostname=s" => \$opt_H); - -if ($opt_V) { - print_revision($PROGNAME,'$Revision: 1.29 $ '); - exit $ERRORS{'OK'}; -} - -if ($opt_h) { - print_help(); - exit $ERRORS{'OK'}; -} - -# jitter test params specified -if (defined $opt_j || defined $opt_k ) { - $def_jitter = 1; -} - -$opt_H = shift unless ($opt_H); -my $host = $1 if ($opt_H && $opt_H =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]+(\.[a-zA-Z][-a-zA-Z0-9]+)*)$/); -unless ($host) { - print "No target host specified\n"; - print_usage(); - exit $ERRORS{'UNKNOWN'}; -} - -my ($timeout, $owarn, $ocrit, $jwarn, $jcrit); - -$timeout = $TIMEOUT; -($opt_t) && ($opt_t =~ /^([0-9]+)$/) && ($timeout = $1); - -$owarn = $DEFAULT_OFFSET_WARN; -($opt_w) && ($opt_w =~ /^([0-9.]+)$/) && ($owarn = $1); - -$ocrit = $DEFAULT_OFFSET_CRIT; -($opt_c) && ($opt_c =~ /^([0-9.]+)$/) && ($ocrit = $1); - -$jwarn = $DEFAULT_JITTER_WARN; -($opt_j) && ($opt_j =~ /^([0-9]+)$/) && ($jwarn = $1); - -$jcrit = $DEFAULT_JITTER_CRIT; -($opt_k) && ($opt_k =~ /^([0-9]+)$/) && ($jcrit = $1); - -if ($ocrit < $owarn ) { - print "Critical offset should be larger than warning offset\n"; - print_usage(); - exit $ERRORS{"UNKNOWN"}; -} - -if ($def_jitter) { - if ($opt_k < $opt_j) { - print "Critical jitter should be larger than warning jitter\n"; - print_usage(); - exit $ERRORS{'UNKNOWN'}; - } -} - - -my $stratum = -1; -my $ignoreret = 0; -my $answer = undef; -my $offset = undef; -my $jitter = undef; -my $syspeer = undef; -my $candidate = 0; -my @candidates; -my $msg; # first line of output to print if format is invalid - -my $state = $ERRORS{'UNKNOWN'}; -my $ntpdate_error = $ERRORS{'UNKNOWN'}; -my $jitter_error = $ERRORS{'UNKNOWN'}; - -# some systems don't have a proper ntpq (migrated from ntpdc) -my $have_ntpq = undef; -if ($utils::PATH_TO_NTPQ && -x $utils::PATH_TO_NTPQ ) { - $have_ntpq = 1; -}else{ - $have_ntpq = 0; -} - -# Just in case of problems, let's not hang Nagios -$SIG{'ALRM'} = sub { - print ("ERROR: No response from ntp server (alarm)\n"); - exit $ERRORS{"UNKNOWN"}; -}; -alarm($timeout); - -# Determine protocol to be used for ntpdate and ntpq -my $ntpdate = $utils::PATH_TO_NTPDATE; -my $ntpq = $utils::PATH_TO_NTPQ; -if ($ipv4) { - $ntpdate .= " -4"; - $ntpq .= " -4"; -} -elsif ($ipv6) { - $ntpdate .= " -6"; - $ntpq .= " -6"; -} -# else don't use any flags - -### -### -### First, check ntpdate -### -### - -if (!open (NTPDATE, $ntpdate . " -q $host 2>&1 |")) { - print "Could not open ntpdate\n"; - exit $ERRORS{"UNKNOWN"}; -} - -while () { - #print if ($verbose); # noop - $msg = $_ unless ($msg); - - if (/stratum\s(\d+)/) { - $stratum = $1; - } - - if (/(offset|adjust)\s+([-.\d]+)/i) { - $offset = $2; - - # An offset of 0.000000 with an error is probably bogus. Actually, - # it's probably always bogus, but let's be paranoid here. - # Has been reported that 0.0000 happens in a production environment - # on Solaris 8 so this check should be taken out - SF tracker 1150777 - if (defined $opt_O ) { - if ($offset == 0) { undef $offset;} - } - - $ntpdate_error = defined ($offset) ? $ERRORS{"OK"} : $ERRORS{"CRITICAL"}; - print "ntperr = $ntpdate_error \n" if $verbose; - - } - - if (/no server suitable for synchronization found/) { - if ($stratum == 16) { - $ntpdate_error = $ERRORS{"WARNING"}; - $msg = "Desynchronized peer server found"; - $ignoreret=1; - } - else { - $ntpdate_error = $ERRORS{"CRITICAL"}; - $msg = "No suitable peer server found - "; - } - } - -} - -close (NTPDATE); -# declare an error if we also get a non-zero return code from ntpdate -# unless already set to critical -if ( $? && !$ignoreret ) { - print "stderr = $? : $! \n" if $verbose; - $ntpdate_error = $ntpdate_error == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"UNKNOWN"} ; - print "ntperr = $ntpdate_error : $!\n" if $verbose; -} - -### -### -### Then scan xntpq/ntpq if it exists -### and look in the 11th column for jitter -### -# Field 1: Tally Code ( Space, 'x','.','-','+','#','*','o') -# Only match for '*' which implies sys.peer -# or 'o' which implies pps.peer -# If both exist, the last one is picked. -# Field 2: address of the remote peer -# Field 3: Refid of the clock (0.0.0.0 if unknown, WWWV/PPS/GPS/ACTS/USNO/PCS/... if Stratum1) -# Field 4: stratum (0-15) -# Field 5: Type of the peer: local (l), unicast (u), multicast (m) -# broadcast (b); not sure about multicast/broadcast -# Field 6: last packet receive (in seconds) -# Field 7: polling interval -# Field 8: reachability resgister (octal) -# Field 9: delay -# Field 10: offset -# Field 11: dispersion/jitter -# -# According to bug 773588 Some solaris xntpd implementations seemto match on -# "#" even though the docs say it exceeds maximum distance. Providing patch -# here which will generate a warining. - -if ($have_ntpq) { - - if ( open(NTPQ, $ntpq . " -np $host 2>&1 |") ) { - while () { - print $_ if ($verbose); - if ( /timed out/ ){ - $have_ntpq = 0 ; - last ; - } - # number of candidates on for sys.peer - if (/^(\*|\+|\#|o])/) { - ++$candidate; - push (@candidates, $_); - print "Candidate count= $candidate\n" if ($verbose); - } - - # match sys.peer or pps.peer - if (/^(\*|o)(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/) { - $syspeer = $2; - $stratum = $4; - $jitter = $11; - print "match $_ \n" if $verbose; - if ($jitter > $jcrit) { - print "Jitter_crit = $11 :$jcrit\n" if ($verbose); - $jitter_error = $ERRORS{'CRITICAL'}; - } elsif ($jitter > $jwarn ) { - print "Jitter_warn = $11 :$jwarn\n" if ($verbose); - $jitter_error = $ERRORS{'WARNING'}; - } else { - $jitter_error = $ERRORS{'OK'}; - } - } else { - print "No match!\n" if $verbose; - $jitter = '(not parsed)'; - } - - } - close NTPQ; - - # if we did not match sys.peer or pps.peer but matched # candidates only - # generate a warning - # based on bug id 773588 - unless (defined $syspeer) { - if ($#candidates >=0) { - foreach my $c (@candidates) { - $c =~ /^(#)([-0-9.\s]+)\s+([-0-9A-Za-z_().]+)\s+([-0-9.]+)\s+([lumb-]+)\s+([-0-9m.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/; - $syspeer = $2; - $stratum = $4; - $jitter = $11; - print "candidate match $c \n" if $verbose; - if ($jitter > $jcrit) { - print "Candidate match - Jitter_crit = $11 :$jcrit\n" if ($verbose); - $jitter_error = $ERRORS{'CRITICAL'}; - }elsif ($jitter > $jwarn ) { - print "Candidate match - Jitter_warn = $11 :$jwarn \n" if ($verbose); - $jitter_error = $ERRORS{'WARNING'}; - } else { - $jitter_error = $ERRORS{'WARNING'}; - } - } - - } - } - } -} - - -if ($ntpdate_error != $ERRORS{'OK'}) { - $state = $ntpdate_error; - if ($ntpdate_error == $ERRORS{'WARNING'} ) { - $answer = $msg; - } - else { - $answer = $msg . "Server for ntp probably down"; - } - - if (defined($offset) && abs($offset) > $ocrit) { - $state = $ERRORS{'CRITICAL'}; - $answer = "Server Error and offset $offset sec > +/- $ocrit sec"; - } elsif (defined($offset) && abs($offset) > $owarn) { - $answer = "Server error and offset $offset sec > +/- $owarn sec"; - } elsif (defined($jitter) && abs($jitter) > $jcrit) { - $answer = "Server error and jitter $jitter msec > +/- $jcrit msec"; - } elsif (defined($jitter) && abs($jitter) > $jwarn) { - $answer = "Server error and jitter $jitter msec > +/- $jwarn msec"; - } - -} elsif ($have_ntpq && $jitter_error != $ERRORS{'OK'}) { - $state = $jitter_error; - $answer = "Jitter $jitter too high"; - if (defined($offset) && abs($offset) > $ocrit) { - $state = $ERRORS{'CRITICAL'}; - $answer = "Jitter error and offset $offset sec > +/- $ocrit sec"; - } elsif (defined($offset) && abs($offset) > $owarn) { - $answer = "Jitter error and offset $offset sec > +/- $owarn sec"; - } elsif (defined($jitter) && abs($jitter) > $jcrit) { - $answer = "Jitter error and jitter $jitter msec > +/- $jcrit msec"; - } elsif (defined($jitter) && abs($jitter) > $jwarn) { - $answer = "Jitter error and jitter $jitter msec > +/- $jwarn msec"; - } - -} elsif( !$have_ntpq ) { # no errors from ntpdate and no ntpq or ntpq timed out - if (abs($offset) > $ocrit) { - $state = $ERRORS{'CRITICAL'}; - $answer = "Offset $offset sec > +/- $ocrit sec"; - } elsif (abs($offset) > $owarn) { - $state = $ERRORS{'WARNING'}; - $answer = "Offset $offset sec > +/- $owarn sec"; - } elsif (( abs($offset) > $owarn) && $def_jitter ) { - $state = $ERRORS{'WARNING'}; - $answer = "Offset $offset sec > +/- $owarn sec, ntpq timed out"; - } elsif ( $def_jitter ) { - $state = $ERRORS{'WARNING'}; - $answer = "Offset $offset secs, ntpq timed out"; - } else{ - $state = $ERRORS{'OK'}; - $answer = "Offset $offset secs"; - } - - - -} else { # no errors from ntpdate or ntpq - if (abs($offset) > $ocrit) { - $state = $ERRORS{'CRITICAL'}; - $answer = "Offset $offset sec > +/- $ocrit sec, jitter $jitter msec"; - } elsif (abs($jitter) > $jcrit ) { - $state = $ERRORS{'CRITICAL'}; - $answer = "Jitter $jitter msec> +/- $jcrit msec, offset $offset sec"; - } elsif (abs($offset) > $owarn) { - $state = $ERRORS{'WARNING'}; - $answer = "Offset $offset sec > +/- $owarn sec, jitter $jitter msec"; - } elsif (abs($jitter) > $jwarn ) { - $state = $ERRORS{'WARNING'}; - $answer = "Jitter $jitter msec> +/- $jwarn msec, offset $offset sec"; - - } else { - $state = $ERRORS{'OK'}; - $answer = "Offset $offset secs, jitter $jitter msec, peer is stratum $stratum"; - } - -} - -foreach my $key (keys %ERRORS) { - if ($state==$ERRORS{$key}) { -# print ("NTP $key: $answer"); - print ("NTP $key: $answer|offset=$offset, jitter=" . $jitter/1000 . ",peer_stratum=$stratum\n"); - last; - } -} -exit $state; - - -#### -#### subs - -sub print_usage () { - print "Usage: $PROGNAME -H [-46] [-O] [-w ] [-c ] [-j ] [-k ] [-v verbose]\n"; -} - -sub print_help () { - print_revision($PROGNAME,'$Revision: 1.29 $'); - print "Copyright (c) 2003 Bo Kersey/Karl DeBisschop\n"; - print "\n"; - print_usage(); - print " -Checks the local timestamp offset versus with ntpdate -Checks the jitter/dispersion of clock signal between and its sys.peer with ntpq\n --O (--zero-offset) - A zero offset on \"ntpdate\" will generate a CRITICAL.\n --w (--warning) - Clock offset in seconds at which a warning message will be generated.\n Defaults to $DEFAULT_OFFSET_WARN. --c (--critical) - Clock offset in seconds at which a critical message will be generated.\n Defaults to $DEFAULT_OFFSET_CRIT. --j (--jwarn) - Clock jitter in milliseconds at which a warning message will be generated.\n Defaults to $DEFAULT_JITTER_WARN. --k (--jcrit) - Clock jitter in milliseconds at which a critical message will be generated.\n Defaults to $DEFAULT_JITTER_CRIT. - - If jitter/dispersion is specified with -j or -k and ntpq times out, then a - warning is returned.\n --4 (--use-ipv4) - Use IPv4 connection --6 (--use-ipv6) - Use IPv6 connection -\n"; -support(); -} diff --git a/checkers/check_nwstat b/checkers/check_nwstat deleted file mode 100755 index 3e82019dd7..0000000000 Binary files a/checkers/check_nwstat and /dev/null differ diff --git a/checkers/check_oracle b/checkers/check_oracle deleted file mode 100755 index 5bf9066c78..0000000000 --- a/checkers/check_oracle +++ /dev/null @@ -1,284 +0,0 @@ -#! /bin/sh -# -# latigid010@yahoo.com -# 01/06/2000 -# -# This Nagios plugin was created to check Oracle status -# - -PROGNAME=`basename $0` -PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` -REVISION=`echo '$Revision: 1.14 $' | sed -e 's/[^0-9.]//g'` - -. $PROGPATH/utils.sh - - -print_usage() { - echo "Usage:" - echo " $PROGNAME --tns " - echo " $PROGNAME --db " - echo " $PROGNAME --login " - echo " $PROGNAME --cache " - echo " $PROGNAME --tablespace " - echo " $PROGNAME --oranames " - echo " $PROGNAME --help" - echo " $PROGNAME --version" -} - -print_help() { - print_revision $PROGNAME $REVISION - echo "" - print_usage - echo "" - echo "Check Oracle status" - echo "" - echo "--tns SID/IP Address" - echo " Check remote TNS server" - echo "--db SID" - echo " Check local database (search /bin/ps for PMON process) and check" - echo " filesystem for sgadefORACLE_SID.dbf" - echo "--login SID" - echo " Attempt a dummy login and alert if not ORA-01017: invalid username/password" - echo "--cache" - echo " Check local database for library and buffer cache hit ratios" - echo " ---> Requires Oracle user/password and SID specified." - echo " ---> Requires select on v_$sysstat and v_$librarycache" - echo "--tablespace" - echo " Check local database for tablespace capacity in ORACLE_SID" - echo " ---> Requires Oracle user/password specified." - echo " ---> Requires select on dba_data_files and dba_free_space" - echo "--oranames Hostname" - echo " Check remote Oracle Names server" - echo "--help" - echo " Print this help screen" - echo "--version" - echo " Print version and license information" - echo "" - echo "If the plugin doesn't work, check that the ORACLE_HOME environment" - echo "variable is set, that ORACLE_HOME/bin is in your PATH, and the" - echo "tnsnames.ora file is locatable and is properly configured." - echo "" - echo "When checking local database status your ORACLE_SID is case sensitive." - echo "" - echo "If you want to use a default Oracle home, add in your oratab file:" - echo "*:/opt/app/oracle/product/7.3.4:N" - echo "" - support -} - -case "$1" in -1) - cmd='--tns' - ;; -2) - cmd='--db' - ;; -*) - cmd="$1" - ;; -esac - -# Information options -case "$cmd" in ---help) - print_help - exit $STATE_OK - ;; --h) - print_help - exit $STATE_OK - ;; ---version) - print_revision $PLUGIN $REVISION - exit $STATE_OK - ;; --V) - print_revision $PLUGIN $REVISION - exit $STATE_OK - ;; -esac - -# Hunt down a reasonable ORACLE_HOME -if [ -z "$ORACLE_HOME" ] ; then - # Adjust to taste - for oratab in /var/opt/oracle/oratab /etc/oratab - do - [ ! -f $oratab ] && continue - ORACLE_HOME=`IFS=: - while read SID ORACLE_HOME junk; - do - if [ "$SID" = "$2" -o "$SID" = "*" ] ; then - echo $ORACLE_HOME; - exit; - fi; - done < $oratab` - [ -n "$ORACLE_HOME" ] && break - done -fi -# Last resort -[ -z "$ORACLE_HOME" -a -d $PROGPATH/oracle ] && ORACLE_HOME=$PROGPATH/oracle - -if [ -z "$ORACLE_HOME" -o ! -d "$ORACLE_HOME" ] ; then - echo "Cannot determine ORACLE_HOME for sid $2" - exit $STATE_UNKNOWN -fi -PATH=$PATH:$ORACLE_HOME/bin -LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib -export ORACLE_HOME PATH LD_LIBRARY_PATH - -case "$cmd" in ---tns) - tnschk=` tnsping $2` - tnschk2=` echo $tnschk | grep -c OK` - if [ ${tnschk2} -eq 1 ] ; then - tnschk3=` echo $tnschk | sed -e 's/.*(//' -e 's/).*//'` - echo "OK - reply time ${tnschk3} from $2" - exit $STATE_OK - else - echo "No TNS Listener on $2" - exit $STATE_CRITICAL - fi - ;; ---oranames) - namesctl status $2 | awk ' - /Server has been running for:/ { - msg = "OK: Up" - for (i = 6; i <= NF; i++) { - msg = msg " " $i - } - status = '$STATE_OK' - } - /error/ { - msg = "CRITICAL: " $0 - status = '$STATE_CRITICAL' - } - END { - print msg - exit status - }' - ;; ---db) - pmonchk=`ps -ef | grep -v grep | grep -c "ora_pmon_${2}$"` - if [ ${pmonchk} -ge 1 ] ; then - echo "${2} OK - ${pmonchk} PMON process(es) running" - exit $STATE_OK - #if [ -f $ORACLE_HOME/dbs/sga*${2}* ] ; then - #if [ ${pmonchk} -eq 1 ] ; then - #utime=`ls -la $ORACLE_HOME/dbs/sga*$2* | cut -c 43-55` - #echo "${2} OK - running since ${utime}" - #exit $STATE_OK - #fi - else - echo "${2} Database is DOWN" - exit $STATE_CRITICAL - fi - ;; ---login) - loginchk=`sqlplus dummy/user@$2 < /dev/null` - loginchk2=` echo $loginchk | grep -c ORA-01017` - if [ ${loginchk2} -eq 1 ] ; then - echo "OK - dummy login connected" - exit $STATE_OK - else - loginchk3=` echo "$loginchk" | grep "ORA-" | head -1` - echo "CRITICAL - $loginchk3" - exit $STATE_CRITICAL - fi - ;; ---cache) - if [ ${5} -gt ${6} ] ; then - echo "UNKNOWN - Warning level is less then Crit" - exit $STATE_UNKNOWN - fi - result=`sqlplus -s ${3}/${4}@${2} << EOF -set pagesize 0 -set numf '9999999.99' -select (1-(pr.value/(dbg.value+cg.value)))*100 -from v\\$sysstat pr, v\\$sysstat dbg, v\\$sysstat cg -where pr.name='physical reads' -and dbg.name='db block gets' -and cg.name='consistent gets'; -EOF` - - if [ -n "`echo $result | grep ORA-`" ] ; then - error=` echo "$result" | grep "ORA-" | head -1` - echo "CRITICAL - $error" - exit $STATE_CRITICAL - fi - - buf_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` - buf_hrx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'` - result=`sqlplus -s ${3}/${4}@${2} << EOF -set pagesize 0 -set numf '9999999.99' -select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 -from v\\$librarycache lc; -EOF` - - if [ -n "`echo $result | grep ORA-`" ] ; then - error=` echo "$result" | grep "ORA-" | head -1` - echo "CRITICAL - $error" - exit $STATE_CRITICAL - fi - - lib_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` - lib_hrx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'` - - if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then - echo "${2} CRITICAL - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" - exit $STATE_CRITICAL - fi - if [ $buf_hr -le ${6} -o $lib_hr -le ${6} ] ; then - echo "${2} WARNING - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" - exit $STATE_WARNING - fi - echo "${2} OK - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" - - exit $STATE_OK - ;; ---tablespace) - if [ ${6} -lt ${7} ] ; then - echo "UNKNOWN - Warning level is more then Crit" - exit $STATE_UNKNOWN - fi - result=`sqlplus -s ${3}/${4}@${2} << EOF -set pagesize 0 -set numf '9999999.99' -select b.free,a.total,100 - trunc(b.free/a.total * 1000) / 10 prc -from ( -select tablespace_name,sum(bytes)/1024/1024 total -from dba_data_files group by tablespace_name) A, -( select tablespace_name,sum(bytes)/1024/1024 free -from dba_free_space group by tablespace_name) B -where a.tablespace_name=b.tablespace_name and a.tablespace_name='${5}'; -EOF` - - if [ -n "`echo $result | grep ORA-`" ] ; then - error=` echo "$result" | grep "ORA-" | head -1` - echo "CRITICAL - $error" - exit $STATE_CRITICAL - fi - - ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}'` - ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}'` - ts_pct=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'` - ts_pctx=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print $3}'` - if [ "$ts_free" -eq 0 -a "$ts_total" -eq 0 -a "$ts_pct" -eq 0 ] ; then - echo "No data returned by Oracle - tablespace $5 not found?" - exit $STATE_UNKNOWN - fi - if [ "$ts_pct" -ge ${6} ] ; then - echo "${2} : ${5} CRITICAL - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" - exit $STATE_CRITICAL - fi - if [ "$ts_pct" -ge ${7} ] ; then - echo "${2} : ${5} WARNING - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" - exit $STATE_WARNING - fi - echo "${2} : ${5} OK - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" - exit $STATE_OK - ;; -*) - print_usage - exit $STATE_UNKNOWN -esac diff --git a/checkers/check_overcr b/checkers/check_overcr deleted file mode 100755 index 8850dbee33..0000000000 Binary files a/checkers/check_overcr and /dev/null differ diff --git a/checkers/check_pgsql b/checkers/check_pgsql deleted file mode 100755 index 1847203517..0000000000 Binary files a/checkers/check_pgsql and /dev/null differ diff --git a/checkers/check_ping b/checkers/check_ping deleted file mode 100755 index 59ee1f0d6c..0000000000 Binary files a/checkers/check_ping and /dev/null differ diff --git a/checkers/check_pop b/checkers/check_pop deleted file mode 120000 index e838da97eb..0000000000 --- a/checkers/check_pop +++ /dev/null @@ -1 +0,0 @@ -check_tcp \ No newline at end of file diff --git a/checkers/check_procs b/checkers/check_procs deleted file mode 100755 index 73df901cb8..0000000000 Binary files a/checkers/check_procs and /dev/null differ diff --git a/checkers/check_radius b/checkers/check_radius deleted file mode 100755 index f07273eacf..0000000000 Binary files a/checkers/check_radius and /dev/null differ diff --git a/checkers/check_real b/checkers/check_real deleted file mode 100755 index 8e1e98f521..0000000000 Binary files a/checkers/check_real and /dev/null differ diff --git a/checkers/check_rpc b/checkers/check_rpc deleted file mode 100755 index cf3eb87e86..0000000000 --- a/checkers/check_rpc +++ /dev/null @@ -1,377 +0,0 @@ -#! /usr/bin/perl -w -# -# check_rpc plugin for nagios -# -# usage: -# check_rpc host service -# -# Check if an rpc serice is registered and running -# using rpcinfo - $proto $host $prognum 2>&1 |"; -# -# Use these hosts.cfg entries as examples -# -# command[check_nfs]=/some/path/libexec/check_rpc $HOSTADDRESS$ nfs -# service[check_nfs]=NFS;24x7;3;5;5;unix-admin;60;24x7;1;1;1;;check_rpc -# -# initial version: 3 May 2000 by Truongchinh Nguyen and Karl DeBisschop -# Modified May 2002 Subhendu Ghosh - support for ePN and patches -# current status: $Revision: 1.8 $ -# -# Copyright Notice: GPL -# $Id: check_rpc.pl,v 1.8 2003/08/10 12:11:49 kdebisschop Exp $ -# - -use strict; -use lib "/usr/lib/nagios/plugins"; -use utils qw($TIMEOUT %ERRORS &print_revision &support); -use vars qw($PROGNAME); -my ($verbose,@proto,%prognum,$host,$response,$prognum,$port,$cmd,$progver,$state); -my ($array_ref,$test,$element,@progkeys,$proto,$a,$b); -my ($opt_V,$opt_h,$opt_C,$opt_p,$opt_H,$opt_c,$opt_u,$opt_t); -my ($line, @progvers, $response2,$response3); -$opt_V = $opt_h = $opt_C = $opt_p = $opt_H = $opt_u = $opt_t =''; -$state = 'UNKNOWN'; -$progver = $response=$response2= $response3 =''; - -$PROGNAME = "check_rpc"; -sub print_help (); -sub print_usage (); -sub in ($$); - -$ENV{'BASH_ENV'}=''; -$ENV{'ENV'}=''; -$ENV{'PATH'}=''; -$ENV{'LC_ALL'}='C'; - -#Initialise protocol for each progname number -# 'u' for UDP, 't' for TCP -$proto[10003]='u'; -$proto[10004]='u'; -$proto[10007]='u'; - -use Getopt::Long; -Getopt::Long::Configure('bundling'); -GetOptions( - "V" => \$opt_V, "version" => \$opt_V, - "h" => \$opt_h, "help" => \$opt_h, - "C=s" => \$opt_C, "command=s" => \$opt_C, - "p=i" => \$opt_p, "port=i" => \$opt_p, - "H=s" => \$opt_H, "hostname=s" => \$opt_H, - "c=s" => \$opt_c, "progver=s" => \$opt_c, - "v+" => \$verbose, "verbose+" => \$verbose, - "u" => \$opt_u, "udp" => \$opt_u, - "t" => \$opt_t, "tcp" => \$opt_t -); - -# -h means display verbose help screen -if ($opt_h) { print_help(); exit $ERRORS{'OK'}; } - -# -V means display version number -if ($opt_V) { - print_revision($PROGNAME,'$Revision: 1.8 $ '); - exit $ERRORS{'OK'}; -} - -# Hash containing all RPC program names and numbers -# Add to the hash if support for new RPC program is required - -%prognum = ( - "portmapper" => 100000 , - "portmap" => 100000 , - "sunrpc" => 100000 , - "rpcbind" => 100000 , - "rstatd" => 100001 , - "rstat" => 100001 , - "rup" => 100001 , - "perfmeter" => 100001 , - "rstat_svc" => 100001 , - "rusersd" => 100002 , - "rusers" => 100002 , - "nfs" => 100003 , - "nfsprog" => 100003 , - "ypserv" => 100004 , - "ypprog" => 100004 , - "mountd" => 100005 , - "mount" => 100005 , - "showmount" => 100005 , - "ypbind" => 100007 , - "walld" => 100008 , - "rwall" => 100008 , - "shutdown" => 100008 , - "yppasswdd" => 100009 , - "yppasswd" => 100009 , - "etherstatd" => 100010 , - "etherstat" => 100010 , - "rquotad" => 100011 , - "rquotaprog" => 100011 , - "quota" => 100011 , - "rquota" => 100011 , - "sprayd" => 100012 , - "spray" => 100012 , - "3270_mapper" => 100013 , - "rje_mapper" => 100014 , - "selection_svc" => 100015 , - "selnsvc" => 100015 , - "database_svc" => 100016 , - "rexd" => 100017 , - "rex" => 100017 , - "alis" => 100018 , - "sched" => 100019 , - "llockmgr" => 100020 , - "nlockmgr" => 100021 , - "x25_inr" => 100022 , - "statmon" => 100023 , - "status" => 100024 , - "bootparam" => 100026 , - "ypupdated" => 100028 , - "ypupdate" => 100028 , - "keyserv" => 100029 , - "keyserver" => 100029 , - "sunlink_mapper" => 100033 , - "tfsd" => 100037 , - "nsed" => 100038 , - "nsemntd" => 100039 , - "showfhd" => 100043 , - "showfh" => 100043 , - "ioadmd" => 100055 , - "rpc.ioadmd" => 100055 , - "NETlicense" => 100062 , - "sunisamd" => 100065 , - "debug_svc" => 100066 , - "dbsrv" => 100066 , - "ypxfrd" => 100069 , - "rpc.ypxfrd" => 100069 , - "bugtraqd" => 100071 , - "kerbd" => 100078 , - "event" => 100101 , - "na.event" => 100101 , - "logger" => 100102 , - "na.logger" => 100102 , - "sync" => 100104 , - "na.sync" => 100104 , - "hostperf" => 100107 , - "na.hostperf" => 100107 , - "activity" => 100109 , - "na.activity" => 100109 , - "hostmem" => 100112 , - "na.hostmem" => 100112 , - "sample" => 100113 , - "na.sample" => 100113 , - "x25" => 100114 , - "na.x25" => 100114 , - "ping" => 100115 , - "na.ping" => 100115 , - "rpcnfs" => 100116 , - "na.rpcnfs" => 100116 , - "hostif" => 100117 , - "na.hostif" => 100117 , - "etherif" => 100118 , - "na.etherif" => 100118 , - "iproutes" => 100120 , - "na.iproutes" => 100120 , - "layers" => 100121 , - "na.layers" => 100121 , - "snmp" => 100122 , - "na.snmp" => 100122 , - "snmp-cmc" => 100122 , - "snmp-synoptics" => 100122 , - "snmp-unisys" => 100122 , - "snmp-utk" => 100122 , - "traffic" => 100123 , - "na.traffic" => 100123 , - "nfs_acl" => 100227 , - "sadmind" => 100232 , - "nisd" => 100300 , - "rpc.nisd" => 100300 , - "nispasswd" => 100303 , - "rpc.nispasswdd" => 100303 , - "ufsd" => 100233 , - "ufsd" => 100233 , - "pcnfsd" => 150001 , - "pcnfs" => 150001 , - "amd" => 300019 , - "amq" => 300019 , - "bwnfsd" => 545580417 , - "fypxfrd" => 600100069 , - "freebsd-ypxfrd" => 600100069 , -); - -# -v means verbose, -v-v means verbose twice = print above hash -if (defined $verbose && ($verbose > 1) ){ - my $key; - print "Supported programs:\n"; - print " name\t=>\tnumber\n"; - print " ===============================\n"; - foreach $key (sort keys %prognum) { - print " $key \t=>\t$prognum{$key} \n"; - } - print "\n\n"; - print_usage(); - exit $ERRORS{'OK'}; -} - -# -H means host name -unless ($opt_H) { print_usage(); exit $ERRORS{'UNKNOWN'}; } - -if (! utils::is_hostname($opt_H)){ - print "$opt_H is not a valid host name\n"; - print_usage(); - exit $ERRORS{"UNKNOWN"}; -}else{ - $host = $opt_H; -} - -if ($opt_t && $opt_u) { - print "Cannot define tcp AND udp\n"; - print_usage(); - exit $ERRORS{'UNKNOWN'}; -} - - -# -C means command name or number -$opt_C = shift unless ($opt_C); -unless ($opt_C) { print_usage(); exit -1; } -@progkeys = keys %prognum; -if ($opt_C =~ m/^([0-9]+)$/){ -# $response = "RPC ok: program $opt_C (version "; - $prognum = $1; -} elsif ( in( \@progkeys, $opt_C)) { -# $response = "RPC ok: $opt_C (version "; - $prognum = $prognum{$opt_C}; -} else { - print "Program $opt_C is not defined\n"; - exit $ERRORS{'UNKNOWN'}; -} - -# -p means port number -if($opt_p =~ /^([0-9]+)$/){ - $port = "-n $1"; -} else { - $port = ""; -} - -$proto = 'u'; -$proto = $proto[$prognum] if ($proto[$prognum]); -$proto = 't' if ($opt_t); -$proto = 'u' if ($opt_u); - - -# Just in case of problems, let's not hang Nagios -$SIG{'ALRM'} = sub { - print ("ERROR: No response from RPC server (alarm)\n"); - exit $ERRORS{"UNKNOWN"}; -}; -alarm($TIMEOUT); - -# -c is progver - if we need to check multiple specified versions. -if (defined $opt_c ) { - my $vers; - @progvers = split(/,/ ,$opt_c ); - foreach $vers (sort @progvers) { - if($vers =~ /^([0-9]+)$/){ - $progver = "$1"; - print "Checking $opt_C version $progver proto $proto\n" if $verbose; - get_rpcinfo(); - }else{ - print "Version $vers is not an integer\n" if $verbose; - } - - } -}else{ - get_rpcinfo(); -} - - -## translate proto for output -if ($proto eq "u" ){ - $proto = "udp"; -}else{ - $proto = "tcp"; -} - -if ($state eq 'OK') { - print "$state: RPC program $opt_C".$response." $proto running\n"; -}else{ - if($response){ - print "$state: RPC program $opt_C".$response2." $proto is not running,".$response." $proto is running\n"; - }else{ - print "$state: RPC program $opt_C $response2 $proto is not running\n"; - } -} -exit $ERRORS{$state}; - - -######## Subroutines ========================== - -sub get_rpcinfo { - $cmd = "$utils::PATH_TO_RPCINFO $port -" . "$proto $host $prognum $progver 2>&1 |"; - print "$cmd\n" if ($verbose); - open CMD, $cmd or die "Can't fork for rpcinfo: $!\n" ; - - while ( $line = ) { - printf "$line " if $verbose; - chomp $line; - - if ( $line =~ /program $prognum version ([0-9]*) ready and waiting/ ) { - $response .= " version $1"; - $state = 'OK' unless $state ne 'UNKNOWN'; - print "1:$response \n" if $verbose; - } - - if ( $line =~ /program $prognum version ([0-9]*) is not available/ ) { - $response2 .= " version $1"; - $state = 'CRITICAL'; - print "2:$response2 \n" if $verbose; - } - if ( $line =~ /program $prognum is not available/ ) { - $response3 = ""; - $response3 = "tcp" if $opt_t; - $response3 = "udp" if $opt_u; - $state = 'CRITICAL'; - print "3:$response3 \n" if $verbose; - } - } - close CMD; -} - - -sub print_help() { - print_revision($PROGNAME,'$Revision: 1.8 $ '); - print "Copyright (c) 2002 Karl DeBisschop/Truongchinh Nguyen/Subhendu Ghosh\n"; - print "\n"; - print "Check if a rpc service is registered and running using\n"; - print " rpcinfo -H host -C rpc_command \n"; - print "\n"; - print_usage(); - print "\n"; - print " The server providing the rpc service\n"; - print " The program name (or number).\n"; - print " The version you want to check for (one or more)\n"; - print " Should prevent checks of unknown versions being syslogged\n"; - print " e.g. 2,3,6 to check v2, v3, and v6\n"; - print " [-u | -t] Test UDP or TCP\n"; - print " [-v] Verbose \n"; - print " [-v -v] Verbose - will print supported programs and numbers \n"; - print "\n"; - support(); -} - -sub print_usage () { - print "Usage: \n"; - print " $PROGNAME -H host -C rpc_command [-p port] [-c program_version] [-u|-t] [-v]\n"; - print " $PROGNAME [-h | --help]\n"; - print " $PROGNAME [-V | --version]\n"; -} - -sub in ($$) { - $array_ref = shift; - $test = shift; - - while ( $element = shift @{$array_ref} ) { - if ($test eq $element) { - return 1; - } - } - return 0; -} - diff --git a/checkers/check_sensors b/checkers/check_sensors deleted file mode 100755 index 66d264ad9b..0000000000 --- a/checkers/check_sensors +++ /dev/null @@ -1,65 +0,0 @@ -#! /bin/sh - -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin - -PROGNAME=`basename $0` -PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` -REVISION=`echo '$Revision: 1.2 $' | sed -e 's/[^0-9.]//g'` - -. $PROGPATH/utils.sh - - -print_usage() { - echo "Usage: $PROGNAME" -} - -print_help() { - print_revision $PROGNAME $REVISION - echo "" - print_usage - echo "" - echo "This plugin checks hardware status using the lm_sensors package." - echo "" - support - exit 0 -} - -case "$1" in - --help) - print_help - exit 0 - ;; - -h) - print_help - exit 0 - ;; - --version) - print_revision $PROGNAME $REVISION - exit 0 - ;; - -V) - print_revision $PROGNAME $REVISION - exit 0 - ;; - *) - sensordata=`sensors 2>&1` - status=$? - if test "$1" = "-v" -o "$1" = "--verbose"; then - echo ${sensordata} - fi - if test ${status} -eq 127; then - echo "SENSORS UNKNOWN - command not found (did you install lmsensors?)" - exit -1 - elif test ${status} -ne 0 ; then - echo "WARNING - sensors returned state $status" - exit 1 - fi - if echo ${sensordata} | egrep ALARM > /dev/null; then - echo SENSOR CRITICAL - Sensor alarm detected! - exit 2 - else - echo sensor ok - exit 0 - fi - ;; -esac diff --git a/checkers/check_simap b/checkers/check_simap deleted file mode 120000 index e838da97eb..0000000000 --- a/checkers/check_simap +++ /dev/null @@ -1 +0,0 @@ -check_tcp \ No newline at end of file diff --git a/checkers/check_smtp b/checkers/check_smtp deleted file mode 100755 index 3c24434b34..0000000000 Binary files a/checkers/check_smtp and /dev/null differ diff --git a/checkers/check_snmp b/checkers/check_snmp deleted file mode 100755 index 9d20a25769..0000000000 Binary files a/checkers/check_snmp and /dev/null differ diff --git a/checkers/check_spop b/checkers/check_spop deleted file mode 120000 index e838da97eb..0000000000 --- a/checkers/check_spop +++ /dev/null @@ -1 +0,0 @@ -check_tcp \ No newline at end of file diff --git a/checkers/check_ssh b/checkers/check_ssh deleted file mode 100755 index dcdc18e3d6..0000000000 Binary files a/checkers/check_ssh and /dev/null differ diff --git a/checkers/check_ssmtp b/checkers/check_ssmtp deleted file mode 120000 index e838da97eb..0000000000 --- a/checkers/check_ssmtp +++ /dev/null @@ -1 +0,0 @@ -check_tcp \ No newline at end of file diff --git a/checkers/check_swap b/checkers/check_swap deleted file mode 100755 index 765e17aac6..0000000000 Binary files a/checkers/check_swap and /dev/null differ diff --git a/checkers/check_tcp b/checkers/check_tcp deleted file mode 100755 index c334ed1df3..0000000000 Binary files a/checkers/check_tcp and /dev/null differ diff --git a/checkers/check_time b/checkers/check_time deleted file mode 100755 index 976f730c23..0000000000 Binary files a/checkers/check_time and /dev/null differ diff --git a/checkers/check_udp b/checkers/check_udp deleted file mode 100755 index d9a4d22345..0000000000 Binary files a/checkers/check_udp and /dev/null differ diff --git a/checkers/check_udp2 b/checkers/check_udp2 deleted file mode 120000 index e838da97eb..0000000000 --- a/checkers/check_udp2 +++ /dev/null @@ -1 +0,0 @@ -check_tcp \ No newline at end of file diff --git a/checkers/check_ups b/checkers/check_ups deleted file mode 100755 index 4f64f99bed..0000000000 Binary files a/checkers/check_ups and /dev/null differ diff --git a/checkers/check_users b/checkers/check_users deleted file mode 100755 index 7795f20293..0000000000 Binary files a/checkers/check_users and /dev/null differ diff --git a/checkers/check_wave b/checkers/check_wave deleted file mode 100755 index 0f03c48850..0000000000 --- a/checkers/check_wave +++ /dev/null @@ -1,123 +0,0 @@ -#! /usr/bin/perl -wT -# -# $Id: check_wave.pl,v 1.4 2002/10/28 13:05:08 kdebisschop Exp $ - - -use strict; -use lib "/usr/lib/nagios/plugins"; -use utils qw($TIMEOUT %ERRORS &print_revision &support); -use vars qw($PROGNAME); -use Getopt::Long; -use vars qw($opt_V $opt_h $verbose $opt_w $opt_c $opt_H); -my (@test, $low1, $med1, $high1, $snr, $low2, $med2, $high2); -my ($low, $med, $high, $lowavg, $medavg, $highavg, $tot, $ss); - -$PROGNAME = "check_wave"; -sub print_help (); -sub print_usage (); - -$ENV{'PATH'}=''; -$ENV{'BASH_ENV'}=''; -$ENV{'ENV'}=''; - -Getopt::Long::Configure('bundling'); -GetOptions - ("V" => \$opt_V, "version" => \$opt_V, - "h" => \$opt_h, "help" => \$opt_h, - "v" => \$verbose, "verbose" => \$verbose, - "w=s" => \$opt_w, "warning=s" => \$opt_w, - "c=s" => \$opt_c, "critical=s" => \$opt_c, - "H=s" => \$opt_H, "hostname=s" => \$opt_H); - -if ($opt_V) { - print_revision($PROGNAME,'$Revision: 1.4 $'); #' - exit $ERRORS{'OK'}; -} - -if ($opt_h) { - print_help(); - exit $ERRORS{'OK'}; -} - -$opt_H = shift unless ($opt_H); -print_usage() unless ($opt_H); -my $host = $1 if ($opt_H =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0]+(\.[a-zA-Z][-a-zA-Z0]+)*)$/); -print_usage() unless ($host); - -($opt_c) || ($opt_c = shift) || ($opt_c = 120); -my $critical = $1 if ($opt_c =~ /([0-9]+)/); - -($opt_w) || ($opt_w = shift) || ($opt_w = 60); -my $warning = $1 if ($opt_w =~ /([0-9]+)/); - -$low1 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.8.1`; -@test = split(/ /,$low1); -$low1 = $test[2]; - -$med1 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.9.1`; -@test = split(/ /,$med1); -$med1 = $test[2]; - -$high1 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.10.1`; -@test = split(/ /,$high1); -$high1 = $test[2]; - -sleep(2); - -$snr = `snmpget $host public .1.3.6.1.4.1.762.2.5.2.1.17.1`; -@test = split(/ /,$snr); -$snr = $test[2]; -$snr = int($snr*25); - -$low2 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.8.1`; -@test = split(/ /,$low2); -$low2 = $test[2]; - -$med2 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.9.1`; -@test = split(/ /,$med2); -$med2 = $test[2]; - -$high2 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.10.1`; -@test = split(/ /,$high2); -$high2 = $test[2]; - -$low = $low2 - $low1; -$med = $med2 - $med1; -$high = $high2 - $high1; - -$tot = $low + $med + $high; - -if ($tot==0) { - $ss = 0; -} else { - $lowavg = $low / $tot; - $medavg = $med / $tot; - $highavg = $high / $tot; - $ss = ($medavg*50) + ($highavg*100); -} - -printf("Signal Strength at: %3.0f%, SNR at $snr%",$ss); - -if ($ss<$critical) { - exit(2); -} elsif ($ss<$warning) { - exit(1); -} else { - exit(0); -} - - -sub print_usage () { - print "Usage: $PROGNAME -H [-w ] [-c ]\n"; -} - -sub print_help () { - print_revision($PROGNAME,'$Revision: 1.4 $'); - print "Copyright (c) 2000 Jeffery Blank/Karl DeBisschop\n"; - print "\n"; - print_usage(); - print "\n"; - print " = Signal strength at which a warning message will be generated.\n"; - print " = Signal strength at which a critical message will be generated.\n\n"; - support(); -} diff --git a/checkers/negate b/checkers/negate deleted file mode 100755 index d81c478767..0000000000 Binary files a/checkers/negate and /dev/null differ diff --git a/checkers/urlize b/checkers/urlize deleted file mode 100755 index df17d2a526..0000000000 Binary files a/checkers/urlize and /dev/null differ diff --git a/checkers/utils.pm b/checkers/utils.pm deleted file mode 100644 index 0556ec49bd..0000000000 --- a/checkers/utils.pm +++ /dev/null @@ -1,83 +0,0 @@ -# Utility drawer for Nagios plugins. -# $Id: utils.pm.in,v 1.7 2003/04/13 04:25:36 sghosh Exp $ -# -# $Log: utils.pm.in,v $ -# Revision 1.7 2003/04/13 04:25:36 sghosh -# update for check_mailq - qmail support -# -# Revision 1.6 2003/02/03 20:29:55 sghosh -# change ntpdc to ntpq (Jonathan Rozes,Thomas Schimpke, bug-656237 ) -# -# Revision 1.5 2002/10/30 05:07:29 sghosh -# monitor mailq -# -# Revision 1.4 2002/05/27 02:01:09 sghosh -# new var - smbclient -# -# Revision 1.3 2002/05/10 03:49:22 sghosh -# added programs to autoconf -# -# Revision 1.2 2002/05/08 05:10:35 sghosh -# is_hostname added, update CODES to POSIX -# -# -package utils; - -require Exporter; -@ISA = qw(Exporter); -@EXPORT_OK = qw($TIMEOUT %ERRORS &print_revision &support &usage); - -#use strict; -#use vars($TIMEOUT %ERRORS); -sub print_revision ($$); -sub usage; -sub support(); -sub is_hostname; - -## updated by autoconf -$PATH_TO_RPCINFO = "/usr/bin/rpcinfo"; -$PATH_TO_NTPDATE = "/usr/sbin/ntpdate"; -$PATH_TO_NTPDC = "/usr/bin/ntpdc"; -$PATH_TO_NTPQ = "/usr/bin/ntpq"; -$PATH_TO_LMSTAT = "" ; -$PATH_TO_SMBCLIENT = "/usr/bin/smbclient"; -$PATH_TO_MAILQ = "/usr/bin/mailq"; -$PATH_TO_QMAIL_QSTAT = ""; - -## common variables -$TIMEOUT = 15; -%ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); - -## utility subroutines -sub print_revision ($$) { - my $commandName = shift; - my $pluginRevision = shift; - $pluginRevision =~ s/^\$Revision: //; - $pluginRevision =~ s/ \$\s*$//; - print "$commandName (nagios-plugins 1.4.2) $pluginRevision\n"; - print "The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugins under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n"; -} - -sub support () { - my $support='Send email to nagios-users@lists.sourceforge.net if you have questions\nregarding use of this software. To submit patches or suggest improvements,\nsend email to nagiosplug-devel@lists.sourceforge.net.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n'; - $support =~ s/@/\@/g; - $support =~ s/\\n/\n/g; - print $support; -} - -sub usage { - my $format=shift; - printf($format,@_); - exit $ERRORS{'UNKNOWN'}; -} - -sub is_hostname { - my $host1 = shift; - if ($host1 && $host1 =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]+(\.[a-zA-Z][-a-zA-Z0-9]+)*)$/) { - return 1; - }else{ - return 0; - } -} - -1; diff --git a/checkers/utils.sh b/checkers/utils.sh deleted file mode 100755 index 313b61816c..0000000000 --- a/checkers/utils.sh +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh - -STATE_OK=0 -STATE_WARNING=1 -STATE_CRITICAL=2 -STATE_UNKNOWN=3 -STATE_DEPENDENT=4 - -if test -x /usr/bin/printf; then - ECHO=/usr/bin/printf -else - ECHO=echo -fi - -print_revision() { - echo "$1 (nagios-plugins 1.4.2) $2" - $ECHO "The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugins under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n" | /bin/sed -e 's/\n/ /g' -} - -support() { - $ECHO "Send email to nagios-users@lists.sourceforge.net if you have questions\nregarding use of this software. To submit patches or suggest improvements,\nsend email to nagiosplug-devel@lists.sourceforge.net.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n" | /bin/sed -e 's/\n/ /g' -} - diff --git a/html/pages/default.php b/html/pages/default.php index 25ac60ca4a..4d2b34fc8e 100644 --- a/html/pages/default.php +++ b/html/pages/default.php @@ -79,7 +79,7 @@ while($device = mysql_fetch_array($sql)){ generate_front_box("info", "
".generatedevicelink($device, shorthost($device['hostname']))."
Device
Rebooted

- ".formatUptime($device['attrib_value'])." + ".formatUptime($device['attrib_value'], 'short')."
"); } diff --git a/html/pages/delhost.php b/html/pages/delhost.php index 3a29202c2e..726536c16e 100644 --- a/html/pages/delhost.php +++ b/html/pages/delhost.php @@ -7,6 +7,8 @@ if($_SESSION['userlevel'] < 10) { if($_POST['id']) { delHost($_POST['id']); +} elseif ($_GET['id']) { + delHost($_GET['id']); } ?> diff --git a/html/pages/device/dev-edit.inc b/html/pages/device/dev-edit.inc index e0ffe054c0..5c8eb82a06 100644 --- a/html/pages/device/dev-edit.inc +++ b/html/pages/device/dev-edit.inc @@ -29,6 +29,13 @@ echo("

Edit Device

+
+ + + Delete + +
+
@@ -66,7 +73,9 @@ echo(" - + + +
"); echo("
"); diff --git a/includes/services/dns/check.inc b/includes/services/dns/check.inc index 04663fafec..5758f70507 100644 --- a/includes/services/dns/check.inc +++ b/includes/services/dns/check.inc @@ -1,6 +1,6 @@ $cur_major) { echo("New major release : $major.$minor.$release"); } elseif ($minor > $cur_minor) {