From 0f932952d40781a6ca256c5cdc2d5d744013ffdf Mon Sep 17 00:00:00 2001 From: kuriyama Date: Mon, 24 Jun 2002 01:59:54 +0000 Subject: Bump PORTREVISION. check_snmp calls snmpget without '-c' parameter, which is mandatory with NetSNMP 5.x. Add '-c' to the command line to make it work with both NetSNMP 4.x and 5.x. check_by_ssh dumps core with called without -C, also usage help output does not document -C and -v. check_ssh plugin incorrectly parses the SSH banner. check_ntp does not work with NTP v2. Add -n option to be able to select NTP version. Submitted by: David Douthitt , Jens Trzaska (check_snmp) via maintainer --- net-mgmt/nagios-plugins/Makefile | 1 + net-mgmt/nagios-plugins/files/patch-check_by_ssh.c | 29 +++++++++ net-mgmt/nagios-plugins/files/patch-check_ntp.pl | 76 ++++++++++++++++++++++ net-mgmt/nagios-plugins/files/patch-check_snmp.c | 20 ++++++ net-mgmt/nagios-plugins/files/patch-check_ssh.c | 20 ++++++ net-mgmt/nagios-plugins/files/patch-subst.in | 11 ++++ 6 files changed, 157 insertions(+) create mode 100644 net-mgmt/nagios-plugins/files/patch-check_by_ssh.c create mode 100644 net-mgmt/nagios-plugins/files/patch-check_ntp.pl create mode 100644 net-mgmt/nagios-plugins/files/patch-check_snmp.c create mode 100644 net-mgmt/nagios-plugins/files/patch-check_ssh.c create mode 100644 net-mgmt/nagios-plugins/files/patch-subst.in (limited to 'net-mgmt/nagios-plugins') diff --git a/net-mgmt/nagios-plugins/Makefile b/net-mgmt/nagios-plugins/Makefile index b6570cec94ac..4ddc787b7468 100644 --- a/net-mgmt/nagios-plugins/Makefile +++ b/net-mgmt/nagios-plugins/Makefile @@ -7,6 +7,7 @@ PORTNAME= netsaint-plugins PORTVERSION= 1.2.9.4 +PORTREVISION= 1 CATEGORIES= net MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= netsaintplug diff --git a/net-mgmt/nagios-plugins/files/patch-check_by_ssh.c b/net-mgmt/nagios-plugins/files/patch-check_by_ssh.c new file mode 100644 index 000000000000..f89ad7d49ffa --- /dev/null +++ b/net-mgmt/nagios-plugins/files/patch-check_by_ssh.c @@ -0,0 +1,29 @@ +--- plugins/check_by_ssh.c.orig Fri Jun 21 11:19:56 2002 ++++ plugins/check_by_ssh.c Fri Jun 21 11:54:25 2002 +@@ -191,7 +191,7 @@ + if (commands>1) + remotecmd=strscat(remotecmd,";echo STATUS CODE: $?;"); + +- if (strlen (remotecmd) <= 1) ++ if (remotecmd==NULL) + usage ("No remotecmd\n"); + + comm = ssprintf(comm,"%s %s '%s'",comm,hostname,remotecmd); +@@ -369,6 +369,8 @@ + " list of netsaint service names, separated by ':' [optional]\n" + "-n, --name=NAME\n" + " short name of host in netsaint configuration [optional]\n" ++ "-v, --verbose\n" ++ " short name of host in netsaint configuration [optional]\n" + "\n" + "The most common mode of use is to refer to a local identity file with\n" + "the '-i' option. In this mode, the identity pair should have a null\n" +@@ -388,7 +390,7 @@ + + + #define OPTIONS "\ +--H [-P port] [-f] [-y] [-t timeout] [-i identity]\n ++-H -C [-fyv] [-P port] [-t timeout] [-i identity]\n + [-l user] [-n name] [-s servicelist] [-O outputfile]" + + void print_usage(void) diff --git a/net-mgmt/nagios-plugins/files/patch-check_ntp.pl b/net-mgmt/nagios-plugins/files/patch-check_ntp.pl new file mode 100644 index 000000000000..3a3e3959ab88 --- /dev/null +++ b/net-mgmt/nagios-plugins/files/patch-check_ntp.pl @@ -0,0 +1,76 @@ +--- plugins-scripts/check_ntp.pl.orig Sun Jun 23 14:28:03 2002 ++++ plugins-scripts/check_ntp.pl Sun Jun 23 14:28:27 2002 +@@ -44,6 +44,10 @@ + # o Server has correct time but isn't suitable synchronization + # source. This happens while starting up and if contact + # with master has been lost. ++# ++# (c) 2001 David Douthitt ++# ++# Script modified to handle NTP v2 with new -n parameter + + BEGIN { + if ($0 =~ m/^(.*?)[\/\\]([^\/\\]+)$/) { +@@ -56,7 +60,7 @@ + use POSIX; + use strict; + use Getopt::Long; +-use vars qw($opt_H $opt_w $opt_c $verbose $PROGNAME); ++use vars qw($opt_n $opt_H $opt_w $opt_c $verbose $PROGNAME); + use lib $main::runtimedir; + use utils qw($TIMEOUT %ERRORS &print_revision &usage &support &is_error); + +@@ -69,6 +73,7 @@ + sub version (); + + delete @ENV{'PATH', 'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; ++$ENV{'PATH'} = "/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin"; + + Getopt::Long::Configure('bundling', 'no_ignore_case'); + GetOptions +@@ -77,6 +82,7 @@ + "v|verbose" => \$verbose, + "w|warning=s" => \$opt_w, + "c|critical=s" => \$opt_c, ++ "n|ntpversion" => \$opt_n, + "H|hostname=s" => \$opt_H); + + ($opt_H) || ($opt_H = shift) || usage("Host name/address not specified\n"); +@@ -93,6 +99,9 @@ + ($opt_c) || ($opt_c = shift) || ($opt_c = 120); + my $critical = $1 if ($opt_c =~ /([0-9]+)/); + ++($opt_n) || ($opt_n = shift) || ($opt_n = 3); ++my $ntp_version = $1 if ($opt_n =~ /([0-9])/); ++ + my $answer = undef; + my $offset = undef; + my $msg; # first line of output to print if format is invalid +@@ -117,7 +126,7 @@ + ### + ### + +-if (!open (NTPDATE, "/usr/local/sbin/ntpdate -q $host 2>&1 |")) { ++if (!open (NTPDATE, "ntpdate -o$ntp_version -q $host 2>&1 |")) { + print "Could not open ntpdate\n"; + exit $ERRORS{"UNKNOWN"}; + } +@@ -154,8 +163,7 @@ + ### + ### + +-if (open(NTPDC,"/usr/sbin/xntpdc -c peers $host 2>&1 |") || +- open(NTPDC,"/usr/sbin/ntpdc -c peers $host 2>&1 |")) { ++if (open(NTPDC,"/usr/sbin/ntpdc -c peers $host 2>&1 |")) { + while () { + print if ($verbose); + if (/([^\s]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/) { +@@ -224,7 +232,7 @@ + exit $state; + + sub print_usage () { +- print "Usage: $PROGNAME -H [-w ] [-c ]\n"; ++ print "Usage: $PROGNAME -H [ -n ] [-w ] [-c ]\n"; + } + + sub print_help () { diff --git a/net-mgmt/nagios-plugins/files/patch-check_snmp.c b/net-mgmt/nagios-plugins/files/patch-check_snmp.c new file mode 100644 index 000000000000..9f7a6dbd5e75 --- /dev/null +++ b/net-mgmt/nagios-plugins/files/patch-check_snmp.c @@ -0,0 +1,20 @@ +--- plugins/check_snmp.c.orig Fri Jun 21 14:34:23 2002 ++++ plugins/check_snmp.c Fri Jun 21 14:33:45 2002 +@@ -146,13 +146,13 @@ + /* create the command line to execute */ + if (getnext==TRUE) { + command_line = ssprintf (command_line, +- "%s -m ALL -v 1 %s %s %s", +- PATH_TO_SNMPGETNEXT, server_address, community, oid); ++ "%s -m ALL -v 1 -c %s %s %s", ++ PATH_TO_SNMPGETNEXT, community, server_address, oid); + } + else { + command_line = ssprintf (command_line, +- "%s -m ALL -v 1 %s %s %s", +- PATH_TO_SNMPGET, server_address, community, oid); ++ "%s -m ALL -v 1 -c %s %s %s", ++ PATH_TO_SNMPGET, community, server_address, oid); + } + + /* run the command */ diff --git a/net-mgmt/nagios-plugins/files/patch-check_ssh.c b/net-mgmt/nagios-plugins/files/patch-check_ssh.c new file mode 100644 index 000000000000..d80b91a2abb9 --- /dev/null +++ b/net-mgmt/nagios-plugins/files/patch-check_ssh.c @@ -0,0 +1,20 @@ +--- plugins/check_ssh.c.orig Fri Jun 21 12:17:43 2002 ++++ plugins/check_ssh.c Fri Jun 21 12:23:16 2002 +@@ -246,7 +246,7 @@ + printf("%s\n", output); + ssh_proto = output + 4; + ssh_server = ssh_proto + strspn(ssh_proto, "0123456789-. "); +- ssh_proto[strspn(ssh_proto, "0123456789-. ")] = 0; ++ ssh_proto[strspn(ssh_proto, "0123456789. ")] = 0; + printf + ("SSH ok - protocol version %s - server version %s\n", + ssh_proto, ssh_server); +@@ -272,7 +272,7 @@ + { + printf + ("Usage:\n" +- " %s -t [timeout] -p [port] \n" ++ " %s [-t ] [-p ] \n" + " %s -V prints version info\n" + " %s -h prints more detailed help\n", PROGNAME, PROGNAME, PROGNAME); + } diff --git a/net-mgmt/nagios-plugins/files/patch-subst.in b/net-mgmt/nagios-plugins/files/patch-subst.in new file mode 100644 index 000000000000..3caf2cb87757 --- /dev/null +++ b/net-mgmt/nagios-plugins/files/patch-subst.in @@ -0,0 +1,11 @@ +--- plugins-scripts/subst.in.orig Fri Sep 1 05:47:35 2000 ++++ plugins-scripts/subst.in Sun Jun 23 14:24:00 2002 +@@ -33,7 +33,7 @@ + # Trusted path mechanism (deprecated) + + /^[ \t]*\$ENV[ \t]*\{[ \t'"]*PATH[ \t"']*\}[ \t]*=/ { +- sub(/\=[ \t]*['"][^"']+["']/,"='@trusted_path@' # autoconf-derived"); ++ sub(/\=[ \t]*['"][^"']+["'];/,"='@trusted_path@'; # autoconf-derived"); + } + + /^[\t ]*(export[\t ]*)?PATH[\t ]*=['"]+.+["']$/ { -- cgit