瀏覽代碼

Contrib plugin cleanup

git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@6 f882894a-f735-0410-b71e-b25c423dba1c
Ethan Galstad 24 年之前
父節點
當前提交
ecc185f1a4

+ 22 - 0
contrib/check_breeze.pl

@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+# Plugin to test signal strength on Breezecom wireless equipment
+# Contributed by Jeffrey Blank
+
+$Host=$ARGV[0];
+$sig_crit=$ARGV[1];
+$sig_warn=$ARGV[2];
+$sig=0;
+$sig = `snmpget $Host public .1.3.6.1.4.1.710.3.2.3.1.3.0`;
+@test=split(/ /,$sig);
+$sig=@test[2];
+$sig=int($sig);
+if ($sig>100){$sig=100}
+
+print "Signal Strength at: $sig%\n";
+if ($sig<$sig_crit)
+  {exit(2)}
+if ($sig<$sig_warn)
+  {exit(1)}
+
+exit(0);

+ 5 - 5
contrib/check_dhcp.c

@@ -4,7 +4,7 @@
 *
 *
 * Program: DHCP plugin for Nagios
 * Program: DHCP plugin for Nagios
 * License: GPL
 * License: GPL
-* Copyright (c) 2001 Ethan Galstad (nagios@nagios.org)
+* Copyright (c) 2001-2002 Ethan Galstad (nagios@nagios.org)
 *
 *
 * License Information:
 * License Information:
 *
 *
@@ -437,7 +437,7 @@ int send_dhcp_packet(void *buffer, int buffer_size, int sock, struct sockaddr_in
 	struct sockaddr_in myname;
 	struct sockaddr_in myname;
 	int result;
 	int result;
 
 
-	result=sendto(sock,(char *)buffer,buffer_size,0,(struct sockaddr_in *)dest,sizeof(*dest));
+	result=sendto(sock,(char *)buffer,buffer_size,0,(struct sockaddr *)dest,sizeof(*dest));
 
 
 #ifdef DEBUG
 #ifdef DEBUG
 	printf("send_dhcp_packet result: %d\n",result);
 	printf("send_dhcp_packet result: %d\n",result);
@@ -480,11 +480,11 @@ int receive_dhcp_packet(void *buffer, int buffer_size, int sock, int timeout, st
 		/* why do we need to peek first?  i don't know, its a hack.  without it, the source address of the first packet received was
 		/* why do we need to peek first?  i don't know, its a hack.  without it, the source address of the first packet received was
 		   not being interpreted correctly.  sigh... */
 		   not being interpreted correctly.  sigh... */
 		bzero(&source_address,sizeof(source_address));
 		bzero(&source_address,sizeof(source_address));
-                recv_result=recvfrom(sock,(char *)buffer,buffer_size,MSG_PEEK,(struct sockaddr_in *)&source_address,&address_size);
+                recv_result=recvfrom(sock,(char *)buffer,buffer_size,MSG_PEEK,(struct sockaddr *)&source_address,&address_size);
 #ifdef DEBUG
 #ifdef DEBUG
 		printf("recv_result_1: %d\n",recv_result);
 		printf("recv_result_1: %d\n",recv_result);
 #endif
 #endif
-                recv_result=recvfrom(sock,(char *)buffer,buffer_size,0,(struct sockaddr_in *)&source_address,&address_size);
+                recv_result=recvfrom(sock,(char *)buffer,buffer_size,0,(struct sockaddr *)&source_address,&address_size);
 #ifdef DEBUG
 #ifdef DEBUG
 		printf("recv_result_2: %d\n",recv_result);
 		printf("recv_result_2: %d\n",recv_result);
 #endif
 #endif
@@ -812,7 +812,7 @@ void print_help(void){
 
 
 	/*print_revision(PROGNAME,"$Revision$");*/
 	/*print_revision(PROGNAME,"$Revision$");*/
 
 
-	printf("Copyright (c) 2001 Ethan Galstad (nagios@nagios.org)\n\n");
+	printf("Copyright (c) 2001-2002 Ethan Galstad (nagios@nagios.org)\n\n");
 	printf("This plugin tests the availability of DHCP servers on a network.\n\n");
 	printf("This plugin tests the availability of DHCP servers on a network.\n\n");
 
 
 	print_usage();
 	print_usage();

+ 82 - 0
contrib/check_flexlm.pl

@@ -0,0 +1,82 @@
+#!/usr/local/bin/perl
+#
+# 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
+# current status: looks like working
+#
+# Copyright Notice: Do as you please, credit me, but don't blame me
+#
+
+# Just in case of problems, let's not hang Nagios
+$SIG{'ALRM'} = sub {
+	print "No Answer from Client\n";
+	exit 2;
+};
+alarm(20);
+
+$lmstat = "/opt/lic/sw/cadadm/default/bin/lmstat";
+
+$licfile = shift;
+
+#print "$licfile \n";
+
+open CMD,"$lmstat -c $licfile |";
+
+$serverup = 0;
+
+while ( <CMD> ) {
+  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;	
+}
+
+exit 0 if ( $servers == $lf1 + $lf2 + $lf3 );
+exit 1 if ( $servers == 3 && $lf1 + $lf2 + $lf3 == 2 );
+exit 2;

+ 209 - 0
contrib/check_hltherm.c

@@ -0,0 +1,209 @@
+/******************************************************************************************
+ *
+ * CHECK_HLTHERM.C
+ *
+ * Program: Hot Little Therm temperature plugin for Nagios
+ * License: GPL
+ * Copyright (c) 1999-2002 Ethan Galstad (nagios@nagios.org)
+ *
+ * Last Modified: 02-28-2002
+ *
+ * Command line: check_hltherm <probe> <wtemp> <ctemp> [-l label] [-s scale] [-lower]
+ *
+ * Description:
+ *
+ * This plugin checks the temperature of a given temperature probe on a
+ * Hot Little Therm digital thermometer.  The plugin uses the 'therm' utility
+ * that is included with the HLT software to check the probe temperature.  Both
+ * the HLT digital thermometer and software are produced by Spiderplant. See
+ * their website at http://www.spiderplant.com/hlt for more information.
+ *
+ *****************************************************************************************/
+
+#include "config.h"
+#include "common.h"
+#include "popen.h"
+
+#define DEFAULT_TIMEOUT         10	/* default timeout in seconds */
+
+#define HLTHERM_COMMAND          "/usr/local/bin/therm"     /* this should be moved out to the configure script */
+
+
+static void timeout_alarm_handler(int); /* author must provide */
+int process_arguments(int, char **);
+
+int timeout_interval=DEFAULT_TIMEOUT;
+
+double wtemp=0.0L;
+double ctemp=0.0L;
+
+int check_lower_temps=FALSE;
+
+char probe[MAX_INPUT_BUFFER]="";
+char label[MAX_INPUT_BUFFER]="Temperature";
+char scale[MAX_INPUT_BUFFER]="Degrees";
+
+FILE *fp;
+
+
+int main(int argc, char **argv){
+	int result=STATE_OK;
+	char command[MAX_INPUT_BUFFER];
+	double temp=0.0L;
+	char input_buffer[MAX_INPUT_BUFFER];
+	int found=0;
+
+	/* process command line arguments */
+	result=process_arguments(argc,argv);
+
+	/* display usage if there was a problem */
+	if(result==ERROR){
+		printf("Incorrect arguments supplied\n");
+		printf("\n");
+		printf("Hot Little Therm temperature plugin for Nagios\n");
+		printf("Copyright (c) 1999-2002 Ethan Galstad (nagios@nagios.org)\n");
+		printf("Last Modified: 02-28-2002\n");
+		printf("License: GPL\n");
+		printf("\n");
+		printf("Usage: %s <probe> <wtemp> <ctemp> [-l label] [-s scale] [-lower]\n",argv[0]);
+		printf("\n");
+		printf("Options:\n");
+		printf(" <wtemp>  = Temperature necessary to result in a WARNING state\n");
+		printf(" <ctemp>  = Temperature necessary to result in a CRITICAL state\n");
+		printf(" [label]  = A descriptive label for the probe.  Example: \"Outside Temp\"\n");
+		printf(" [scale]  = A descriptive label for the temperature scale.  Example: \"Celsius\"\n");
+		printf(" [-lower] = Evaluate temperatures with lower values being more critical\n");
+		printf("\n");
+		printf("This plugin checks the temperature of a given temperature probe on a\n");
+		printf("Hot Little Therm digital thermometer.  The plugin uses the 'therm' utility\n");
+		printf("included with the HLT software to check the probe temperature.  Both the\n");
+		printf("HLT digital thermometer and software are produced by Spiderplant. See\n");
+		printf("their website at http://www.spiderplant.com/hlt for more information.\n");
+		printf("\n");
+		return STATE_UNKNOWN;
+	        }
+
+
+	result=STATE_OK;
+
+	/* Set signal handling and alarm */
+	if(signal(SIGALRM,timeout_alarm_handler)==SIG_ERR){
+		printf("Cannot catch SIGALRM");
+		return STATE_UNKNOWN;
+	        }
+
+	/* handle timeouts gracefully */
+	alarm(timeout_interval);
+
+	/* create the command line we're going to use */
+	snprintf(command,sizeof(command),"%s %s",HLTHERM_COMMAND,probe);
+	command[sizeof(command)-1]='\x0';
+
+	/* run the command to check the temperature on the probe */
+	fp=spopen(command);
+	if(fp==NULL){
+		printf("Could not open pipe: %s\n",command);
+		return STATE_UNKNOWN;
+	        }
+
+	if(fgets(input_buffer,MAX_INPUT_BUFFER-1,fp)){
+		found=1;
+		temp=(double)atof(input_buffer);
+	        }
+
+	/* close the pipe */
+	spclose(fp);
+
+	if(result==STATE_OK){
+
+		if(found==0){
+			printf("Therm problem - Could not read program output\n");
+			result=STATE_CRITICAL;
+		        }
+		else{
+			if(check_lower_temps==TRUE){
+				if(temp<=ctemp)
+					result=STATE_CRITICAL;
+				else if(temp<=wtemp)
+				       result=STATE_WARNING;
+			        }
+			else{
+				if(temp>=ctemp)
+					result=STATE_CRITICAL;
+				else if(temp>=wtemp)
+					result=STATE_WARNING;
+			        }
+
+			printf("Therm %s: %s = %2.1f %s\n",(result==STATE_OK)?"ok":"problem",label,temp,scale);
+		        }
+	        }
+
+	return result;
+        }
+
+
+/* process command-line arguments */
+int process_arguments(int argc, char **argv){
+	int x;
+
+	/* not enough options were supplied */
+	if(argc<4)
+		return ERROR;
+
+	/* first option is always the probe name */
+	strncpy(probe,argv[1],sizeof(probe)-1);
+	probe[sizeof(probe)-1]='\x0';
+
+	/* 2nd and 3rd options are temperature thresholds */
+	wtemp=(double)atof(argv[2]);
+	ctemp=(double)atof(argv[3]);
+
+	/* process all remaining arguments */
+	for(x=5;x<=argc;x++){
+
+		/* we got the lower temperature option */
+		if(!strcmp(argv[x-1],"-lower"))
+			check_lower_temps=TRUE;
+
+		/* we got the label */
+		else if(!strcmp(argv[x-1],"-l")){
+			if(x<argc){
+				strncpy(label,argv[x],sizeof(label));
+				label[sizeof(label)-1]='\x0';
+				x++;
+			        }
+			else
+				return ERROR;
+		        }
+
+		/* we got the scale */
+		else if(!strcmp(argv[x-1],"-s")){
+			if(x<argc){
+				strncpy(scale,argv[x],sizeof(scale));
+				scale[sizeof(scale)-1]='\x0';
+				x++;
+			        }
+			else
+				return ERROR;
+		        }
+
+		/* else we got something else... */
+		else
+			return ERROR;
+	        }
+
+	return OK;
+        }
+
+
+
+/* handle timeouts gracefully... */
+static void timeout_alarm_handler(int signo){
+
+	if(signo==SIGALRM){
+    
+		kill(childpid[fileno(fp)],SIGKILL);
+		printf("Therm problem - Check timed out after %d seconds\n",timeout_interval);
+		exit(STATE_CRITICAL);
+	        }
+        }

+ 215 - 0
contrib/check_hprsc.pl

@@ -0,0 +1,215 @@
+#!/usr/bin/perl -wT
+#
+# Copyright (c) 2000 Hugo Gayosso
+#
+# Description:
+#    Nagios plug-in that monitors the resources on an HP-UX machine
+#    by querying the SNMP daemon
+#
+# License: General Public License (GPL)
+#          http://www.gnu.org/copyleft/gpl.txt
+#
+# ChangeLog
+#
+
+# Requirements: Perl 5.005 or higher
+
+# Variable initialization
+$ENV{'PATH'}="";
+$ENV{'ENV'}="";
+$ENV{'BASH_ENV'}="";
+
+
+if (-e "/usr/bin/snmpwalk") {
+  $snmpwalk = "/usr/bin/snmpwalk";
+} elsif (-e "/usr/local/bin/snmpwalk") {
+  $snmpwalk = "/usr/local/snmpwalk";
+}
+
+
+# HP-UX SNMP OIDs
+$filesystemID1_OID   = ".1.3.6.1.4.1.11.2.3.1.2.2.1.1";
+$mounted_OID         = ".1.3.6.1.4.1.11.2.3.1.2.2.1.3";
+$totalspace_OID      = ".1.3.6.1.4.1.11.2.3.1.2.2.1.4";
+$freespace_OID       = ".1.3.6.1.4.1.11.2.3.1.2.2.1.6";
+$path_OID            = ".1.3.6.1.4.1.11.2.3.1.2.2.1.10";
+$cpu_5min_OID        = ".1.3.6.1.4.1.11.2.3.1.1.4";
+
+use Getopt::Long;
+
+GetOptions( "check-filesystem"   => \$chk_fs,
+	    "show-filesystems"   => \$show_fs,
+	    "check-filesystemID" => \$chk_fsid,
+	    "check-cpu"          => \$chk_cpu,
+	    "host=s"             => \$target_host,
+	    "community=s"        => \$target_community,
+	    "filesystemID1=i"    => \$fsid1_opt,
+	    "filesystem=s"       => \$fs_opt,
+	    "warning=i"          => \$warning_opt,
+            "critical=i"         => \$critical_opt);
+
+if ($chk_fs) {
+    walk_data($snmpwalk, $target_host, $target_community, $mounted_OID );
+    walk_data($snmpwalk, $target_host, $target_community, $totalspace_OID );
+    walk_data($snmpwalk, $target_host, $target_community, $freespace_OID );    check_filesystem($fs_opt, $warning_opt, $critical_opt);
+} elsif ($show_fs) {
+    walk_data($snmpwalk, $target_host, $target_community, $filesystemID1_OID);
+    walk_data($snmpwalk, $target_host, $target_community, $mounted_OID );
+    walk_data($snmpwalk, $target_host, $target_community, $path_OID);
+    show_filesystem();
+} elsif ($chk_fsid){
+    $totalspace_fsID_OID = "$totalspace_OID.$fsid1_opt";
+    $freespace_fsID_OID = "$freespace_OID.$fsid1_opt";
+    walk_data($snmpwalk, $target_host, $target_community, $totalspace_fsID_OID);
+    walk_data($snmpwalk, $target_host, $target_community, $freespace_fsID_OID);
+    check_filesystemID1($fsid1_opt, $warning_opt, $critical_opt);
+} elsif ($chk_cpu) {
+    get_cpu_load($snmpwalk, $target_host, $target_community, $cpu_5min_OID);
+    check_cpu_5min($cpu, $warning_opt, $critical_opt);
+} else {
+    print "\n\nUsage:\n";
+    print "Checking 5-min CPU Load:\n";
+    print "     $0 --check-cpu -warning <threshold> --critical <threshold> --host <yourhost> --community <SNMP community>\n\n";
+    print "Checking local filesystem mounted on a host:\n";
+    print "     $0 --show-filesystems --host <hostname> --community <SNMP community>\n\n";
+    print "Checking by filesystem name:\n";
+    print "     $0 --check-filesystem --filesystem </dev/vg00/lvol1> --warning <% used space> --critical <% used space> --host <hostname> --community <SNMP community>\n\n";
+    print "Checking by filesystem ID:\n";
+    print "     $0 --check-filesystemID --filesystemID <filesystemID1> --warning <% used space> --critical <% used space> --host <hostname> --community <SNMP community>\n\n";
+}
+
+sub get_cpu_load {
+    my ($snmpwalk, $target_host, $target_community, $OID) = @_;
+    die "cannot fork: $!" unless defined($pid = open(SNMPWALK, "-|"));
+
+    if ($pid) {   # parent
+	while (<SNMPWALK>) {
+	    my @snmpdata = split(/:/,$_);
+	    $cpu = $snmpdata[1]/100;
+	}
+	close(SNMPWALK) or warn "kid exited $?";
+    } else {      # child
+	exec($snmpwalk,$target_host,$target_community,$OID)  or die "can't exec program: $!";
+    }
+}
+
+sub walk_data {
+#This function queries the SNMP daemon for the specific OID
+    my ($snmpwalk, $target_host, $target_community, $OID) = @_;
+
+    die "cannot fork: $!" unless defined($pid = open(SNMPWALK, "-|"));
+
+    if ($pid) {   # parent
+	while (<SNMPWALK>) {
+	    $output = $_;
+	    sort_walk_data($output);
+	}
+	close(SNMPWALK) or warn "kid exited $?";
+    } else {      # child
+	exec($snmpwalk,$target_host,$target_community,$OID)  or die "can't exec program: $!";
+    }
+}
+
+sub sort_walk_data {
+    my ($snmp_data) = @_;
+    @fields = split(/\./,$snmp_data);
+    $item = $fields[8];
+    $filesystemID1 = $fields[9];
+    @fields2 = split(/=/,$fields[10]);
+#   $filesystemID2 = $fields2[0];
+    $value = $fields2[1];
+    chomp($value);
+    if ($value =~ /"/) {
+        @fields3 = split(/"/,$value);
+        $value = $fields3[1];
+    }
+    if ($item == 3) {
+	$mounted{$filesystemID1} = "$value";
+    } elsif ($item == 4) {
+	$totalspace{$filesystemID1} = "$value";
+    } elsif ($item == 6) {
+	$freespace{$filesystemID1} = "$value";
+    } elsif ($item == 10) {
+	$filesystempath{$filesystemID1} = "$value";
+    }
+}
+
+sub show_filesystem {
+    print "\n\nfilesystemID1\tmounted filesystem\tfilesystem path\n";
+    foreach $element (keys %mounted) {
+	print "$element\t$mounted{$element}\t\t$filesystempath{$element}\n";
+    }
+    print "\n\n";
+}
+
+sub check_filesystem {
+
+# Warning  = percentage of used space >= $warning and < $critical
+# Critical = percentage of used space > $warning and >= $critical
+# OK       = percentage of used space < $warning and < $critical
+
+    my ($mounted_filesystem, $warning, $critical) = @_;
+    foreach $element (keys %mounted) {
+	if ($mounted{$element} eq $mounted_filesystem) {
+	    my $warning_result = $totalspace{$element}*(100-$warning)/100;
+	    my $critical_result = $totalspace{$element}*(100-$critical)/100;
+	    my $result_percent = $freespace{$element}*100/$totalspace{$element};
+	    if (($freespace{$element} <= $warning_result) && ($freespace{$element} > $critical_result)) {
+		printf "Only %d M (%d%s) free\n",$freespace{$element}/1024,$result_percent,"%";
+		exit 1;
+	    } elsif ($freespace{$element} <= $critical_result) {
+		printf "Only %d M (%d%s) free\n",$freespace{$element}/1024,$result_percent,"%";
+		exit 2;
+	    } else {
+		printf "Disk ok - %d M (%d%s) free\n",$freespace{$element}/1024,$result_percent,"%";
+		exit 0;
+	    }
+	}
+    }
+    print "$mounted_filesystem doesn't exist in $target_host\n\n";
+    exit -1;
+}
+
+sub check_filesystemID1{
+# Warning  = percentage of used space >= $warning and < $critical
+# Critical = percentage of used space > $warning and >= $critical
+# OK       = percentage of used space < $warning and < $critical
+
+    my ($fsid1, $warning, $critical) = @_;
+    foreach $element (keys %totalspace) {
+	if ($element eq  $fsid1) {
+	    my $warning_result = $totalspace{$element}*(100-$warning)/100;
+	    my $critical_result = $totalspace{$element}*(100-$critical)/100;
+	    my $result_percent = $freespace{$element}*100/$totalspace{$element};
+	    if (($freespace{$element} <= $warning_result) && ($freespace{$element} >= $critical_result)) {
+		printf "Only %d M (%d%s) free\n",$freespace{$element}/1024,$result_percent,"%";
+		exit 1;
+	    } elsif ($freespace{$element} <= $critical_result) {
+		printf "Only %d M (%d%s) free\n",$freespace{$element}/1024,$result_percent,"%";
+		exit 2;
+	    } else {
+		printf "Disk ok - %d M (%d%s) free\n",$freespace{$element}/1024,$result_percent,"%";
+		exit 0;
+	    }
+	}
+    }
+    print "$fsid1 doesn't exist in $target_host\n\n";
+    exit -1;
+}
+
+sub check_cpu_5min {
+    my ($cpu, $warn, $crit) = @_;
+    if ($cpu >= $crit) {
+	print "Critical- 5-min load: $cpu\n";
+	exit 2;
+    } elsif ($cpu >= $warn) {
+	print "Warning - 5-min load: $cpu\n";
+	exit 1;
+    } else {
+	print "Load ok - 5-min load: $cpu\n";
+	exit 0;
+    }
+}
+
+
+

+ 3 - 2
contrib/check_ipxping.c

@@ -27,9 +27,10 @@
  *
  *
  *****************************************************************************************/
  *****************************************************************************************/
 
 
-#include "../common/config.h"
-#include "../common/common.h"
+#include "config.h"
+#include "common.h"
 #include "netutils.h"
 #include "netutils.h"
+#include "popen.h"
 
 
 /* this should be moved out to the configure script! */
 /* this should be moved out to the configure script! */
 #define IPXPING_COMMAND	"/tmp/ipxping/ipxping"
 #define IPXPING_COMMAND	"/tmp/ipxping/ipxping"

+ 2 - 2
contrib/check_mysql.c

@@ -30,8 +30,8 @@
  *   		 
  *   		 
  *******************************************************************/
  *******************************************************************/
 
 
-#include "../common/config.h"
-#include "../common/common.h"
+#include "config.h"
+#include "common.h"
 #include "mysql.h"
 #include "mysql.h"
 
 
 MYSQL mysql;
 MYSQL mysql;

+ 4 - 4
contrib/check_uptime.c

@@ -21,10 +21,10 @@
  *
  *
  *****************************************************************************/
  *****************************************************************************/
 
 
-#include "common/config.h"
-#include "common/common.h"
-#include "common/utils.h"
-#include "common/popen.h"
+#include "config.h"
+#include "common.h"
+#include "utils.h"
+#include "popen.h"
 
 
 int main(int argc, char **argv)
 int main(int argc, char **argv)
 {
 {

+ 77 - 0
contrib/check_wave.pl

@@ -0,0 +1,77 @@
+#!/usr/bin/perl
+
+# CHECK_WAVE.PL
+# Plugin to test signal strength on Speedlan wireless equipment
+# Contributed by Jeffry Blank
+
+$Host=$ARGV[0];
+$sig_crit=$ARGV[1];
+$sig_warn=$ARGV[2];
+
+
+
+
+$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);
+#print "Signal Strength at: $ss%,  SNR at $snr%";
+if ($ss<$sig_crit)
+  {exit(2)}
+if ($ss<$sig_warn)
+  {exit(1)}
+
+exit(0);

+ 14 - 101
contrib/readme.txt

@@ -4,13 +4,22 @@ Contrib Plugins README
 This directory contains plugins which have been contributed by various people, but that
 This directory contains plugins which have been contributed by various people, but that
 have not yet been incorporated into the core plugins distribution.
 have not yet been incorporated into the core plugins distribution.
 
 
+Most Perl plugins should work without modification.  Some of the C plugins may require
+a few tweaks to compile.
+
 If you have questions regarding the use of these plugins, try contacting the author(s)
 If you have questions regarding the use of these plugins, try contacting the author(s)
-or post a message to the nagios-users mailing list (nagios-users@onelist.com)
+or post a message to the nagiosplug-help mailing list (nagiosplug-help@lists.sourceforge.net)
 requesting assistance.
 requesting assistance.
 
 
 
 
-Plugin Overview
----------------
+
+Contrib Tarballs
+----------------
+
+In addition to the plugins located in this directory, there are some additional tarballs
+containing plugins in the tarballs/ subdirectory.  They have not yet been organized.
+A brief description of their contents follows.
+
 
 
 berger-ping.tar.gz      - Perl script version of the check_ping plugin and a corresponding
 berger-ping.tar.gz      - Perl script version of the check_ping plugin and a corresponding
                           CGI (mtr.cgi) that uses mtr to traceroute a path to a host.
                           CGI (mtr.cgi) that uses mtr to traceroute a path to a host.
@@ -21,71 +30,13 @@ bowen-langley_plugins.tar.gz
 			  (Adam Bown & Thomas Langley)
 			  (Adam Bown & Thomas Langley)
 
 
 
 
-check_bgpstate.tar.gz   - Perl script intended for monitoring BGP sessions on Cisco routers.
+check_bgp-1.0.tar.gz   - Perl script intended for monitoring BGP sessions on Cisco routers.
 			  Only useful if you are using BGP4 as a routing protocol.  For 
 			  Only useful if you are using BGP4 as a routing protocol.  For 
 			  critical alert the AS (autonomous system) number has to be in the
 			  critical alert the AS (autonomous system) number has to be in the
 			  uplinks hash (see the source code).  Requires SNMP read community.
 			  uplinks hash (see the source code).  Requires SNMP read community.
 			  (Christoph Kron)
 			  (Christoph Kron)
 
 
-check_breeze.tar.gz	- Perl script to test signal strength on Breezecom wireless
-			  equipment (Jeffrey Blank)
-
-check_dns_random.tar.gz - Perl script to see if dns resolves hosts randomly from a list 
-                          using the check_dns plugin (Richard Mayhew)
-
-check_flexlm.tar.gz	- Perl script to check a flexlm licensing manager using lmtest
-			  (Ernst-Dieter Martin)
-
-check_hltherm.tar.gz    - C program to check the temperature on a Hot Little Therm temperature
-                          probe.  The HLT device, along with temperature probes, can be obtained
- 			  from Spiderplant at http://www.spiderplant.com
-			  (Ethan Galstad)
-
-check_ifoperstatus.tar.gz
-			- Perl script that checks the operational interface status (up/down) for
-			  one interface on cisco/ascend routers. Especially useful for monitoring 
-			  leased lines.  Requires SNMP read community and SNMP interface key.
-			  (Christoph Kron)	   
-
-check_ifstatus.tar.gz   - Perl script that checks operational interface status for every interface
-                          on cisco routers. Requires SNMP read community.
-			  (Christoph Kron)
-
-check_ipxping.tar.gz    - C program that it similiar to the check_ping plugin, except that it
-                          send IPX ping packets to Novell servers or other IPX devices.  This
-                 	  requires the ipxping binary for Linux systems.  It does NOT by work
-                          without modification with the ipxping binary for SunOS/Solaris.
-			  (Ethan Galstad)
-
-check_maxchannels.tar.gz
-			- Perl script that can only be used for monitoring Ascend/Lucent Max/TNT
-			  access server. Checks ISDN channels and modem cards. Also shows ISDN and
-			  modem usage.  Requires SNMP read community.
-			  (Christoph Kron)
-
-check_maxwanstate.tar.gz 
-			- Perl script that can only be used for monitoring Ascend/Lucent Max/TNT
-			  access server. Checks if every enabled E1/T1 interface is operational
-			  (link active). Requires SNMP read community.
-			  (Christoph Kron)
-
-check_memory.tgz	- C program to check available system memory - RAM, swap, buffers,
-			  and cache (Joshua Jackson)
-
-check_nfs.tar.gz	- Perl script to test and NFS server using rpcinfo
-			  (Ernst-Dieter Martin)
-			  <NOW PART OF check_rpc IN CORE>
-
-check_ntp.tar.gz        - Perl script to check an NTP time source (Bo Kernsey)
-			  <MOVED TO CORE>
-
-check_ora.tar.gz        - Shell script that will check an Oracle database and the TNS listener.
-			  Unlike the check_oracle plugin, this plugin detects when a database is
-			  down and does not create temp files (Jason Hedden)
-			  <MOVED TO CORE>
-
-check_pop3.tar.gz       - Perl script that checks to see if POP3 is running and whether or not
-			  authentication can take place (Richard Mayhew)
+check_memory.tgz        - C plugin to check available system memory
 
 
 check_radius.tar.gz     - C program to check RADIUS authentication. This is a hacked version of 
 check_radius.tar.gz     - C program to check RADIUS authentication. This is a hacked version of 
 	                  the Cistron Radiusd program radtest that acts as a plugin for Nagios.
 	                  the Cistron Radiusd program radtest that acts as a plugin for Nagios.
@@ -95,24 +46,6 @@ check_radius.tar.gz     - C program to check RADIUS authentication. This is a ha
 		          will not appear in the core plugin distribution!
 		          will not appear in the core plugin distribution!
 		          (Adam Jacob)
 		          (Adam Jacob)
 
 
-check_real.tar.gz	- C program to check the status of a REAL media server 
-			  (Pedro Leite)
-			  <MOVED TO CORE>
-
-check_rpc.pl.gz		- Perl script to check rpc services.  Will check to see if the a specified
-			  program is running on the specified server (Chris Kolquist)
-
-check_sap.tar.gz	- Shell script to check an SAP message or application server.  Requires
-			  that you install the saprfc-devel-45A-1.i386.rpm (or higher) package 
-			  on your system.  The package can be obtained from the SAP FTP site in 
-			  the /general/misc/unsupported/linux directory. (Kavel Salavec)
-
-check_uptime.tar.gz     - C program to check system uptime.  Must be compiled with the release
-                          1.2.8 or later of the plugins. (Teresa Ramanan)
-
-check_wave.tar.gz	- Perl script to test signal strength on Speedlan wireless
-			  equipment (Jeffrey Blank)
-
 hopcroft-plugins.tar.gz - Various example plugin scripts contributed by Stanley Hopcroft.
 hopcroft-plugins.tar.gz - Various example plugin scripts contributed by Stanley Hopcroft.
 			  Includes a plugin to check Internet connectivity by checking various
 			  Includes a plugin to check Internet connectivity by checking various
 			  popular search engines, a plugin to check the availability of login
 			  popular search engines, a plugin to check the availability of login
@@ -121,27 +54,7 @@ hopcroft-plugins.tar.gz - Various example plugin scripts contributed by Stanley
 			  search via the web.
 			  search via the web.
 			  (Stanley Hopcroft)
 			  (Stanley Hopcroft)
 
 
-maser-oracle.tar.gz     - This is a modification to the check_oracle plugin script that returns
-			  the response time in milliseconds.  Requires the Oracle tnsping utility.
-			  (Christoph Maser)
-
 radius.tar.gz           - Code modifications necessary to make the radexample app 
 radius.tar.gz           - Code modifications necessary to make the radexample app 
 			  supplied with the radiusclient code work as a RADIUS plugin
 			  supplied with the radiusclient code work as a RADIUS plugin
 			  for Nagios (Nick Shore)
 			  for Nagios (Nick Shore)
 
 
-vincent-check_radius.tar.gz
-			- C program to check RADIUS authentication.  Requires the radiusclient 
-			  library available from ftp://ftp.cityline.net/pub/radiusclient/
-			  (Robert August Vincent II)
-			  <MOVED TO CORE>
-
-weipert-mysql.tar.gz    - C program to check a connection to a MySQL database server, with an
-			  optional username and password.  Requires mysql.h and libmysqlclient
-			  to compile (Time Weipert)
-
-wright-mysql.tar.gz     - Perl script to check MySQL database servers.  Requires that mysqladmin(1)
-			  be installed on the system (included in the MySQL distribution).  This
-			  plugin can accept warning and critical thresholds for the number of threads
-			  in use by the server (Mitch Wright)
-
-

二進制
contrib/tarballs/berger-ping.tar.gz


二進制
contrib/tarballs/bowen-langley_plugins.tar.gz


二進制
contrib/tarballs/check_bgp-1.0.tar.gz


二進制
contrib/tarballs/check_breeze.tar.gz


二進制
contrib/tarballs/check_flexlm.tar.gz


二進制
contrib/tarballs/check_hltherm.tar.gz


二進制
contrib/tarballs/check_hprsc.tar.gz


+ 0 - 0
contrib/check_memory.tgz → contrib/tarballs/check_memory.tgz


二進制
contrib/tarballs/check_radius.tar.gz


二進制
contrib/tarballs/check_wave.tar.gz


二進制
contrib/tarballs/hopcroft-plugins.tar.gz


二進制
contrib/tarballs/radius.tar.gz


+ 1 - 1
plugins/.cvsignore

@@ -39,5 +39,5 @@ stamp-h*
 *.h
 *.h
 Makefile
 Makefile
 Makefile.in
 Makefile.in
-config.h.in
+#config.h.in
 .deps
 .deps

+ 223 - 0
plugins/config.h.in

@@ -0,0 +1,223 @@
+/* plugins/config.h.in.  Generated automatically from configure.in by autoheader.  */
+
+/* Define to empty if the keyword does not work.  */
+#undef const
+
+/* Define for DGUX with <sys/dg_sys_info.h>.  */
+#undef DGUX
+
+/* Define if the `getloadavg' function needs to be run setuid or setgid.  */
+#undef GETLOADAVG_PRIVILEGED
+
+/* Define if your system has its own `getloadavg' function.  */
+#undef HAVE_GETLOADAVG
+
+/* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
+#undef HAVE_SYS_WAIT_H
+
+/* Define if your struct nlist has an n_un member.  */
+#undef NLIST_NAME_UNION
+
+/* Define if you have <nlist.h>.  */
+#undef NLIST_STRUCT
+
+/* Define to `int' if <sys/types.h> doesn't define.  */
+#undef pid_t
+
+/* Define as the return type of signal handlers (int or void).  */
+#undef RETSIGTYPE
+
+/* Define to `unsigned' if <sys/types.h> doesn't define.  */
+#undef size_t
+
+/* Define if you have the ANSI C header files.  */
+#undef STDC_HEADERS
+
+/* Define on System V Release 4.  */
+#undef SVR4
+
+/* Define if you can safely include both <sys/time.h> and <time.h>.  */
+#undef TIME_WITH_SYS_TIME
+
+/* Define if your <sys/time.h> declares struct tm.  */
+#undef TM_IN_SYS_TIME
+
+/* Define for Encore UMAX.  */
+#undef UMAX
+
+/* Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
+   instead of <sys/cpustats.h>.  */
+#undef UMAX4_3
+
+#undef CGIURL
+#undef DF_COMMAND
+#undef HAVE_GETOPT_H
+#undef HAVE_GETOPT_LONG
+#undef HAVE_PROC_LOADAVG
+#undef HAVE_PROC_MEMINFO
+#undef HAVE_SSL
+#undef HAVE_SWAP
+#undef NSLOOKUP_COMMAND
+#undef PACKAGE_VERSION
+#undef PATH_TO_DIG
+#undef PATH_TO_FPING
+#undef PATH_TO_QSTAT
+#undef PATH_TO_SNMPGET
+#undef PATH_TO_SNMPGETNEXT
+#undef PATH_TO_UPTIME
+#undef PING_COMMAND
+#undef PING_PACKETS_FIRST
+#undef POSIX_STATE_DEFS
+#undef PROC_LOADAVG
+#undef PROC_MEMINFO
+#undef PS_COMMAND
+#undef PS_FORMAT
+#undef PS_RAW_COMMAND
+#undef PS_VARLIST
+#undef RSS_COMMAND
+#undef RSS_FORMAT
+#undef SOCKET_SIZE_TYPE
+#undef SSH_COMMAND
+#undef SWAP_COMMAND
+#undef SWAP_FORMAT
+#undef USE_PS_VARS
+#undef VSZ_COMMAND
+#undef VSZ_FORMAT
+#undef WHO_COMMAND
+#undef PACKAGE
+#undef VERSION
+
+/* Define if you have the getloadavg function.  */
+#undef HAVE_GETLOADAVG
+
+/* Define if you have the getopt_long_only function.  */
+#undef HAVE_GETOPT_LONG_ONLY
+
+/* Define if you have the select function.  */
+#undef HAVE_SELECT
+
+/* Define if you have the socket function.  */
+#undef HAVE_SOCKET
+
+/* Define if you have the strdup function.  */
+#undef HAVE_STRDUP
+
+/* Define if you have the strstr function.  */
+#undef HAVE_STRSTR
+
+/* Define if you have the strtod function.  */
+#undef HAVE_STRTOD
+
+/* Define if you have the strtol function.  */
+#undef HAVE_STRTOL
+
+/* Define if you have the strtoul function.  */
+#undef HAVE_STRTOUL
+
+/* Define if you have the <crypto.h> header file.  */
+#undef HAVE_CRYPTO_H
+
+/* Define if you have the <err.h> header file.  */
+#undef HAVE_ERR_H
+
+/* Define if you have the <errno.h> header file.  */
+#undef HAVE_ERRNO_H
+
+/* Define if you have the <libpq-fe.h> header file.  */
+#undef HAVE_LIBPQ_FE_H
+
+/* Define if you have the <mach/mach.h> header file.  */
+#undef HAVE_MACH_MACH_H
+
+/* Define if you have the <mysql/errmsg.h> header file.  */
+#undef HAVE_MYSQL_ERRMSG_H
+
+/* Define if you have the <mysql/mysql.h> header file.  */
+#undef HAVE_MYSQL_MYSQL_H
+
+/* Define if you have the <openssl/crypto.h> header file.  */
+#undef HAVE_OPENSSL_CRYPTO_H
+
+/* Define if you have the <openssl/err.h> header file.  */
+#undef HAVE_OPENSSL_ERR_H
+
+/* Define if you have the <openssl/pem.h> header file.  */
+#undef HAVE_OPENSSL_PEM_H
+
+/* Define if you have the <openssl/rsa.h> header file.  */
+#undef HAVE_OPENSSL_RSA_H
+
+/* Define if you have the <openssl/ssl.h> header file.  */
+#undef HAVE_OPENSSL_SSL_H
+
+/* Define if you have the <openssl/x509.h> header file.  */
+#undef HAVE_OPENSSL_X509_H
+
+/* Define if you have the <pem.h> header file.  */
+#undef HAVE_PEM_H
+
+/* Define if you have the <pgsql/libpq-fe.h> header file.  */
+#undef HAVE_PGSQL_LIBPQ_FE_H
+
+/* Define if you have the <postgresql/libpq-fe.h> header file.  */
+#undef HAVE_POSTGRESQL_LIBPQ_FE_H
+
+/* Define if you have the <regex.h> header file.  */
+#undef HAVE_REGEX_H
+
+/* Define if you have the <rsa.h> header file.  */
+#undef HAVE_RSA_H
+
+/* Define if you have the <signal.h> header file.  */
+#undef HAVE_SIGNAL_H
+
+/* Define if you have the <ssl.h> header file.  */
+#undef HAVE_SSL_H
+
+/* Define if you have the <string.h> header file.  */
+#undef HAVE_STRING_H
+
+/* Define if you have the <strings.h> header file.  */
+#undef HAVE_STRINGS_H
+
+/* Define if you have the <sys/loadavg.h> header file.  */
+#undef HAVE_SYS_LOADAVG_H
+
+/* Define if you have the <sys/socket.h> header file.  */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define if you have the <sys/time.h> header file.  */
+#undef HAVE_SYS_TIME_H
+
+/* Define if you have the <sys/types.h> header file.  */
+#undef HAVE_SYS_TYPES_H
+
+/* Define if you have the <syslog.h> header file.  */
+#undef HAVE_SYSLOG_H
+
+/* Define if you have the <uio.h> header file.  */
+#undef HAVE_UIO_H
+
+/* Define if you have the <unistd.h> header file.  */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the <x509.h> header file.  */
+#undef HAVE_X509_H
+
+/* Define if you have the crypt library (-lcrypt).  */
+#undef HAVE_LIBCRYPT
+
+/* Define if you have the crypto library (-lcrypto).  */
+#undef HAVE_LIBCRYPTO
+
+/* Define if you have the dgc library (-ldgc).  */
+#undef HAVE_LIBDGC
+
+/* Define if you have the ldap library (-lldap).  */
+#undef HAVE_LIBLDAP
+
+/* Define if you have the pq library (-lpq).  */
+#undef HAVE_LIBPQ
+
+/* Define if you have the radiusclient library (-lradiusclient).  */
+#undef HAVE_LIBRADIUSCLIENT