New upstream version 2.3.4
This commit is contained in:
		
							parent
							
								
									7c86d65dc2
								
							
						
					
					
						commit
						30f882762f
					
				
					 556 changed files with 90432 additions and 53391 deletions
				
			
		| 
						 | 
				
			
			@ -16,13 +16,13 @@ VPATH=$(top_srcdir) $(top_srcdir)/plugins-scripts $(top_srcdir)/plugins-scripts/
 | 
			
		|||
libexec_SCRIPTS = check_breeze check_disk_smb check_flexlm check_ircd \
 | 
			
		||||
	check_log check_oracle check_rpc check_sensors check_wave \
 | 
			
		||||
	check_ifstatus check_ifoperstatus check_mailq check_file_age \
 | 
			
		||||
	check_uptime \
 | 
			
		||||
	check_uptime check_mssql \
 | 
			
		||||
	utils.sh utils.pm
 | 
			
		||||
 | 
			
		||||
EXTRA_DIST=check_breeze.pl check_disk_smb.pl check_flexlm.pl check_ircd.pl \
 | 
			
		||||
	check_log.sh check_oracle.sh check_rpc.pl check_sensors.sh \
 | 
			
		||||
	check_ifstatus.pl check_ifoperstatus.pl check_wave.pl check_mailq.pl check_file_age.pl \
 | 
			
		||||
	check_uptime.pl \
 | 
			
		||||
	check_uptime.pl check_mssql.pl \
 | 
			
		||||
	utils.sh.in utils.pm.in t
 | 
			
		||||
 | 
			
		||||
EDIT = sed \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -14,8 +14,9 @@ sub print_help ();
 | 
			
		|||
sub print_usage ();
 | 
			
		||||
 | 
			
		||||
$ENV{'PATH'}='@TRUSTED_PATH@';
 | 
			
		||||
$ENV{'BASH_ENV'}=''; 
 | 
			
		||||
$ENV{'BASH_ENV'}='';
 | 
			
		||||
$ENV{'ENV'}='';
 | 
			
		||||
$ENV{'CDPATH'}='';
 | 
			
		||||
 | 
			
		||||
Getopt::Long::Configure('bundling');
 | 
			
		||||
GetOptions
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,7 +28,7 @@ use FindBin;
 | 
			
		|||
use lib "$FindBin::Bin";
 | 
			
		||||
use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
 | 
			
		||||
 | 
			
		||||
# make us session leader which makes all childs exit if we do
 | 
			
		||||
# make us session leader which makes all children exit if we do
 | 
			
		||||
setsid;
 | 
			
		||||
 | 
			
		||||
sub print_help ();
 | 
			
		||||
| 
						 | 
				
			
			@ -226,7 +226,8 @@ if (/\s*(\d*) blocks of size (\d*)\. (\d*) blocks available/) {
 | 
			
		|||
	my ($total_bytes) = $1 * $2;
 | 
			
		||||
	my ($occupied_bytes) = $1 * $2 - $avail_bytes;
 | 
			
		||||
	my ($avail) = $avail_bytes/1024;
 | 
			
		||||
	my ($capper) = int(($3/$1)*100);
 | 
			
		||||
	my ($capper);
 | 
			
		||||
	if ($1!=0) { $capper = int(($3/$1)*100) } else { $capper=100 };
 | 
			
		||||
	my ($mountpt) = "\\\\$host\\$share";
 | 
			
		||||
 | 
			
		||||
	# TODO : why is the kB the standard unit for args ?
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -134,7 +134,7 @@ if (defined $ifdescr || defined $iftype) {
 | 
			
		|||
	}
 | 
			
		||||
	if ($status==0) {
 | 
			
		||||
		$state = "UNKNOWN";
 | 
			
		||||
		printf "$state: could not retrive ifdescr/iftype snmpkey - $status-$snmpkey\n";
 | 
			
		||||
		printf "$state: could not retrieve ifdescr/iftype snmpkey - $status-$snmpkey\n";
 | 
			
		||||
		$session->close;
 | 
			
		||||
		exit $ERRORS{$state};
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -187,7 +187,7 @@ if (defined $ifXTable) {
 | 
			
		|||
	 $name = $response->{$snmpIfDescr} ;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
## if AdminStatus is down - some one made a consious effort to change config
 | 
			
		||||
## if AdminStatus is down - some one made a conscious effort to change config
 | 
			
		||||
##
 | 
			
		||||
if ( not ($response->{$snmpIfAdminStatus} == 1) ) {
 | 
			
		||||
	$answer = "Interface $name (index $snmpkey) is administratively down.";
 | 
			
		||||
| 
						 | 
				
			
			@ -286,7 +286,7 @@ sub print_usage() {
 | 
			
		|||
	printf "check_ifoperstatus -k <IF_KEY> -H <HOSTNAME> [-C <community>]\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 "This program is licensed under the terms of the ";
 | 
			
		||||
	printf "GNU General Public License\n(check source code for details)\n";
 | 
			
		||||
	printf "\n\n";
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -424,7 +424,7 @@ sub process_arguments() {
 | 
			
		|||
		if (defined $seclevel && defined $secname) {
 | 
			
		||||
			$session_opts{'-username'} = $secname;
 | 
			
		||||
		
 | 
			
		||||
			# Must define a security level even though defualt is noAuthNoPriv
 | 
			
		||||
			# Must define a security level even though default is noAuthNoPriv
 | 
			
		||||
			unless ( grep /^$seclevel$/, qw(noAuthNoPriv authNoPriv authPriv) ) {
 | 
			
		||||
				usage("Must define a valid security level even though default is noAuthNoPriv");
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -354,7 +354,7 @@ sub process_arguments() {
 | 
			
		|||
		if (defined $seclevel && defined $secname) {
 | 
			
		||||
			$session_opts{'-username'} = $secname;
 | 
			
		||||
		
 | 
			
		||||
			# Must define a security level even though defualt is noAuthNoPriv
 | 
			
		||||
			# Must define a security level even though default is noAuthNoPriv
 | 
			
		||||
			unless ( grep /^$seclevel$/, qw(noAuthNoPriv authNoPriv authPriv) ) {
 | 
			
		||||
				usage("Must define a valid security level even though default is noAuthNoPriv");
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -60,7 +60,7 @@ sub print_usage ();
 | 
			
		|||
sub connection ($$$$);
 | 
			
		||||
sub bindRemote ($$);
 | 
			
		||||
 | 
			
		||||
# -------------------------------------------------------------[ Enviroment ]--
 | 
			
		||||
# -------------------------------------------------------------[ Environment ]--
 | 
			
		||||
 | 
			
		||||
$ENV{'PATH'}='@TRUSTED_PATH@';
 | 
			
		||||
$ENV{'BASH_ENV'}=''; 
 | 
			
		||||
| 
						 | 
				
			
			@ -146,7 +146,6 @@ sub bindRemote ($$)
 | 
			
		|||
{
 | 
			
		||||
	my ($in_remotehost, $in_remoteport) = @_;
 | 
			
		||||
	my $proto = getprotobyname('tcp');
 | 
			
		||||
	my $sockaddr;
 | 
			
		||||
	my $that;
 | 
			
		||||
	my ($name, $aliases,$type,$len,$thataddr) = gethostbyname($in_remotehost);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -154,8 +153,7 @@ sub bindRemote ($$)
 | 
			
		|||
	    print "IRCD UNKNOWN: Could not start socket ($!)\n";
 | 
			
		||||
	    exit $ERRORS{"UNKNOWN"};
 | 
			
		||||
	}
 | 
			
		||||
	$sockaddr = 'S n a4 x8';
 | 
			
		||||
	$that = pack($sockaddr, AF_INET, $in_remoteport, $thataddr);
 | 
			
		||||
	$that = pack_sockaddr_in ($in_remoteport, $thataddr);
 | 
			
		||||
	if (!connect(ClientSocket, $that)) { 
 | 
			
		||||
	    print "IRCD UNKNOWN: Could not connect socket ($!)\n";
 | 
			
		||||
	    exit $ERRORS{"UNKNOWN"};
 | 
			
		||||
| 
						 | 
				
			
			@ -208,7 +206,7 @@ MAIN:
 | 
			
		|||
 | 
			
		||||
	# Just in case of problems, let's not hang the monitoring system
 | 
			
		||||
	$SIG{'ALRM'} = sub {
 | 
			
		||||
		print "Somthing is Taking a Long Time, Increase Your TIMEOUT (Currently Set At $TIMEOUT Seconds)\n";
 | 
			
		||||
		print "Something is Taking a Long Time, Increase Your TIMEOUT (Currently Set At $TIMEOUT Seconds)\n";
 | 
			
		||||
		exit $ERRORS{"UNKNOWN"};
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -105,11 +105,11 @@ while test -n "$1"; do
 | 
			
		|||
    case "$1" in
 | 
			
		||||
        -h | --help)
 | 
			
		||||
            print_help
 | 
			
		||||
            exit "$STATE_OK"
 | 
			
		||||
            exit "$STATE_UNKNOWN"
 | 
			
		||||
            ;;
 | 
			
		||||
        -V | --version)
 | 
			
		||||
            print_revision "$PROGNAME" "$REVISION"
 | 
			
		||||
            exit "$STATE_OK"
 | 
			
		||||
            exit "$STATE_UNKNOWN"
 | 
			
		||||
            ;;
 | 
			
		||||
        -F | --filename)
 | 
			
		||||
            logfile=$2
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,7 @@
 | 
			
		|||
#   transmittal.  
 | 
			
		||||
#
 | 
			
		||||
# Initial version support sendmail's mailq command
 | 
			
		||||
#  Support for mutiple sendmail queues (Carlos Canau)
 | 
			
		||||
#  Support for multiple sendmail queues (Carlos Canau)
 | 
			
		||||
#  Support for qmail (Benjamin Schmid)
 | 
			
		||||
 | 
			
		||||
# License Information:
 | 
			
		||||
| 
						 | 
				
			
			@ -149,7 +149,26 @@ if ($mailq eq "sendmail") {
 | 
			
		|||
##/var/spool/mqueue/qF/df is empty
 | 
			
		||||
##                Total Requests: 1
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
# separate submission/transport queues, empty
 | 
			
		||||
## MSP Queue status...
 | 
			
		||||
## /var/spool/mqueue-client is empty
 | 
			
		||||
##                 Total requests: 0
 | 
			
		||||
## MTA Queue status...
 | 
			
		||||
## /var/spool/mqueue is empty
 | 
			
		||||
##                 Total requests: 0
 | 
			
		||||
# separate submission/transport queues: 1
 | 
			
		||||
## MSP Queue status...
 | 
			
		||||
##                 /var/spool/mqueue-client (1 request)
 | 
			
		||||
## -----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------
 | 
			
		||||
## oAJEfhdW014123        5 Fri Nov 19 14:41 jwm
 | 
			
		||||
##                  (Deferred: Connection refused by [127.0.0.1])
 | 
			
		||||
##                                          root
 | 
			
		||||
##                 Total requests: 1
 | 
			
		||||
## MTA Queue status...
 | 
			
		||||
## /var/spool/mqueue is empty
 | 
			
		||||
##                 Total requests: 0
 | 
			
		||||
 | 
			
		||||
	my $this_msg_q = 0;
 | 
			
		||||
	while (<MAILQ>) {
 | 
			
		||||
	
 | 
			
		||||
		# match email addr on queue listing
 | 
			
		||||
| 
						 | 
				
			
			@ -189,13 +208,18 @@ if ($mailq eq "sendmail") {
 | 
			
		|||
	    	#
 | 
			
		||||
		    # single queue: first line
 | 
			
		||||
		    # multi queue: one for each queue. overwrite on multi queue below
 | 
			
		||||
	  	  $msg_q = $1 ;
 | 
			
		||||
		  $this_msg_q = $1 ;
 | 
			
		||||
	  	  $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 ;
 | 
			
		||||
			if ($this_msg_q) {
 | 
			
		||||
				$this_msg_q = 0 ;
 | 
			
		||||
			} else {
 | 
			
		||||
				print "$utils::PATH_TO_MAILQ = $_ \n" if $verbose ;
 | 
			
		||||
				#
 | 
			
		||||
				# multi queue: last line
 | 
			
		||||
				$msg_q += $1 ;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										145
									
								
								plugins-scripts/check_mssql.pl
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										145
									
								
								plugins-scripts/check_mssql.pl
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,145 @@
 | 
			
		|||
#!@PERL@ -w
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Copyright 2003 Roy Sigurd Karlsbakk
 | 
			
		||||
#
 | 
			
		||||
# Requires freetds and DBD::Sybase 
 | 
			
		||||
# http://www.freetds.org 
 | 
			
		||||
# http://www.mbay.net/~mpeppler/
 | 
			
		||||
#
 | 
			
		||||
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA.
 | 
			
		||||
#
 | 
			
		||||
# Report bugs to: help@monitoring-plugins.org
 | 
			
		||||
# 
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
use DBI;
 | 
			
		||||
use DBD::Sybase;
 | 
			
		||||
use Getopt::Long;
 | 
			
		||||
use FindBin;
 | 
			
		||||
use lib "$FindBin::Bin";
 | 
			
		||||
use utils qw($TIMEOUT %ERRORS &print_revision &support);
 | 
			
		||||
use strict;
 | 
			
		||||
 | 
			
		||||
my $PROGNAME = "check_mssql";
 | 
			
		||||
 | 
			
		||||
$ENV{'PATH'}='@TRUSTED_PATH@';
 | 
			
		||||
$ENV{'BASH_ENV'}=''; 
 | 
			
		||||
$ENV{'ENV'}='';
 | 
			
		||||
 | 
			
		||||
my (
 | 
			
		||||
	$server,$database,$username,$password,$query,$help,$verbose,$timeout,
 | 
			
		||||
	$dbh,$sth,$row,
 | 
			
		||||
	$s,$opt_V,$regex
 | 
			
		||||
);
 | 
			
		||||
my $exitcode = $ERRORS{'OK'};
 | 
			
		||||
 | 
			
		||||
process_arguments();
 | 
			
		||||
 | 
			
		||||
# Just in case of problems, let's not hang the monitoring system
 | 
			
		||||
$SIG{'ALRM'} = sub {
 | 
			
		||||
     print ("SQL UNKNOWN: ERROR connection $server (alarm timeout)\n");
 | 
			
		||||
     exit $ERRORS{"UNKNOWN"};
 | 
			
		||||
};
 | 
			
		||||
alarm($timeout);
 | 
			
		||||
 | 
			
		||||
unless ($dbh = DBI->connect("dbi:Sybase:server=".uc($server), "$username", "$password")) {
 | 
			
		||||
	printf "SQL CRITICAL: Can't connect to mssql server $DBI::errstr\n";
 | 
			
		||||
	exit($ERRORS{'CRITICAL'});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (defined $database) {  # otherwise use default database
 | 
			
		||||
	unless ($dbh->do("use $database")) {
 | 
			
		||||
		printf ("SQL CRITICAL: Can't 'use $database': $dbh->errstr");
 | 
			
		||||
		exit($ERRORS{'CRITICAL'});
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
$sth = $dbh->prepare($query);
 | 
			
		||||
unless ($sth->execute()) {
 | 
			
		||||
	printf("SQL CRITICAL: Error in query: $dbh->errstr\n");
 | 
			
		||||
	exit($ERRORS{'CRITICAL'});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$row = join(";",$sth->fetchrow_array);
 | 
			
		||||
 | 
			
		||||
$sth->finish;
 | 
			
		||||
$dbh->disconnect;
 | 
			
		||||
 | 
			
		||||
alarm(0);
 | 
			
		||||
if (defined $regex) {
 | 
			
		||||
	if ($row =~ /$regex/) {
 | 
			
		||||
		printf "SQL CRITICAL: - $row|$row\n";
 | 
			
		||||
		exit $ERRORS{'CRITICAL'};
 | 
			
		||||
	}else{
 | 
			
		||||
		print "SQL OK: $row|$row\n";
 | 
			
		||||
		exit $ERRORS{'OK'};
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
print "SQL OK: $row|$row\n";
 | 
			
		||||
exit $ERRORS{'OK'};
 | 
			
		||||
 | 
			
		||||
##################################################
 | 
			
		||||
 | 
			
		||||
sub syntax {
 | 
			
		||||
	$s = shift or $s = 'Unknown';
 | 
			
		||||
	printf("Error: ($s)\n") unless ($help);
 | 
			
		||||
	printf("Runs a query against a MS-SQL server or Sybase server and returns the first row\n");
 | 
			
		||||
	printf("Returns an error if no responses are running. Row is passed to perfdata	in\n");
 | 
			
		||||
	printf("semicolon delimited format\n");
 | 
			
		||||
	printf("A simple sql statement like \"select getdate()\" verifies server responsiveness\n\n");
 | 
			
		||||
	printf("Syntax: %s -s <server> -d <database> -u <username> -p <password> -q <query>	[-v]\n", $PROGNAME);
 | 
			
		||||
	printf("  --database -d		Database name\n");
 | 
			
		||||
	printf("  --Hostname -H		Server name\n");
 | 
			
		||||
	printf("  --username -u		Username\n");
 | 
			
		||||
	printf("  --password -p		Password\n");
 | 
			
		||||
	printf("  --query -q		SQL query to run\n");
 | 
			
		||||
	printf("  --timeout -t		Plugin timeout (default:$TIMEOUT)\n");
 | 
			
		||||
	printf("  --regex -r		regex against SQL response(CRIT if MATCH)\n");
 | 
			
		||||
	printf("  --verbose -v		verbose\n");
 | 
			
		||||
	printf("\nThe SQL response is concatenated into a string with a \";\" demarkation\n\n");
 | 
			
		||||
	exit($ERRORS{'UNKNOWN'});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub process_arguments {
 | 
			
		||||
	Getopt::Long::Configure('bundling');
 | 
			
		||||
	my $status = GetOptions
 | 
			
		||||
		("p=s" => \$password, "password=s" => \$password,
 | 
			
		||||
		 "u=s" => \$username, "username=s" => \$username,
 | 
			
		||||
		 "H=s" => \$server, "Hostname=s"    => \$server,
 | 
			
		||||
		 "d=s" => \$database, "database=s" => \$database,
 | 
			
		||||
		 "q=s" => \$query, "query=s" => \$query,
 | 
			
		||||
		 "t=i" => \$timeout, "timeout=i" => \$timeout,
 | 
			
		||||
		 "r=s" => \$regex, "regex=s" => \$regex,
 | 
			
		||||
		 "h" => \$help, "help" => \$help,
 | 
			
		||||
		 "v" => \$verbose, "verbose" => \$verbose,
 | 
			
		||||
		 "V" => \$opt_V, "version" => \$opt_V);
 | 
			
		||||
 | 
			
		||||
	if (defined $opt_V) {
 | 
			
		||||
		print_revision($PROGNAME,'@NP_VERSION@');
 | 
			
		||||
		exit $ERRORS{'UNKNOWN'};
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	syntax("Help:") if ($help);
 | 
			
		||||
	syntax("Missing username") unless (defined($username));
 | 
			
		||||
	syntax("Missing password") unless (defined($password));
 | 
			
		||||
	syntax("Missing server") unless (defined($server));
 | 
			
		||||
	syntax("Missing query string") unless (defined($query));
 | 
			
		||||
	$timeout = $TIMEOUT unless (defined($timeout));
 | 
			
		||||
	
 | 
			
		||||
	return;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -86,20 +86,20 @@ esac
 | 
			
		|||
# Information options
 | 
			
		||||
case "$cmd" in
 | 
			
		||||
--help)
 | 
			
		||||
		print_help
 | 
			
		||||
    exit "$STATE_OK"
 | 
			
		||||
    print_help
 | 
			
		||||
    exit "$STATE_UNKNOWN"
 | 
			
		||||
    ;;
 | 
			
		||||
-h)
 | 
			
		||||
		print_help
 | 
			
		||||
    exit "$STATE_OK"
 | 
			
		||||
    print_help
 | 
			
		||||
    exit "$STATE_UNKNOWN"
 | 
			
		||||
    ;;
 | 
			
		||||
--version)
 | 
			
		||||
		print_revision "$PROGNAME" "$REVISION"
 | 
			
		||||
    exit "$STATE_OK"
 | 
			
		||||
    print_revision "$PROGNAME" "$REVISION"
 | 
			
		||||
    exit "$STATE_UNKNOWN"
 | 
			
		||||
    ;;
 | 
			
		||||
-V)
 | 
			
		||||
		print_revision "$PROGNAME" "$REVISION"
 | 
			
		||||
    exit "$STATE_OK"
 | 
			
		||||
    print_revision "$PROGNAME" "$REVISION"
 | 
			
		||||
    exit "$STATE_UNKNOWN"
 | 
			
		||||
    ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@
 | 
			
		|||
# usage:
 | 
			
		||||
#    check_rpc host service
 | 
			
		||||
#
 | 
			
		||||
# Check if an rpc serice is registered and running
 | 
			
		||||
# Check if an rpc service is registered and running
 | 
			
		||||
# using rpcinfo - $proto $host $prognum 2>&1 |";
 | 
			
		||||
#
 | 
			
		||||
# Use these hosts.cfg entries as examples
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,19 +26,19 @@ print_help() {
 | 
			
		|||
case "$1" in
 | 
			
		||||
	--help)
 | 
			
		||||
		print_help
 | 
			
		||||
		exit "$STATE_OK"
 | 
			
		||||
		exit "$STATE_UNKNOWN"
 | 
			
		||||
		;;
 | 
			
		||||
	-h)
 | 
			
		||||
		print_help
 | 
			
		||||
		exit "$STATE_OK"
 | 
			
		||||
		exit "$STATE_UNKNOWN"
 | 
			
		||||
		;;
 | 
			
		||||
	--version)
 | 
			
		||||
		print_revision "$PROGNAME" "$REVISION"
 | 
			
		||||
		exit "$STATE_OK"
 | 
			
		||||
		exit "$STATE_UNKNOWN"
 | 
			
		||||
		;;
 | 
			
		||||
	-V)
 | 
			
		||||
		print_revision "$PROGNAME" "$REVISION"
 | 
			
		||||
		exit "$STATE_OK"
 | 
			
		||||
		exit "$STATE_UNKNOWN"
 | 
			
		||||
		;;
 | 
			
		||||
	*)
 | 
			
		||||
		sensordata=$(sensors 2>&1)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -110,7 +110,7 @@ $pretty_uptime .= sprintf( "%d week%s, ",   $weeks, $weeks == 1 ? "" : "s" )  if
 | 
			
		|||
$pretty_uptime .= sprintf( "%d day%s, ",    $days,  $days  == 1 ? "" : "s" )  if  $days;
 | 
			
		||||
$pretty_uptime .= sprintf( "%d hour%s, ",   $hours, $hours == 1 ? "" : "s" )  if  $hours;
 | 
			
		||||
$pretty_uptime .= sprintf( "%d minute%s, ", $mins,  $mins  == 1 ? "" : "s" )  if  $mins;
 | 
			
		||||
# Replace last occurence of comma with "and"
 | 
			
		||||
# Replace last occurrence of comma with "and"
 | 
			
		||||
$pretty_uptime =~ s/, $/ and /;
 | 
			
		||||
# Always print the seconds (though it may be 0 seconds)
 | 
			
		||||
$pretty_uptime .= sprintf( "%d second%s", $secs, $secs == 1 ? "" : "s" );
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,6 +19,7 @@ sub print_usage ();
 | 
			
		|||
$ENV{'PATH'}='@TRUSTED_PATH@';
 | 
			
		||||
$ENV{'BASH_ENV'}='';
 | 
			
		||||
$ENV{'ENV'}='';
 | 
			
		||||
$ENV{'CDPATH'}='';
 | 
			
		||||
 | 
			
		||||
Getopt::Long::Configure('bundling');
 | 
			
		||||
GetOptions
 | 
			
		||||
| 
						 | 
				
			
			@ -50,34 +51,34 @@ 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`;
 | 
			
		||||
$low1 = `$utils::PATH_TO_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`;
 | 
			
		||||
$med1 = `$utils::PATH_TO_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`;
 | 
			
		||||
$high1 = `$utils::PATH_TO_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`;
 | 
			
		||||
$snr = `$utils::PATH_TO_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`;
 | 
			
		||||
$low2 = `$utils::PATH_TO_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`;
 | 
			
		||||
$med2 = `$utils::PATH_TO_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`;
 | 
			
		||||
$high2 = `$utils::PATH_TO_SNMPGET $host public .1.3.6.1.4.1.74.2.21.1.2.1.10.1`;
 | 
			
		||||
@test = split(/ /,$high2);
 | 
			
		||||
$high2 = $test[2];
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,6 +23,7 @@ $PATH_TO_LMSTAT  = "@PATH_TO_LMSTAT@" ;
 | 
			
		|||
$PATH_TO_SMBCLIENT = "@PATH_TO_SMBCLIENT@" ;
 | 
			
		||||
$PATH_TO_MAILQ   = "@PATH_TO_MAILQ@";
 | 
			
		||||
$PATH_TO_QMAIL_QSTAT = "@PATH_TO_QMAIL_QSTAT@";
 | 
			
		||||
$PATH_TO_SNMPGET = "@PATH_TO_SNMPGET@";
 | 
			
		||||
 | 
			
		||||
## common variables
 | 
			
		||||
$TIMEOUT = 15;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue