New upstream version 2.2

This commit is contained in:
Jan Wagner 2016-11-30 12:36:55 +01:00
parent ea115afa68
commit c845af032a
101 changed files with 4649 additions and 22969 deletions

View file

@ -36,6 +36,8 @@ TESTS = @SCRIPT_TEST@
test:
perl -I $(top_builddir) -I $(top_srcdir) ../test.pl
perl -I $(top_builddir) -I $(top_srcdir) ../test.pl t/utils.t # utils.t is excluded from above, so manually ask to test
for SCRIPT in *.pl; do perl -wc $$SCRIPT || exit 1; done
set -e; for SCRIPT in *.sh; do sh -n $$SCRIPT || exit 1; done
test-debug:
NPTEST_DEBUG=1 HARNESS_VERBOSE=1 perl -I $(top_builddir) -I $(top_srcdir) ../test.pl

View file

@ -129,6 +129,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/np_mysqlclient.m4 \
$(top_srcdir)/gl/m4/stddef_h.m4 $(top_srcdir)/gl/m4/stdint.m4 \
$(top_srcdir)/gl/m4/stdint_h.m4 $(top_srcdir)/gl/m4/stdio_h.m4 \
$(top_srcdir)/gl/m4/stdlib_h.m4 $(top_srcdir)/gl/m4/strcase.m4 \
$(top_srcdir)/gl/m4/strcasestr.m4 \
$(top_srcdir)/gl/m4/strerror.m4 \
$(top_srcdir)/gl/m4/string_h.m4 \
$(top_srcdir)/gl/m4/strings_h.m4 \
@ -1007,6 +1008,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PATH_TO_APTGET = @PATH_TO_APTGET@
PATH_TO_DIG = @PATH_TO_DIG@
PATH_TO_ENV = @PATH_TO_ENV@
PATH_TO_FPING = @PATH_TO_FPING@
PATH_TO_FPING6 = @PATH_TO_FPING6@
PATH_TO_LMSTAT = @PATH_TO_LMSTAT@
@ -1024,6 +1026,7 @@ PATH_TO_SMBCLIENT = @PATH_TO_SMBCLIENT@
PATH_TO_SNMPGET = @PATH_TO_SNMPGET@
PATH_TO_SNMPGETNEXT = @PATH_TO_SNMPGETNEXT@
PATH_TO_SSH = @PATH_TO_SSH@
PATH_TO_SUDO = @PATH_TO_SUDO@
PATH_TO_SWAP = @PATH_TO_SWAP@
PATH_TO_SWAPINFO = @PATH_TO_SWAPINFO@
PATH_TO_UPTIME = @PATH_TO_UPTIME@
@ -1678,6 +1681,8 @@ uninstall-am: uninstall-libexecSCRIPTS
test:
perl -I $(top_builddir) -I $(top_srcdir) ../test.pl
perl -I $(top_builddir) -I $(top_srcdir) ../test.pl t/utils.t # utils.t is excluded from above, so manually ask to test
for SCRIPT in *.pl; do perl -wc $$SCRIPT || exit 1; done
set -e; for SCRIPT in *.sh; do sh -n $$SCRIPT || exit 1; done
test-debug:
NPTEST_DEBUG=1 HARNESS_VERBOSE=1 perl -I $(top_builddir) -I $(top_srcdir) ../test.pl

View file

@ -6,7 +6,6 @@ use Getopt::Long;
use vars qw($opt_V $opt_h $opt_w $opt_c $opt_H $opt_C $PROGNAME);
use FindBin;
use lib "$FindBin::Bin";
use lib '@libexecdir@';
use utils qw(%ERRORS &print_revision &support &usage);
$PROGNAME = "check_breeze";
@ -29,10 +28,10 @@ GetOptions
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@');
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
if ($opt_h) {print_help(); exit $ERRORS{'UNKNOWN'};}
($opt_H) || usage("Host name/address not specified\n");
my $host = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);

View file

@ -26,7 +26,6 @@ use vars qw($opt_P $opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_
use vars qw($PROGNAME);
use FindBin;
use lib "$FindBin::Bin";
use lib '@libexecdir@';
use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
sub print_help ();
@ -55,10 +54,10 @@ GetOptions
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@'); #'
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
if ($opt_h) {print_help(); exit $ERRORS{'UNKNOWN'};}
my $smbclient = $utils::PATH_TO_SMBCLIENT;
$smbclient || usage("check requires smbclient, smbclient not set\n");

View file

@ -27,7 +27,6 @@ use File::stat;
use vars qw($PROGNAME);
use FindBin;
use lib "$FindBin::Bin";
use lib '@libexecdir@';
use utils qw (%ERRORS &print_revision &support);
sub print_help ();
@ -61,12 +60,12 @@ GetOptions(
if ($opt_V) {
print_revision($PROGNAME, '@NP_VERSION@');
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_h) {
print_help();
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
$opt_f = shift unless ($opt_f);

View file

@ -37,7 +37,6 @@ use Getopt::Long;
use vars qw($opt_V $opt_h $opt_F $opt_t $verbose $PROGNAME);
use FindBin;
use lib "$FindBin::Bin";
use lib '@libexecdir@';
use utils qw(%ERRORS &print_revision &support &usage);
$PROGNAME="check_flexlm";
@ -59,7 +58,7 @@ GetOptions
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@');
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
unless (defined $opt_t) {
@ -67,7 +66,7 @@ unless (defined $opt_t) {
}
if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
if ($opt_h) {print_help(); exit $ERRORS{'UNKNOWN'};}
unless (defined $opt_F) {
print "Missing license.dat file\n";

View file

@ -37,7 +37,6 @@ use POSIX;
use strict;
use FindBin;
use lib "$FindBin::Bin";
use lib '@libexecdir@';
use utils qw($TIMEOUT %ERRORS &print_revision &support);
use Net::SNMP;
@ -326,7 +325,7 @@ sub print_help() {
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 " -M (--maxmsgsize) Max message size - useful 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";
@ -368,17 +367,17 @@ sub process_arguments() {
if ($status == 0){
print_help();
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@');
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_h) {
print_help();
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if (! utils::is_hostname($hostname)){

View file

@ -35,7 +35,6 @@ use POSIX;
use strict;
use FindBin;
use lib "$FindBin::Bin";
use lib '@libexecdir@';
use utils qw($TIMEOUT %ERRORS &print_revision &support);
use Net::SNMP;
@ -120,7 +119,7 @@ $status = process_arguments();
if ($status != 0)
{
print_help() ;
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
@ -281,7 +280,7 @@ sub print_help() {
printf " in hex with 0x prefix generated by using \"snmpkey\" utility\n";
printf " privacy password and authEngineID\n";
printf " -P (--privproto) privacy protocol (DES or AES; default: DES)\n";
printf " -M (--maxmsgsize) Max message size - usefull only for v1 or v2c\n";
printf " -M (--maxmsgsize) Max message size - useful 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";
@ -314,17 +313,17 @@ sub process_arguments() {
if ($status == 0){
print_help();
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@');
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_h) {
print_help();
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
unless (defined $timeout) {

View file

@ -51,7 +51,6 @@ use vars qw($opt_V $opt_h $opt_t $opt_p $opt_H $opt_w $opt_c $verbose);
use vars qw($PROGNAME);
use FindBin;
use lib "$FindBin::Bin";
use lib '@libexecdir@';
use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
# ----------------------------------------------------[ Function Prototypes ]--
@ -182,10 +181,10 @@ MAIN:
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@');
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_h) {print_help(); exit $ERRORS{'OK'};}
if ($opt_h) {print_help(); exit $ERRORS{'UNKNOWN'};}
($opt_H) || ($opt_H = shift @ARGV) || usage("Host name/address not specified\n");
my $remotehost = $1 if ($opt_H =~ /([-.A-Za-z0-9]+)/);

View file

@ -28,14 +28,14 @@
use POSIX;
use strict;
use Getopt::Long;
use vars qw($opt_V $opt_h $opt_v $verbose $PROGNAME $opt_w $opt_c $opt_t
use vars qw($opt_V $opt_h $opt_v $verbose $PROGNAME $opt_w $opt_c $opt_t $opt_s
$opt_M $mailq $status $state $msg $msg_q $msg_p $opt_W $opt_C $mailq @lines
%srcdomains %dstdomains);
use FindBin;
use lib "$FindBin::Bin";
use lib '@libexecdir@';
use utils qw(%ERRORS &print_revision &support &usage );
my ($sudo);
sub print_help ();
sub print_usage ();
@ -57,6 +57,17 @@ if ($status){
exit $ERRORS{"UNKNOWN"};
}
if ($opt_s) {
if (defined $utils::PATH_TO_SUDO && -x $utils::PATH_TO_SUDO) {
$sudo = $utils::PATH_TO_SUDO;
} else {
print "ERROR: Cannot execute sudo\n";
exit $ERRORS{'UNKNOWN'};
}
} else {
$sudo = "";
}
$SIG{'ALRM'} = sub {
print ("ERROR: timed out waiting for $utils::PATH_TO_MAILQ \n");
exit $ERRORS{"WARNING"};
@ -69,7 +80,7 @@ if ($mailq eq "sendmail") {
## open mailq
if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) {
if (! open (MAILQ, "$sudo $utils::PATH_TO_MAILQ | " ) ) {
print "ERROR: could not open $utils::PATH_TO_MAILQ \n";
exit $ERRORS{'UNKNOWN'};
}
@ -298,7 +309,7 @@ elsif ( $mailq eq "postfix" ) {
## open mailq
if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) {
if (! open (MAILQ, "$sudo $utils::PATH_TO_MAILQ | " ) ) {
print "ERROR: could not open $utils::PATH_TO_MAILQ \n";
exit $ERRORS{'UNKNOWN'};
}
@ -380,7 +391,7 @@ 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 | " ) ) {
if (! open (MAILQ, "$sudo $utils::PATH_TO_QMAIL_QSTAT | " ) ) {
print "ERROR: could not open $utils::PATH_TO_QMAIL_QSTAT \n";
exit $ERRORS{'UNKNOWN'};
}
@ -462,7 +473,7 @@ elsif ( $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 | " ) ) {
if (! open (MAILQ, "$sudo $utils::PATH_TO_MAILQ | " ) ) {
print "ERROR: could not open $utils::PATH_TO_MAILQ \n";
exit $ERRORS{'UNKNOWN'};
}
@ -505,7 +516,7 @@ elsif ( $mailq eq "exim" ) {
elsif ( $mailq eq "nullmailer" ) {
## open mailq
if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) {
if (! open (MAILQ, "$sudo $utils::PATH_TO_MAILQ | " ) ) {
print "ERROR: could not open $utils::PATH_TO_MAILQ \n";
exit $ERRORS{'UNKNOWN'};
}
@ -556,17 +567,18 @@ sub process_arguments(){
"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
"t=i" => \$opt_t, "timeout=i" => \$opt_t,
"s" => \$opt_s, "sudo" => \$opt_s
);
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@');
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_h) {
print_help();
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if (defined $opt_v ){
@ -637,7 +649,7 @@ sub process_arguments(){
}
sub print_usage () {
print "Usage: $PROGNAME -w <warn> -c <crit> [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-v verbose]\n";
print "Usage: $PROGNAME -w <warn> -c <crit> [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-s] [-v]\n";
}
sub print_help () {
@ -654,6 +666,7 @@ sub print_help () {
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 | nullmailer ] (default = autodetect)\n";
print "-s (--sudo) = Use sudo to call the mailq command\n";
print "-h (--help)\n";
print "-V (--version)\n";
print "-v (--verbose) = debugging output\n";

View file

@ -22,7 +22,6 @@
use strict;
use FindBin;
use lib "$FindBin::Bin";
use lib '@libexecdir@';
use utils qw($TIMEOUT %ERRORS &print_revision &support);
use vars qw($PROGNAME);
my ($verbose,@proto,%prognum,$host,$response,$prognum,$port,$cmd,$progver,$state);
@ -64,12 +63,12 @@ GetOptions(
);
# -h means display verbose help screen
if ($opt_h) { print_help(); exit $ERRORS{'OK'}; }
if ($opt_h) { print_help(); exit $ERRORS{'UNKNOWN'}; }
# -V means display version number
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@');
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
# Hash containing all RPC program names and numbers

View file

@ -5,7 +5,6 @@
use strict;
use FindBin;
use lib "$FindBin::Bin";
use lib '@libexecdir@';
use utils qw($TIMEOUT %ERRORS &print_revision &support);
use vars qw($PROGNAME);
use Getopt::Long;
@ -32,12 +31,12 @@ GetOptions
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@'); #'
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
if ($opt_h) {
print_help();
exit $ERRORS{'OK'};
exit $ERRORS{'UNKNOWN'};
}
$opt_H = shift unless ($opt_H);

View file

@ -15,7 +15,7 @@ my $successOutput = '/^check_rpc/';
my $t;
$t += checkCmd( "./check_rpc -V", 0, $successOutput );
$t += checkCmd( "./check_rpc -V", 3, $successOutput );
exit(0) if defined($Test::Harness::VERSION);
exit($tests - $t);

View file

@ -17,6 +17,7 @@ sub support();
sub is_hostname;
## updated by autoconf
$PATH_TO_SUDO = "@PATH_TO_SUDO@";
$PATH_TO_RPCINFO = "@PATH_TO_RPCINFO@" ;
$PATH_TO_LMSTAT = "@PATH_TO_LMSTAT@" ;
$PATH_TO_SMBCLIENT = "@PATH_TO_SMBCLIENT@" ;