Imported Upstream version 2.0

This commit is contained in:
Jan Wagner 2014-07-11 21:01:00 +02:00
parent c89ccc3c74
commit 0841b5c7c7
165 changed files with 25440 additions and 4442 deletions

View file

@ -19,10 +19,16 @@ libexec_SCRIPTS = check_breeze check_disk_smb check_flexlm check_ircd \
utils.sh utils.pm
EXTRA_DIST=check_breeze.pl check_disk_smb.pl check_flexlm.pl check_ircd.pl \
check_log.sh check_ntp.pl check_oracle.sh check_rpc.pl check_sensors.sh \
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 \
utils.sh.in utils.pm.in t
EDIT = sed \
-e 's|[@]NP_VERSION[@]|$(NP_VERSION)|g' \
-e 's|[@]TRUSTED_PATH[@]|$(with_trusted_path)|g' \
-e 's|[@]PERL[@]|$(PERL)|g' \
-e 's|[@]libexecdir[@]|$(libexecdir)|g'
TESTS_ENVIRONMENT=perl -I $(top_builddir) -I $(top_srcdir)
TESTS = @SCRIPT_TEST@
@ -38,11 +44,11 @@ test-debug:
CLEANFILES=$(libexec_SCRIPTS)
.pl :
NP_VERSION=$(NP_VERSION) $(AWK) -f ./subst $< > $@
$(EDIT) $< > $@
chmod +x $@
.sh :
NP_VERSION=$(NP_VERSION) $(AWK) -f ./subst $< > $@
$(EDIT) $< > $@
chmod +x $@
clean-local:

View file

@ -51,7 +51,7 @@ build_triplet = @build@
host_triplet = @host@
subdir = plugins-scripts
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/subst.in $(srcdir)/utils.pm.in $(srcdir)/utils.sh.in
$(srcdir)/utils.pm.in $(srcdir)/utils.sh.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/np_mysqlclient.m4 \
$(top_srcdir)/gl/m4/00gnulib.m4 $(top_srcdir)/gl/m4/alloca.m4 \
@ -78,6 +78,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/np_mysqlclient.m4 \
$(top_srcdir)/gl/m4/gnulib-common.m4 \
$(top_srcdir)/gl/m4/gnulib-comp.m4 \
$(top_srcdir)/gl/m4/hostent.m4 $(top_srcdir)/gl/m4/iconv.m4 \
$(top_srcdir)/gl/m4/idpriv.m4 \
$(top_srcdir)/gl/m4/include_next.m4 \
$(top_srcdir)/gl/m4/inet_ntop.m4 \
$(top_srcdir)/gl/m4/intlmacosx.m4 \
@ -127,11 +128,12 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/np_mysqlclient.m4 \
$(top_srcdir)/gl/m4/stdalign.m4 $(top_srcdir)/gl/m4/stdbool.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/stdlib_h.m4 $(top_srcdir)/gl/m4/strcase.m4 \
$(top_srcdir)/gl/m4/strerror.m4 \
$(top_srcdir)/gl/m4/string_h.m4 $(top_srcdir)/gl/m4/strndup.m4 \
$(top_srcdir)/gl/m4/strnlen.m4 $(top_srcdir)/gl/m4/strsep.m4 \
$(top_srcdir)/gl/m4/strstr.m4 \
$(top_srcdir)/gl/m4/string_h.m4 \
$(top_srcdir)/gl/m4/strings_h.m4 \
$(top_srcdir)/gl/m4/strndup.m4 $(top_srcdir)/gl/m4/strnlen.m4 \
$(top_srcdir)/gl/m4/strsep.m4 $(top_srcdir)/gl/m4/strstr.m4 \
$(top_srcdir)/gl/m4/sys_socket_h.m4 \
$(top_srcdir)/gl/m4/sys_types_h.m4 \
$(top_srcdir)/gl/m4/sys_uio_h.m4 \
@ -146,12 +148,12 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/np_mysqlclient.m4 \
$(top_srcdir)/gl/m4/wcrtomb.m4 $(top_srcdir)/gl/m4/wctype_h.m4 \
$(top_srcdir)/gl/m4/wint_t.m4 $(top_srcdir)/gl/m4/xalloc.m4 \
$(top_srcdir)/gl/m4/xsize.m4 $(top_srcdir)/gl/m4/xstrndup.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = subst utils.pm utils.sh
CONFIG_CLEAN_FILES = utils.pm utils.sh
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
@ -305,6 +307,7 @@ GNULIB_FCLOSE = @GNULIB_FCLOSE@
GNULIB_FDATASYNC = @GNULIB_FDATASYNC@
GNULIB_FDOPEN = @GNULIB_FDOPEN@
GNULIB_FFLUSH = @GNULIB_FFLUSH@
GNULIB_FFS = @GNULIB_FFS@
GNULIB_FFSL = @GNULIB_FFSL@
GNULIB_FFSLL = @GNULIB_FFSLL@
GNULIB_FGETC = @GNULIB_FGETC@
@ -670,6 +673,7 @@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@
HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
HAVE_DECL_STRERROR_R = @HAVE_DECL_STRERROR_R@
HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
@ -699,6 +703,7 @@ HAVE_FCHDIR = @HAVE_FCHDIR@
HAVE_FCHOWNAT = @HAVE_FCHOWNAT@
HAVE_FDATASYNC = @HAVE_FDATASYNC@
HAVE_FEATURES_H = @HAVE_FEATURES_H@
HAVE_FFS = @HAVE_FFS@
HAVE_FFSL = @HAVE_FFSL@
HAVE_FFSLL = @HAVE_FFSLL@
HAVE_FMA = @HAVE_FMA@
@ -810,8 +815,10 @@ HAVE_SQRTL = @HAVE_SQRTL@
HAVE_STDINT_H = @HAVE_STDINT_H@
HAVE_STPCPY = @HAVE_STPCPY@
HAVE_STPNCPY = @HAVE_STPNCPY@
HAVE_STRCASECMP = @HAVE_STRCASECMP@
HAVE_STRCASESTR = @HAVE_STRCASESTR@
HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
HAVE_STRINGS_H = @HAVE_STRINGS_H@
HAVE_STRPBRK = @HAVE_STRPBRK@
HAVE_STRPTIME = @HAVE_STRPTIME@
HAVE_STRSEP = @HAVE_STRSEP@
@ -902,7 +909,6 @@ LD = @LD@
LDAPINCLUDE = @LDAPINCLUDE@
LDAPLIBS = @LDAPLIBS@
LDFLAGS = @LDFLAGS@
LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@
LIBGNU_LTLIBDEPS = @LIBGNU_LTLIBDEPS@
LIBICONV = @LIBICONV@
@ -928,6 +934,7 @@ LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
LTLIBOBJS = @LTLIBOBJS@
LTLIBPTH = @LTLIBPTH@
LTLIBTHREAD = @LTLIBTHREAD@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MATHLIBS = @MATHLIBS@
@ -953,6 +960,7 @@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@
NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@
NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@
NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@
NEXT_AS_FIRST_DIRECTIVE_STRINGS_H = @NEXT_AS_FIRST_DIRECTIVE_STRINGS_H@
NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@
NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SOCKET_H@
NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H@
@ -973,6 +981,7 @@ NEXT_STDDEF_H = @NEXT_STDDEF_H@
NEXT_STDINT_H = @NEXT_STDINT_H@
NEXT_STDIO_H = @NEXT_STDIO_H@
NEXT_STDLIB_H = @NEXT_STDLIB_H@
NEXT_STRINGS_H = @NEXT_STRINGS_H@
NEXT_STRING_H = @NEXT_STRING_H@
NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@
NEXT_SYS_TYPES_H = @NEXT_SYS_TYPES_H@
@ -1032,7 +1041,6 @@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@
PST3CFLAGS = @PST3CFLAGS@
PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
PYTHON = @PYTHON@
RADIUSLIBS = @RADIUSLIBS@
RANLIB = @RANLIB@
RELEASE = @RELEASE@
@ -1224,7 +1232,6 @@ SCRIPT_TEST = @SCRIPT_TEST@
SED = @SED@
SERVENT_LIB = @SERVENT_LIB@
SET_MAKE = @SET_MAKE@
SH = @SH@
SHELL = @SHELL@
SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
@ -1248,6 +1255,7 @@ WARRANTY = @WARRANTY@
WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@
WINT_T_SUFFIX = @WINT_T_SUFFIX@
WTSAPI32LIBS = @WTSAPI32LIBS@
XGETTEXT = @XGETTEXT@
XGETTEXT_015 = @XGETTEXT_015@
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
@ -1320,10 +1328,16 @@ libexec_SCRIPTS = check_breeze check_disk_smb check_flexlm check_ircd \
utils.sh utils.pm
EXTRA_DIST = check_breeze.pl check_disk_smb.pl check_flexlm.pl check_ircd.pl \
check_log.sh check_ntp.pl check_oracle.sh check_rpc.pl check_sensors.sh \
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 \
utils.sh.in utils.pm.in t
EDIT = sed \
-e 's|[@]NP_VERSION[@]|$(NP_VERSION)|g' \
-e 's|[@]TRUSTED_PATH[@]|$(with_trusted_path)|g' \
-e 's|[@]PERL[@]|$(PERL)|g' \
-e 's|[@]libexecdir[@]|$(libexecdir)|g'
TESTS_ENVIRONMENT = perl -I $(top_builddir) -I $(top_srcdir)
TESTS = @SCRIPT_TEST@
CLEANFILES = $(libexec_SCRIPTS)
@ -1331,7 +1345,7 @@ all: all-am
.SUFFIXES:
.SUFFIXES: .pl .sh
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -1356,13 +1370,11 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
subst: $(top_builddir)/config.status $(srcdir)/subst.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
utils.pm: $(top_builddir)/config.status $(srcdir)/utils.pm.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
utils.sh: $(top_builddir)/config.status $(srcdir)/utils.sh.in
@ -1672,11 +1684,11 @@ test-debug:
NPTEST_DEBUG=1 HARNESS_VERBOSE=1 perl -I $(top_builddir) -I $(top_srcdir) ../test.pl t/utils.t # utils.t is excluded from above, so manually ask to test
.pl :
NP_VERSION=$(NP_VERSION) $(AWK) -f ./subst $< > $@
$(EDIT) $< > $@
chmod +x $@
.sh :
NP_VERSION=$(NP_VERSION) $(AWK) -f ./subst $< > $@
$(EDIT) $< > $@
chmod +x $@
clean-local:

View file

@ -1,10 +1,12 @@
#!/usr/bin/perl -wT
#!@PERL@ -w
use strict;
use Getopt::Long;
use vars qw($opt_V $opt_h $opt_w $opt_c $opt_H $opt_C $PROGNAME);
use lib utils.pm ;
use FindBin;
use lib "$FindBin::Bin";
use lib '@libexecdir@';
use utils qw(%ERRORS &print_revision &support &usage);
$PROGNAME = "check_breeze";
@ -12,7 +14,7 @@ $PROGNAME = "check_breeze";
sub print_help ();
sub print_usage ();
$ENV{'PATH'}='';
$ENV{'PATH'}='@TRUSTED_PATH@';
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';

View file

@ -1,9 +1,9 @@
#!/usr/bin/perl -w
#!@PERL@ -w
#
#
# check_disk.pl <host> <share> <user> <pass> [warn] [critical] [port]
#
# Nagios host script to get the disk usage from a SMB share
# Monitoring host script to get the disk usage from a SMB share
#
# Changes and Modifications
# =========================
@ -24,7 +24,9 @@ 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 utils.pm ;
use FindBin;
use lib "$FindBin::Bin";
use lib '@libexecdir@';
use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
sub print_help ();
@ -32,7 +34,7 @@ sub print_usage ();
$PROGNAME = "check_disk_smb";
$ENV{'PATH'}='';
$ENV{'PATH'}='@TRUSTED_PATH@';
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';
@ -171,7 +173,7 @@ my $res = undef;
my $perfdata = "";
my @lines = undef;
# Just in case of problems, let's not hang Nagios
# Just in case of problems, let's not hang the monitoring system
$SIG{'ALRM'} = sub {
print "No Answer from Client\n";
exit $ERRORS{"UNKNOWN"};
@ -293,7 +295,7 @@ sub print_help () {
print_revision($PROGNAME,'@NP_VERSION@');
print "Copyright (c) 2000 Michael Anthon/Karl DeBisschop
Perl Check SMB Disk plugin for Nagios
Perl Check SMB Disk plugin for monitoring
";
print_usage();

View file

@ -1,4 +1,4 @@
#!/bin/perl -w
#!@PERL@ -w
# check_file_age.pl Copyright (C) 2003 Steven Grimm <koreth-nagios@midwinter.com>
#
@ -17,26 +17,31 @@
# 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
# along with this program if not, write to the Free Software Foundation,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
use strict;
use English;
use Getopt::Long;
use File::stat;
use vars qw($PROGNAME);
use lib ".";
use FindBin;
use lib "$FindBin::Bin";
use lib '@libexecdir@';
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 ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V, $opt_i);
my ($result, $message, $age, $size, $st);
$PROGNAME="check_file_age";
$ENV{'PATH'}='@TRUSTED_PATH@';
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';
$opt_w = 240;
$opt_c = 600;
$opt_W = 0;
@ -47,6 +52,7 @@ Getopt::Long::Configure('bundling');
GetOptions(
"V" => \$opt_V, "version" => \$opt_V,
"h" => \$opt_h, "help" => \$opt_h,
"i" => \$opt_i, "ignore-missing" => \$opt_i,
"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,
@ -72,8 +78,15 @@ if (! $opt_f) {
# Check that file exists (can be directory or link)
unless (-e $opt_f) {
print "FILE_AGE CRITICAL: File not found - $opt_f\n";
exit $ERRORS{'CRITICAL'};
if ($opt_i) {
$result = 'OK';
print "FILE_AGE $result: $opt_f doesn't exist, but ignore-missing was set\n";
exit $ERRORS{$result};
} else {
print "FILE_AGE CRITICAL: File not found - $opt_f\n";
exit $ERRORS{'CRITICAL'};
}
}
$st = File::stat::stat($opt_f);
@ -95,7 +108,7 @@ exit $ERRORS{$result};
sub print_usage () {
print "Usage:\n";
print " $PROGNAME [-w <secs>] [-c <secs>] [-W <size>] [-C <size>] -f <file>\n";
print " $PROGNAME [-w <secs>] [-c <secs>] [-W <size>] [-C <size>] [-i] -f <file>\n";
print " $PROGNAME [-h | --help]\n";
print " $PROGNAME [-V | --version]\n";
}
@ -105,6 +118,7 @@ sub print_help () {
print "Copyright (c) 2003 Steven Grimm\n\n";
print_usage();
print "\n";
print " -i | --ignore-missing : return OK if the file does not exist\n";
print " <secs> File must be no more than this many seconds old (default: warn 240 secs, crit 600)\n";
print " <size> File must be at least this many bytes long (default: crit 0 bytes)\n";
print "\n";

View file

@ -1,4 +1,4 @@
#!/usr/bin/perl -w
#!@PERL@ -w
#
# usage:
# check_flexlm.pl license_file
@ -9,7 +9,7 @@
# Check and interpret the output of lmstat
# and create returncodes and output.
#
# Contrary to the nagios concept, this script takes
# Contrary to most other plugins, 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
@ -35,7 +35,9 @@
use strict;
use Getopt::Long;
use vars qw($opt_V $opt_h $opt_F $opt_t $verbose $PROGNAME);
use lib utils.pm;
use FindBin;
use lib "$FindBin::Bin";
use lib '@libexecdir@';
use utils qw(%ERRORS &print_revision &support &usage);
$PROGNAME="check_flexlm";
@ -43,7 +45,7 @@ $PROGNAME="check_flexlm";
sub print_help ();
sub print_usage ();
$ENV{'PATH'}='';
$ENV{'PATH'}='@TRUSTED_PATH@';
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';
@ -72,7 +74,7 @@ unless (defined $opt_F) {
print_usage();
exit $ERRORS{'UNKNOWN'};
}
# Just in case of problems, let's not hang Nagios
# Just in case of problems, let's not hang the monitoring system
$SIG{'ALRM'} = sub {
print "Timeout: No Answer from Client\n";
exit $ERRORS{'UNKNOWN'};

View file

@ -1,9 +1,9 @@
#!/usr/local/bin/perl -w
#!@PERL@ -w
#
# check_ifoperstatus.pl - nagios plugin
# check_ifoperstatus.pl - monitoring plugin
#
# Copyright (C) 2000 Christoph Kron,
# Modified 5/2002 to conform to updated Nagios Plugin Guidelines
# Modified 5/2002 to conform to updated Monitoring Plugins Guidelines
# Added support for named interfaces per Valdimir Ivaschenko (S. Ghosh)
# Added SNMPv3 support (10/2003)
#
@ -19,10 +19,11 @@
#
# 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.
# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA
#
#
# Report bugs to: nagiosplug-help@lists.sourceforge.net
# Report bugs to: help@monitoring-plugins.org
#
# 11.01.2000 Version 1.0
#
@ -34,7 +35,9 @@
use POSIX;
use strict;
use lib utils.pm ;
use FindBin;
use lib "$FindBin::Bin";
use lib '@libexecdir@';
use utils qw($TIMEOUT %ERRORS &print_revision &support);
use Net::SNMP;
@ -47,6 +50,10 @@ sub usage ($);
sub print_usage ();
sub process_arguments ();
$ENV{'PATH'}='@TRUSTED_PATH@';
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';
my $timeout;
my $status;
my %ifOperStatus = ('1','up',
@ -97,7 +104,7 @@ my %session_opts;
$status = process_arguments();
# Just in case of problems, let's not hang Nagios
# Just in case of problems, let's not hang the monitoring system
$SIG{'ALRM'} = sub {
print ("ERROR: No snmp response from $hostname (alarm)\n");
exit $ERRORS{"UNKNOWN"};
@ -288,7 +295,7 @@ sub print_usage() {
sub print_help() {
print_revision($PROGNAME, '@NP_VERSION@');
print_usage();
printf "check_ifoperstatus plugin for Nagios monitors operational \n";
printf "check_ifoperstatus plugin for monitoring 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";

View file

@ -1,10 +1,10 @@
#!/usr/local/bin/perl -w
#!@PERL@ -w
#
# check_ifstatus.pl - nagios plugin
# check_ifstatus.pl - monitoring plugin
#
#
# Copyright (C) 2000 Christoph Kron
# Modified 5/2002 to conform to updated Nagios Plugin Guidelines (S. Ghosh)
# Modified 5/2002 to conform to updated Monitoring Plugins Guidelines (S. Ghosh)
# Added -x option (4/2003)
# Added -u option (4/2003)
# Added -M option (10/2003)
@ -22,17 +22,19 @@
#
# 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.
# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#
#
# Report bugs to: ck@zet.net, nagiosplug-help@lists.sf.net
# Report bugs to: ck@zet.net, help@monitoring-plugins.org
#
# 11.01.2000 Version 1.0
#
use POSIX;
use strict;
use lib utils.pm ;
use FindBin;
use lib "$FindBin::Bin";
use lib '@libexecdir@';
use utils qw($TIMEOUT %ERRORS &print_revision &support);
use Net::SNMP;
@ -46,6 +48,9 @@ sub usage ($);
sub print_usage ();
sub process_arguments ();
$ENV{'PATH'}='@TRUSTED_PATH@';
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';
my $status;
my %ifOperStatus = ('1','up',
@ -99,7 +104,7 @@ my %session_opts;
# Just in case of problems, let's not hang Nagios
# Just in case of problems, let's not hang the monitoring system
$SIG{'ALRM'} = sub {
print ("ERROR: No snmp response from $hostname (alarm timeout)\n");
exit $ERRORS{"UNKNOWN"};
@ -239,7 +244,7 @@ sub print_usage() {
sub print_help() {
print_revision($PROGNAME, '@NP_VERSION@');
print_usage();
printf "check_ifstatus plugin for Nagios monitors operational \n";
printf "check_ifstatus plugin for monitoring operational \n";
printf "status of each network interface on the target host\n";
printf "\nUsage:\n";
printf " -H (--hostname) Hostname to query - (required)\n";

View file

@ -1,4 +1,4 @@
#!/usr/bin/perl -wT
#!@PERL@ -w
# -----------------------------------------------------------------------------
# File Name: check_ircd.pl
@ -16,8 +16,6 @@
# -----------------------------------------------------------------------------
# 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 :)
#
@ -51,7 +49,9 @@ 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 utils.pm;
use FindBin;
use lib "$FindBin::Bin";
use lib '@libexecdir@';
use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
# ----------------------------------------------------[ Function Prototypes ]--
@ -63,9 +63,9 @@ sub bindRemote ($$);
# -------------------------------------------------------------[ Enviroment ]--
$ENV{PATH} = "";
$ENV{ENV} = "";
$ENV{BASH_ENV} = "";
$ENV{'PATH'}='@TRUSTED_PATH@';
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';
# -----------------------------------------------------------------[ Global ]--
@ -121,7 +121,7 @@ sub print_help ()
print_revision($PROGNAME,'@NP_VERSION@');
print "Copyright (c) 2000 Richard Mayhew/Karl DeBisschop
Perl Check IRCD plugin for Nagios
Perl Check IRCD plugin for monitoring
";
print_usage();
@ -205,7 +205,7 @@ MAIN:
if ($opt_t && $opt_t =~ /^([0-9]+)$/) { $TIMEOUT = $1; }
# Just in case of problems, let's not hang Nagios
# 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";
exit $ERRORS{"UNKNOWN"};

View file

@ -1,6 +1,6 @@
#!/bin/sh
#
# Log file pattern detector plugin for Nagios
# Log file pattern detector plugin for monitoring
# Written by Ethan Galstad (nagios@nagios.org)
# Last Modified: 07-31-1999
#
@ -29,15 +29,15 @@
#
# 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
# 1. The "max_attempts" value for the service should be 1, as this will
# prevent the monitoring system 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.
# 2. The "notify_recovery" value for the service should be 0, so that the
# monitoring system 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 <old_file_log> for each service that
# you define to use this plugin script - even if the different services
@ -57,21 +57,13 @@
# Paths to commands used in this script. These
# may have to be modified to match your system setup.
# TV: removed PATH restriction. Need to think more about what this means overall
#PATH=""
ECHO="/bin/echo"
GREP="/bin/egrep"
DIFF="/bin/diff"
TAIL="/bin/tail"
CAT="/bin/cat"
RM="/bin/rm"
CHMOD="/bin/chmod"
TOUCH="/bin/touch"
PROGNAME=`/bin/basename $0`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
REVISION="@NP_VERSION@"
PATH="@TRUSTED_PATH@"
export PATH
. $PROGPATH/utils.sh
@ -86,7 +78,7 @@ print_help() {
echo ""
print_usage
echo ""
echo "Log file pattern detector plugin for Nagios"
echo "Log file pattern detector plugin for monitoring"
echo ""
support
}
@ -167,10 +159,10 @@ 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"
echo "Log check error: Log file $logfile does not exist!"
exit $STATE_UNKNOWN
elif [ ! -r $logfile ] ; then
$ECHO "Log check error: Log file $logfile is not readable!\n"
echo "Log check error: Log file $logfile is not readable!"
exit $STATE_UNKNOWN
fi
@ -179,8 +171,8 @@ fi
# the old diff file and exit
if [ ! -e $oldlog ]; then
$CAT $logfile > $oldlog
$ECHO "Log check data initialized...\n"
cat $logfile > $oldlog
echo "Log check data initialized..."
exit $STATE_OK
fi
@ -193,26 +185,26 @@ if [ -x /bin/mktemp ]; then
else
tempdiff=`/bin/date '+%H%M%S'`
tempdiff="/tmp/check_log.${tempdiff}"
$TOUCH $tempdiff
$CHMOD 600 $tempdiff
touch $tempdiff
chmod 600 $tempdiff
fi
$DIFF $logfile $oldlog | $GREP -v "^>" > $tempdiff
diff $logfile $oldlog | grep -v "^>" > $tempdiff
# Count the number of matching log entries we have
count=`$GREP -c "$query" $tempdiff`
count=`grep -c "$query" $tempdiff`
# Get the last matching entry in the diff file
lastentry=`$GREP "$query" $tempdiff | $TAIL -1`
lastentry=`grep "$query" $tempdiff | tail -1`
$RM -f $tempdiff
$CAT $logfile > $oldlog
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"
echo "Log check ok - 0 pattern matches found"
exitstatus=$STATE_OK
else # Print total matche count and the last entry we found
$ECHO "($count) $lastentry"
echo "($count) $lastentry"
exitstatus=$STATE_CRITICAL
fi

View file

@ -1,4 +1,4 @@
#!/usr/local/bin/perl -w
#!@PERL@ -w
# check_mailq - check to see how many messages are in the smtp queue awating
# transmittal.
@ -20,8 +20,8 @@
#
# 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.
#
# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA
#
############################################################################
@ -31,7 +31,9 @@ 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 utils.pm;
use FindBin;
use lib "$FindBin::Bin";
use lib '@libexecdir@';
use utils qw(%ERRORS &print_revision &support &usage );
@ -39,7 +41,7 @@ sub print_help ();
sub print_usage ();
sub process_arguments ();
$ENV{'PATH'}='';
$ENV{'PATH'}='@TRUSTED_PATH@';
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';
$PROGNAME = "check_mailq";
@ -199,20 +201,20 @@ if ($mailq eq "sendmail") {
## now check the queue length(s)
if ($msg_q == 0) {
$msg = "OK: mailq is empty";
$msg = "OK: $mailq 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)";
$msg = "OK: $mailq 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)";
$msg = "WARNING: $mailq mailq is $msg_q (threshold w = $opt_w)";
$state = $ERRORS{'WARNING'};
}else {
$msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
$msg = "CRITICAL: $mailq mailq is $msg_q (threshold c = $opt_c)";
$state = $ERRORS{'CRITICAL'};
}
@ -344,20 +346,20 @@ elsif ( $mailq eq "postfix" ) {
# check queue length(s)
if ($msg_q == 0){
$msg = "OK: mailq reports queue is empty";
$msg = "OK: $mailq 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)";
$msg = "OK: $mailq 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)";
$msg = "WARNING: $mailq mailq is $msg_q (threshold w = $opt_w)";
$state = $ERRORS{'WARNING'};
}else {
$msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
$msg = "CRITICAL: $mailq mailq is $msg_q (threshold c = $opt_c)";
$state = $ERRORS{'CRITICAL'};
}
@ -373,7 +375,7 @@ elsif ( $mailq eq "postfix" ) {
# }
#}
}
} # end of ($mailq eq "postfixl")
} # end of ($mailq eq "postfix")
elsif ( $mailq eq "qmail" ) {
# open qmail-qstat
@ -431,13 +433,13 @@ elsif ( $mailq eq "qmail" ) {
# overall queue length
if ($msg_q < $opt_w) {
$msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
$msg = "OK: $mailq 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)";
$msg = "WARNING: $mailq mailq is $msg_q (threshold w = $opt_w)";
$state = $ERRORS{'WARNING'};
}else {
$msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
$msg = "CRITICAL: $mailq mailq is $msg_q (threshold c = $opt_c)";
$state = $ERRORS{'CRITICAL'};
}
@ -489,17 +491,54 @@ elsif ( $mailq eq "exim" ) {
exit $ERRORS{CRITICAL};
}
if ($msg_q < $opt_w) {
$msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
$msg = "OK: $mailq 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)";
$msg = "WARNING: $mailq mailq is $msg_q (threshold w = $opt_w)";
$state = $ERRORS{'WARNING'};
}else {
$msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
$msg = "CRITICAL: $mailq mailq is $msg_q (threshold c = $opt_c)";
$state = $ERRORS{'CRITICAL'};
}
} # end of ($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 | " ) ) {
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 (<MAILQ>) {
#2006-06-22 16:00:00 282 bytes
if (/^[1-9][0-9]*-[01][0-9]-[0-3][0-9]\s[0-2][0-9]\:[0-2][0-9]\:[0-2][0-9]\s{2}[0-9]+\sbytes$/) {
$msg_q++ ;
}
}
close(MAILQ) ;
if ($msg_q < $opt_w) {
$msg = "OK: $mailq 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 mailq is $msg_q (threshold w = $opt_w)";
$state = $ERRORS{'WARNING'};
}else {
$msg = "CRITICAL: $mailq mailq is $msg_q (threshold c = $opt_c)";
$state = $ERRORS{'CRITICAL'};
}
} # end of ($mailq eq "nullmailer")
# Perfdata support
print "$msg|unsent=$msg_q;$opt_w;$opt_c;0\n";
exit $state;
@ -559,7 +598,7 @@ sub process_arguments(){
}
if (defined $opt_M) {
if ($opt_M =~ /^(sendmail|qmail|postfix|exim)$/) {
if ($opt_M =~ /^(sendmail|qmail|postfix|exim|nullmailer)$/) {
$mailq = $opt_M ;
}elsif( $opt_M eq ''){
$mailq = 'sendmail';
@ -568,7 +607,30 @@ sub process_arguments(){
exit $ERRORS{'UNKNOWN'};
}
}else{
$mailq = 'sendmail' ;
if (defined $utils::PATH_TO_QMAIL_QSTAT
&& -x $utils::PATH_TO_QMAIL_QSTAT)
{
$mailq = 'qmail';
}
elsif (-d '/var/lib/postfix' || -d '/var/local/lib/postfix'
|| -e '/usr/sbin/postfix' || -e '/usr/local/sbin/postfix')
{
$mailq = 'postfix';
}
elsif (-d '/usr/lib/exim4' || -d '/usr/local/lib/exim4'
|| -e '/usr/sbin/exim' || -e '/usr/local/sbin/exim')
{
$mailq = 'exim';
}
elsif (-d '/usr/lib/nullmailer' || -d '/usr/local/lib/nullmailer'
|| -e '/usr/sbin/nullmailer-send'
|| -e '/usr/local/sbin/nullmailer-send')
{
$mailq = 'nullmailer';
}
else {
$mailq = 'sendmail';
}
}
return $ERRORS{'OK'};
@ -591,7 +653,7 @@ sub print_help () {
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 "-M (--mailserver) = [ sendmail | qmail | postfix | exim | nullmailer ] (default = autodetect)\n";
print "-h (--help)\n";
print "-V (--version)\n";
print "-v (--verbose) = debugging output\n";
@ -599,6 +661,8 @@ sub print_help () {
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 tries to autodetect which mailserver you are running,\n";
print " you can override the autodetection with -M.\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";

View file

@ -1,471 +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.
#
#
# 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 <bo@vircio.com>
# 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 <william@bianca.com>
#
# 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 utils.pm;
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,'@NP_VERSION@');
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"};
}
my $out;
while (<NTPDATE>) {
#print if ($verbose); # noop
$msg = $_ unless ($msg);
$out .= "$_ ";
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 - ";
}
}
}
$out =~ s/\n//g;
close (NTPDATE) ||
die $! ? "$out - Error closing $ntpdate pipe: $!"
: "$out - Exit status: $? from $ntpdate\n";
# 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 (<NTPQ>) {
print $_ if ($verbose);
if ( /timed out/ ){
$have_ntpq = 0 ;
last ;
}
# number of candidates on <host> 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 ||
die $! ? "Error closing $ntpq pipe: $!"
: "Exit status: $? from $ntpq\n";
# 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 <host> [-46] [-O] [-w <warn>] [-c <crit>] [-j <warn>] [-k <crit>] [-v verbose]\n";
}
sub print_help () {
print_revision($PROGNAME,'@NP_VERSION@');
print "Copyright (c) 2003 Bo Kersey/Karl DeBisschop\n";
print "\n";
print_usage();
print "
Checks the local timestamp offset versus <host> with ntpdate
Checks the jitter/dispersion of clock signal between <host> 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();
}

View file

@ -3,12 +3,13 @@
# latigid010@yahoo.com
# 01/06/2000
#
# This Nagios plugin was created to check Oracle status
# This Monitoring plugin was created to check Oracle status
#
PROGNAME=`basename $0`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
REVISION="@NP_VERSION@"
PATH="@TRUSTED_PATH@"
. $PROGPATH/utils.sh
@ -163,7 +164,7 @@ case "$cmd" in
}'
;;
--db)
pmonchk=`ps -ef | grep -v grep | grep -c "ora_pmon_${2}$"`
pmonchk=`ps -ef | grep -v grep | grep -E -c "(asm|ora)_pmon_${2}$"`
if [ ${pmonchk} -ge 1 ] ; then
echo "${2} OK - ${pmonchk} PMON process(es) running"
exit $STATE_OK

View file

@ -1,6 +1,6 @@
#!/usr/local/bin/perl -w
#!@PERL@ -w
#
# check_rpc plugin for nagios
# check_rpc plugin for monitoring
#
# usage:
# check_rpc host service
@ -20,7 +20,9 @@
#
use strict;
use lib utils.pm;
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);
@ -36,9 +38,9 @@ sub print_help ();
sub print_usage ();
sub in ($$);
$ENV{'BASH_ENV'}='';
$ENV{'PATH'}='@TRUSTED_PATH@';
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';
$ENV{'PATH'}='';
$ENV{'LC_ALL'}='C';
#Initialise protocol for each progname number
@ -254,7 +256,7 @@ $proto = 't' if ($opt_t);
$proto = 'u' if ($opt_u);
# Just in case of problems, let's not hang Nagios
# Just in case of problems, let's not hang the monitoring system
$SIG{'ALRM'} = sub {
print ("ERROR: No response from RPC server (alarm)\n");
exit $ERRORS{"UNKNOWN"};

View file

@ -1,14 +1,14 @@
#!/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="@NP_VERSION@"
PATH="@TRUSTED_PATH@"
export PATH
. $PROGPATH/utils.sh
print_usage() {
echo "Usage: $PROGNAME" [--ignore-fault]
}

View file

@ -1,9 +1,11 @@
#!/usr/bin/perl -wT
#!@PERL@ -w
#
use strict;
use lib utils.pm;
use FindBin;
use lib "$FindBin::Bin";
use lib '@libexecdir@';
use utils qw($TIMEOUT %ERRORS &print_revision &support);
use vars qw($PROGNAME);
use Getopt::Long;
@ -15,7 +17,7 @@ $PROGNAME = "check_wave";
sub print_help ();
sub print_usage ();
$ENV{'PATH'}='';
$ENV{'PATH'}='@TRUSTED_PATH@';
$ENV{'BASH_ENV'}='';
$ENV{'ENV'}='';

View file

@ -1,78 +0,0 @@
#!/usr/bin/awk
function which(c,path) {
cmd = "test -x " c;
if (system(cmd)==0) {
return c;
}
sub(/\/.*\//,"",c);
for (dir in path) {
cmd = "test -x " path[dir] "/" c;
if (system(cmd)==0) {
return path[dir] "/" c;
}
}
return c;
}
# used to replace "use lib utils.pm" with "use lib @libexecdir"
#
function led() {
led1 = "@libexecdir@";
led2 = "@exec_prefix@";
led3 = "@prefix@";
if ( match(led1, /^\$\{exec_prefix\}/ ) != 0 ) {
return "\"" led3 "/libexec\" " ;
}
return "\"" led1 "\"" ;
}
BEGIN {
split(ENVIRON["PATH"] ":/sbin:/usr/sbin",path,/:/);
}
# Plugin revision
/@NP_VERSION@/ {sub(/@NP_VERSION@/,ENVIRON["NP_VERSION"]);}
# scripting language (first line)
/^#! ?\/.*\/python/ {sub(/^#! ?\/.*\/python/,"#! @PYTHON@");}
/^#! ?\/.*\/perl/ {sub(/^#! ?\/.*\/perl/,"#! @PERL@");}
/^#! ?\/.*\/[a-z]{0,2}awk/ {sub(/^#! ?\/.*\/[a-z]{0,2}awk/,"#! @AWK@");}
/^#! ?\/.*\/sh/ {sub(/^#! ?\/.*\/sh/,"#! @SHELL@");}
# If a script contains a reference to a fully qualified command,
# subst will replace the fully qualified command with whatever is
# returned from the which subroutine. run before changes to INC to add libexecdir
# FIXME: Prepend executables with a substitution keyword instead.
#
/^[^#]/ && /(\/.*)?\/(bin|sbin|lib|libexec)\// {
match($0,/(\/.*)?\/(bin|sbin|lib|libexec)\/[-_a-zA-Z0-9]+/);
c=substr($0,RSTART,RLENGTH);
sub(c,which(c,path));
}
# add to libexecdir to INC for perl utils.pm
/^use/ { if (/lib/) { if (/utils.pm|"."/ ) {sub(/utils.pm|"."/,led() )} } }
# Trusted path mechanism (deprecated)
/^[ \t]*\$ENV[ \t]*\{[ \t'"]*PATH[ \t"']*\}[ \t]*=/ {
sub(/\=[ \t]*['"][^"']+["']/,"='@with_trusted_path@' # autoconf-derived");
}
/^[\t ]*(export[\t ]*)?PATH[\t ]*=['"]+.+["']$/ {
sub(/\=.*$/,"='@with_trusted_path@' # autoconf-derived");
}
{
print;
}

View file

@ -5,7 +5,7 @@
#
use strict;
use Test::More tests => 15;
use Test::More tests => 16;
use NPTest;
my $successOutput = '/^FILE_AGE OK: /';
@ -57,6 +57,11 @@ $result = NPTest->testCmd(
);
cmp_ok( $result->return_code, '==', 0, "Checking file size" );
$result = NPTest->testCmd(
"./check_file_age -f /non/existent --ignore-missing"
);
cmp_ok( $result->return_code, '==', 0, "Honours --ignore-missing" );
$result = NPTest->testCmd(
"./check_file_age -f $temp_file -c 1000 -W 101"
);

View file

@ -1,6 +1,6 @@
# Utility drawer for Nagios plugins.
# Utility drawer for Monitoring Plugins.
#
# This will be deprecated soon. Please use Nagios::Plugin from CPAN
# This will be deprecated soon. Please use Monitoring::Plugin from CPAN
# for new plugins
package utils;

View file

@ -6,19 +6,13 @@ 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 v$2 (@PACKAGE@ @VERSION@)"
$ECHO "@WARRANTY@" | sed -e 's/\n/ /g'
printf '%b' "@WARRANTY@"
}
support() {
$ECHO "@SUPPORT@" | sed -e 's/\n/ /g'
printf '%b' "@SUPPORT@"
}
#