New upstream version 2.3.2

This commit is contained in:
Jan Wagner 2022-10-19 17:24:24 +02:00
parent 09f4277f49
commit 21323d25dd
104 changed files with 34386 additions and 7430 deletions

View file

@ -1,9 +1,8 @@
# Makefile.in generated by automake 1.11.6 from Makefile.am.
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -15,23 +14,61 @@
@SET_MAKE@
am__make_dryrun = \
{ \
am__dry=no; \
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
test $$am__dry = yes; \
}
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@ -50,8 +87,6 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = plugins-scripts
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/utils.pm.in $(srcdir)/utils.sh.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libcurl.m4 \
$(top_srcdir)/m4/np_mysqlclient.m4 \
@ -154,6 +189,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/libcurl.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = utils.pm utils.sh
@ -187,6 +223,18 @@ am__uninstall_files_from_dir = { \
}
am__installdirs = "$(DESTDIR)$(libexecdir)"
SCRIPTS = $(libexec_SCRIPTS)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
@ -194,8 +242,186 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tty_colors = \
red=; grn=; lgn=; blu=; std=
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
am__tty_colors_dummy = \
mgn= red= grn= lgn= blu= brg= std=; \
am__color_tests=no
am__tty_colors = { \
$(am__tty_colors_dummy); \
if test "X$(AM_COLOR_TESTS)" = Xno; then \
am__color_tests=no; \
elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
am__color_tests=yes; \
elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
am__color_tests=yes; \
fi; \
if test $$am__color_tests = yes; then \
red=''; \
grn=''; \
lgn=''; \
blu=''; \
mgn=''; \
brg=''; \
std=''; \
fi; \
}
am__recheck_rx = ^[ ]*:recheck:[ ]*
am__global_test_result_rx = ^[ ]*:global-test-result:[ ]*
am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]*
# A command that, given a newline-separated list of test names on the
# standard input, print the name of the tests that are to be re-run
# upon "make recheck".
am__list_recheck_tests = $(AWK) '{ \
recheck = 1; \
while ((rc = (getline line < ($$0 ".trs"))) != 0) \
{ \
if (rc < 0) \
{ \
if ((getline line2 < ($$0 ".log")) < 0) \
recheck = 0; \
break; \
} \
else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
{ \
recheck = 0; \
break; \
} \
else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
{ \
break; \
} \
}; \
if (recheck) \
print $$0; \
close ($$0 ".trs"); \
close ($$0 ".log"); \
}'
# A command that, given a newline-separated list of test names on the
# standard input, create the global log from their .trs and .log files.
am__create_global_log = $(AWK) ' \
function fatal(msg) \
{ \
print "fatal: making $@: " msg | "cat >&2"; \
exit 1; \
} \
function rst_section(header) \
{ \
print header; \
len = length(header); \
for (i = 1; i <= len; i = i + 1) \
printf "="; \
printf "\n\n"; \
} \
{ \
copy_in_global_log = 1; \
global_test_result = "RUN"; \
while ((rc = (getline line < ($$0 ".trs"))) != 0) \
{ \
if (rc < 0) \
fatal("failed to read from " $$0 ".trs"); \
if (line ~ /$(am__global_test_result_rx)/) \
{ \
sub("$(am__global_test_result_rx)", "", line); \
sub("[ ]*$$", "", line); \
global_test_result = line; \
} \
else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
copy_in_global_log = 0; \
}; \
if (copy_in_global_log) \
{ \
rst_section(global_test_result ": " $$0); \
while ((rc = (getline line < ($$0 ".log"))) != 0) \
{ \
if (rc < 0) \
fatal("failed to read from " $$0 ".log"); \
print line; \
}; \
printf "\n"; \
}; \
close ($$0 ".trs"); \
close ($$0 ".log"); \
}'
# Restructured Text title.
am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
# Solaris 10 'make', and several other traditional 'make' implementations,
# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it
# by disabling -e (using the XSI extension "set +e") if it's set.
am__sh_e_setup = case $$- in *e*) set +e;; esac
# Default flags passed to test drivers.
am__common_driver_flags = \
--color-tests "$$am__color_tests" \
--enable-hard-errors "$$am__enable_hard_errors" \
--expect-failure "$$am__expect_failure"
# To be inserted before the command running the test. Creates the
# directory for the log if needed. Stores in $dir the directory
# containing $f, in $tst the test, in $log the log. Executes the
# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
# passes TESTS_ENVIRONMENT. Set up options for the wrapper that
# will run the test scripts (or their associated LOG_COMPILER, if
# thy have one).
am__check_pre = \
$(am__sh_e_setup); \
$(am__vpath_adj_setup) $(am__vpath_adj) \
$(am__tty_colors); \
srcdir=$(srcdir); export srcdir; \
case "$@" in \
*/*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \
*) am__odir=.;; \
esac; \
test "x$$am__odir" = x"." || test -d "$$am__odir" \
|| $(MKDIR_P) "$$am__odir" || exit $$?; \
if test -f "./$$f"; then dir=./; \
elif test -f "$$f"; then dir=; \
else dir="$(srcdir)/"; fi; \
tst=$$dir$$f; log='$@'; \
if test -n '$(DISABLE_HARD_ERRORS)'; then \
am__enable_hard_errors=no; \
else \
am__enable_hard_errors=yes; \
fi; \
case " $(XFAIL_TESTS) " in \
*[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \
am__expect_failure=yes;; \
*) \
am__expect_failure=no;; \
esac; \
$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
# A shell command to get the names of the tests scripts with any registered
# extension removed (i.e., equivalently, the names of the test logs, with
# the '.log' extension removed). The result is saved in the shell variable
# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
# since that might cause problem with VPATH rewrites for suffix-less tests.
# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
am__set_TESTS_bases = \
bases='$(TEST_LOGS)'; \
bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
bases=`echo $$bases`
AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)'
RECHECK_LOGS = $(TEST_LOGS)
AM_RECURSIVE_TARGETS = check recheck
TEST_SUITE_LOG = test-suite.log
TEST_EXTENSIONS = @EXEEXT@ .test
am__test_logs1 = $(TESTS:=.log)
am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
TEST_LOGS = $(am__test_logs2:.test.log=.log)
TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver
TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
$(TEST_LOG_FLAGS)
am__set_b = \
case '$@' in \
*/*) \
case '$*' in \
*/*) b='$*';; \
*) b=`echo '$@' | sed 's/\.log$$//'`; \
esac;; \
*) \
b='$*';; \
esac
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/utils.pm.in \
$(srcdir)/utils.sh.in $(top_srcdir)/build-aux/mkinstalldirs \
$(top_srcdir)/build-aux/test-driver
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
VPATH = $(top_srcdir) $(top_srcdir)/plugins-scripts $(top_srcdir)/plugins-scripts/t
pkglibexecdir = @pkglibexecdir@
@ -203,6 +429,7 @@ ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
ALLOCA_H = @ALLOCA_H@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@
AR = @AR@
ARFLAGS = @ARFLAGS@
@ -1328,6 +1555,7 @@ pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
@ -1363,7 +1591,7 @@ CLEANFILES = $(libexec_SCRIPTS)
all: all-am
.SUFFIXES:
.SUFFIXES: .pl .sh
.SUFFIXES: .pl .sh .log .test .test$(EXEEXT) .trs
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
@ -1376,14 +1604,13 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins-scripts/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu plugins-scripts/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@ -1439,107 +1666,173 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
tags: TAGS
TAGS:
tags TAGS:
ctags: CTAGS
CTAGS:
ctags CTAGS:
cscope cscopelist:
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
list=' $(TESTS) '; \
$(am__tty_colors); \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*[\ \ ]$$tst[\ \ ]*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
col=$$red; res=XPASS; \
;; \
*) \
col=$$grn; res=PASS; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*[\ \ ]$$tst[\ \ ]*) \
xfail=`expr $$xfail + 1`; \
col=$$lgn; res=XFAIL; \
;; \
*) \
failed=`expr $$failed + 1`; \
col=$$red; res=FAIL; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
col=$$blu; res=SKIP; \
fi; \
echo "$${col}$$res$${std}: $$tst"; \
# Recover from deleted '.trs' file; this should ensure that
# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells
# to avoid problems with "make -n".
.log.trs:
rm -f $< $@
$(MAKE) $(AM_MAKEFLAGS) $<
# Leading 'am--fnord' is there to ensure the list of targets does not
# expand to empty, as could happen e.g. with make check TESTS=''.
am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
am--force-recheck:
@:
$(TEST_SUITE_LOG): $(TEST_LOGS)
@$(am__set_TESTS_bases); \
am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
redo_bases=`for i in $$bases; do \
am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
done`; \
if test -n "$$redo_bases"; then \
redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
if $(am__make_dryrun); then :; else \
rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
fi; \
fi; \
if test -n "$$am__remaking_logs"; then \
echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
"recursion detected" >&2; \
elif test -n "$$redo_logs"; then \
am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
fi; \
if $(am__make_dryrun); then :; else \
st=0; \
errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
for i in $$redo_bases; do \
test -f $$i.trs && test -r $$i.trs \
|| { echo "$$errmsg $$i.trs" >&2; st=1; }; \
test -f $$i.log && test -r $$i.log \
|| { echo "$$errmsg $$i.log" >&2; st=1; }; \
done; \
if test "$$all" -eq 1; then \
tests="test"; \
All=""; \
else \
tests="tests"; \
All="All "; \
fi; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="$$All$$all $$tests passed"; \
test $$st -eq 0 || exit 1; \
fi
@$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
ws='[ ]'; \
results=`for b in $$bases; do echo $$b.trs; done`; \
test -n "$$results" || results=/dev/null; \
all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \
fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \
skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \
xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
if test `expr $$fail + $$xpass + $$error` -eq 0; then \
success=true; \
else \
success=false; \
fi; \
br='==================='; br=$$br$$br$$br$$br; \
result_count () \
{ \
if test x"$$1" = x"--maybe-color"; then \
maybe_colorize=yes; \
elif test x"$$1" = x"--no-color"; then \
maybe_colorize=no; \
else \
if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
echo "$@: invalid 'result_count' usage" >&2; exit 4; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all $$tests failed"; \
shift; \
desc=$$1 count=$$2; \
if test $$maybe_colorize = yes && test $$count -gt 0; then \
color_start=$$3 color_end=$$std; \
else \
if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
color_start= color_end=; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
if test "$$skip" -eq 1; then \
skipped="($$skip test was not run)"; \
else \
skipped="($$skip tests were not run)"; \
fi; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
if test "$$failed" -eq 0; then \
col="$$grn"; \
else \
col="$$red"; \
fi; \
echo "$${col}$$dashes$${std}"; \
echo "$${col}$$banner$${std}"; \
test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
test -z "$$report" || echo "$${col}$$report$${std}"; \
echo "$${col}$$dashes$${std}"; \
test "$$failed" -eq 0; \
else :; fi
echo "$${color_start}# $$desc $$count$${color_end}"; \
}; \
create_testsuite_report () \
{ \
result_count $$1 "TOTAL:" $$all "$$brg"; \
result_count $$1 "PASS: " $$pass "$$grn"; \
result_count $$1 "SKIP: " $$skip "$$blu"; \
result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
result_count $$1 "FAIL: " $$fail "$$red"; \
result_count $$1 "XPASS:" $$xpass "$$red"; \
result_count $$1 "ERROR:" $$error "$$mgn"; \
}; \
{ \
echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
$(am__rst_title); \
create_testsuite_report --no-color; \
echo; \
echo ".. contents:: :depth: 2"; \
echo; \
for b in $$bases; do echo $$b; done \
| $(am__create_global_log); \
} >$(TEST_SUITE_LOG).tmp || exit 1; \
mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
if $$success; then \
col="$$grn"; \
else \
col="$$red"; \
test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
fi; \
echo "$${col}$$br$${std}"; \
echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \
echo "$${col}$$br$${std}"; \
create_testsuite_report --maybe-color; \
echo "$$col$$br$$std"; \
if $$success; then :; else \
echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \
if test -n "$(PACKAGE_BUGREPORT)"; then \
echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
fi; \
echo "$$col$$br$$std"; \
fi; \
$$success || exit 1
distdir: $(DISTFILES)
check-TESTS:
@list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
@list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@set +e; $(am__set_TESTS_bases); \
log_list=`for i in $$bases; do echo $$i.log; done`; \
trs_list=`for i in $$bases; do echo $$i.trs; done`; \
log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
exit $$?;
recheck: all
@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@set +e; $(am__set_TESTS_bases); \
bases=`for i in $$bases; do echo $$i; done \
| $(am__list_recheck_tests)` || exit 1; \
log_list=`for i in $$bases; do echo $$i.log; done`; \
log_list=`echo $$log_list`; \
$(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
am__force_recheck=am--force-recheck \
TEST_LOGS="$$log_list"; \
exit $$?
.test.log:
@p='$<'; \
$(am__set_b); \
$(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
@am__EXEEXT_TRUE@.test$(EXEEXT).log:
@am__EXEEXT_TRUE@ @p='$<'; \
@am__EXEEXT_TRUE@ $(am__set_b); \
@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@ -1597,6 +1890,9 @@ install-strip:
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
-test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
-test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
-test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
@ -1677,17 +1973,19 @@ uninstall-am: uninstall-libexecSCRIPTS
.MAKE: check-am install-am install-strip
.PHONY: all all-am check check-TESTS check-am clean clean-generic \
clean-libtool clean-local distclean distclean-generic \
distclean-libtool distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am \
install-libexecSCRIPTS install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
clean-libtool clean-local cscopelist-am ctags-am distclean \
distclean-generic distclean-libtool distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-libexecSCRIPTS install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
uninstall-libexecSCRIPTS
mostlyclean-libtool pdf pdf-am ps ps-am recheck tags-am \
uninstall uninstall-am uninstall-libexecSCRIPTS
.PRECIOUS: Makefile
@RELEASE_PRESENT_FALSE@NP-VERSION-FILE: .FORCE-NP-VERSION-FILE
@RELEASE_PRESENT_FALSE@ @$(SHELL_PATH) $(top_srcdir)/NP-VERSION-GEN

21
plugins-scripts/check_disk_smb.pl Executable file → Normal file
View file

@ -22,7 +22,7 @@ require 5.004;
use POSIX qw(setsid);
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($opt_P $opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $opt_a $opt_C $opt_t $verbose);
use vars qw($PROGNAME);
use FindBin;
use lib "$FindBin::Bin";
@ -43,6 +43,7 @@ $ENV{'ENV'}='';
Getopt::Long::Configure('bundling');
GetOptions
("v" => \$verbose, "verbose" => \$verbose,
"t=i" => \$opt_t, "timeout=i" => \$opt_t,
"P=s" => \$opt_P, "port=s" => \$opt_P,
"V" => \$opt_V, "version" => \$opt_V,
"h" => \$opt_h, "help" => \$opt_h,
@ -53,7 +54,8 @@ GetOptions
"s=s" => \$opt_s, "share=s" => \$opt_s,
"W=s" => \$opt_W, "workgroup=s" => \$opt_W,
"H=s" => \$opt_H, "hostname=s" => \$opt_H,
"a=s" => \$opt_a, "address=s" => \$opt_a);
"a=s" => \$opt_a, "address=s" => \$opt_a,
"C=s" => \$opt_C, "configfile=s" => \$opt_C);
if ($opt_V) {
print_revision($PROGNAME,'@NP_VERSION@'); #'
@ -91,6 +93,12 @@ my $warn = $1 if ($opt_w =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/);
my $crit = $1 if ($opt_c =~ /^([0-9]{1,2}\%?|100\%?|[0-9]+[kMG])$/);
($crit) || usage("Invalid critical threshold: $opt_c\n");
($opt_C) || ($opt_C = shift @ARGV) || ($opt_C = "");
my $configfile = $opt_C if ($opt_C);
usage("Unable to read config file $configfile\n") if ($configfile) && (! -r $configfile);
if ($opt_t && $opt_t =~ /^([0-9]+)$/) { $TIMEOUT = $1; }
# Execute the given command line and return anything it writes to STDOUT and/or
# STDERR. (This might be useful for other plugins, too, so it should possibly
# be moved to utils.pm.)
@ -193,6 +201,7 @@ my @cmd = (
defined($workgroup) ? ("-W", $workgroup) : (),
defined($address) ? ("-I", $address) : (),
defined($opt_P) ? ("-p", $opt_P) : (),
defined($configfile) ? ("-s", $configfile) : (),
"-c", "du"
);
@ -292,7 +301,8 @@ exit $ERRORS{$state};
sub print_usage () {
print "Usage: $PROGNAME -H <host> -s <share> -u <user> -p <password>
-w <warn> -c <crit> [-W <workgroup>] [-P <port>] [-a <IP>]\n";
-w <warn> -c <crit> [-W <workgroup>] [-P <port>] [-a <IP>] [-t timeout]
[-C <configfile>]\n";
}
sub print_help () {
@ -318,11 +328,14 @@ Perl Check SMB Disk plugin for monitoring
Password to log in to server. (Defaults to an empty password)
-w, --warning=INTEGER or INTEGER[kMG]
Percent of used space at which a warning will be generated (Default: 85%)
-c, --critical=INTEGER or INTEGER[kMG]
Percent of used space at which a critical will be generated (Defaults: 95%)
-t, --timeout=INTEGER
Seconds before connection times out (Default: 15)
-P, --port=INTEGER
Port to be used to connect to. Some Windows boxes use 139, others 445 (Defaults to smbclient default)
-C, --configfile=STRING
Path to configfile which should be used by smbclient (Defaults to smb.conf of your smb installation)
If thresholds are followed by either a k, M, or G then check to see if that
much disk space is available (kilobytes, Megabytes, Gigabytes)

View file

@ -147,7 +147,7 @@ sub print_help () {
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\n";
print " <size> File must be at least this many bytes long (default: file size is ignored (0 bytes))\n\n";
print " Both <secs> and <size> can specify a range using the standard plugin syntax\n";
print " If any of the warning and critical arguments are in range syntax (not just bare numbers)\n";
print " then all warning and critical arguments will be interpreted as ranges.\n";

View file

@ -124,10 +124,10 @@ if (!defined($session)) {
## map ifdescr to ifindex - should look at being able to cache this value
if (defined $ifdescr || defined $iftype) {
# escape "/" in ifdescr - very common in the Cisco world
if (defined $iftype) {
$status=fetch_ifindex($snmpIfType, $iftype);
} else {
# escape "/" in ifdescr - very common in the Cisco world
$ifdescr =~ s/\//\\\//g;
$status=fetch_ifindex($snmpIfDescr, $ifdescr); # if using on device with large number of interfaces
# recommend use of SNMP v2 (get-bulk)

View file

@ -69,7 +69,9 @@ $ENV{'ENV'}='';
# -----------------------------------------------------------------[ Global ]--
$PROGNAME = "check_ircd";
my $NICK="ircd$$";
# nickname shouldn't be longer than 9 chars, this might happen with large PIDs
# To prevent this, we cut of the part over 10000
my $NICK="ircd" . $$ % 10000;
my $USER_INFO="monitor localhost localhost : ";
# -------------------------------------------------------------[ connection ]--

View file

@ -1,8 +1,7 @@
#!/bin/sh
#
# Log file pattern detector plugin for monitoring
# Written by Ethan Galstad (nagios@nagios.org)
# Last Modified: 07-31-1999
# Written originally by Ethan Galstad (nagios@nagios.org)
#
# Usage: ./check_log <log_file> <old_log_file> <pattern>
#
@ -44,6 +43,10 @@
# check the same <log_file> for pattern matches. This is necessary
# because of the way the script operates.
#
# 4. This plugin does NOT have an understanding of logrotation or similar
# mechanisms. Therefore bad timing could lead to missing events
#
#
# Examples:
#
# Check for login failures in the syslog...
@ -60,20 +63,25 @@
PATH="@TRUSTED_PATH@"
export PATH
PROGNAME=`basename $0`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
PROGNAME=$(basename "$0")
PROGPATH=$(echo "$0" | sed -e 's,[\\/][^\\/][^\\/]*$,,')
REVISION="@NP_VERSION@"
. $PROGPATH/utils.sh
. "$PROGPATH"/utils.sh
print_usage() {
echo "Usage: $PROGNAME -F logfile -O oldlog -q query"
echo "Usage: $PROGNAME --help"
echo "Usage: $PROGNAME --version"
echo ""
echo "Other parameters:"
echo " -a|--all : Print all matching lines"
echo " -p|--perl-regex : Use perl style regular expressions in the query"
echo " -e|--extended-regex : Use extended style regular expressions in the query (not necessary for GNU grep)"
}
print_help() {
print_revision $PROGNAME $REVISION
print_revision "$PROGNAME" "$REVISION"
echo ""
print_usage
echo ""
@ -87,7 +95,7 @@ print_help() {
if [ $# -lt 1 ]; then
print_usage
exit $STATE_UNKNOWN
exit "$STATE_UNKNOWN"
fi
# Grab the command line arguments
@ -100,79 +108,123 @@ while test -n "$1"; do
case "$1" in
--help)
print_help
exit $STATE_OK
exit "$STATE_OK"
;;
-h)
print_help
exit $STATE_OK
exit "$STATE_OK"
;;
--version)
print_revision $PROGNAME $REVISION
exit $STATE_OK
print_revision "$PROGNAME" "$REVISION"
exit "$STATE_OK"
;;
-V)
print_revision $PROGNAME $REVISION
exit $STATE_OK
print_revision "$PROGNAME" "$REVISION"
exit "$STATE_OK"
;;
--filename)
logfile=$2
shift
shift 2
;;
-F)
logfile=$2
shift
shift 2
;;
--oldlog)
oldlog=$2
shift
shift 2
;;
-O)
oldlog=$2
shift
shift 2
;;
--query)
query=$2
shift
shift 2
;;
-q)
query=$2
shift
shift 2
;;
-x)
exitstatus=$2
shift
shift 2
;;
--exitstatus)
exitstatus=$2
shift 2
;;
--extended-regex)
ERE=1
shift
;;
-e)
ERE=1
shift
;;
--perl-regex)
PRE=1
shift
;;
-p)
PRE=1
shift
;;
--all)
ALL=1
shift
;;
-a)
ALL=1
shift
;;
*)
echo "Unknown argument: $1"
print_usage
exit $STATE_UNKNOWN
exit "$STATE_UNKNOWN"
;;
esac
shift
done
# Parameter sanity check
if [ $ERE ] && [ $PRE ] ; then
echo "Can not use extended and perl regex at the same time"
exit "$STATE_UNKNOWN"
fi
GREP="grep"
if [ $ERE ]; then
GREP="grep -E"
fi
if [ $PRE ]; then
GREP="grep -P"
fi
# If the source log file doesn't exist, exit
if [ ! -e $logfile ]; then
if [ ! -e "$logfile" ]; then
echo "Log check error: Log file $logfile does not exist!"
exit $STATE_UNKNOWN
elif [ ! -r $logfile ] ; then
exit "$STATE_UNKNOWN"
elif [ ! -r "$logfile" ] ; then
echo "Log check error: Log file $logfile is not readable!"
exit $STATE_UNKNOWN
exit "$STATE_UNKNOWN"
fi
# If no oldlog was given this can not work properly, abort then
if [ -z "$oldlog" ]; then
echo "Oldlog parameter is needed"
exit $STATE_UNKNOWN
fi
# If the old log file doesn't exist, this must be the first time
# we're running this test, so copy the original log file over to
# the old diff file and exit
if [ ! -e $oldlog ]; then
cat $logfile > $oldlog
if [ ! -e "$oldlog" ]; then
cat "$logfile" > "$oldlog"
echo "Log check data initialized..."
exit $STATE_OK
exit "$STATE_OK"
fi
# The old log file exists, so compare it to the original log now
@ -180,31 +232,42 @@ fi
# The temporary file that the script should use while
# processing the log file.
if [ -x /bin/mktemp ]; then
tempdiff=`/bin/mktemp /tmp/check_log.XXXXXXXXXX`
tempdiff=$(/bin/mktemp /tmp/check_log.XXXXXXXXXX)
else
tempdiff=`/bin/date '+%H%M%S'`
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`
# Get the last matching entry in the diff file
lastentry=`grep "$query" $tempdiff | tail -1`
if [ $ALL ]; then
# Get the last matching entry in the diff file
entry=$($GREP "$query" "$tempdiff")
rm -f $tempdiff
cat $logfile > $oldlog
# Count the number of matching log entries we have
count=$(echo "$entry" | wc -l)
else
# Count the number of matching log entries we have
count=$($GREP -c "$query" "$tempdiff")
# Get the last matching entry in the diff file
entry=$($GREP "$query" "$tempdiff" | tail -1)
fi
rm -f "$tempdiff"
cat "$logfile" > "$oldlog"
if [ "$count" = "0" ]; then # no matches, exit with no error
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"
else # Print total match count and the last entry we found
echo "($count) $entry"
exitstatus=$STATE_CRITICAL
fi
exit $exitstatus
exit "$exitstatus"

View file

@ -28,9 +28,9 @@
use POSIX;
use strict;
use Getopt::Long;
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 vars qw($opt_V $opt_h $opt_v $verbose $PROGNAME $opt_w $opt_c $opt_t $opt_s $opt_d
$opt_M $mailq $status $state $msg $msg_q $msg_p $opt_W $opt_C $mailq $mailq_args
@lines %srcdomains %dstdomains);
use FindBin;
use lib "$FindBin::Bin";
use utils qw(%ERRORS &print_revision &support &usage );
@ -48,6 +48,8 @@ $PROGNAME = "check_mailq";
$mailq = 'sendmail'; # default
$msg_q = 0 ;
$msg_p = 0 ;
# If appended, must start with a space
$mailq_args = '' ;
$state = $ERRORS{'UNKNOWN'};
Getopt::Long::Configure('bundling');
@ -68,6 +70,10 @@ if ($opt_s) {
$sudo = "";
}
if ($opt_d) {
$mailq_args = $mailq_args . ' -C ' . $opt_d;
}
$SIG{'ALRM'} = sub {
print ("ERROR: timed out waiting for $utils::PATH_TO_MAILQ \n");
exit $ERRORS{"WARNING"};
@ -309,8 +315,8 @@ elsif ( $mailq eq "postfix" ) {
## open mailq
if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
if (! open (MAILQ, "$sudo $utils::PATH_TO_MAILQ | " ) ) {
print "ERROR: could not open $utils::PATH_TO_MAILQ \n";
if (! open (MAILQ, "$sudo $utils::PATH_TO_MAILQ$mailq_args | " ) ) {
print "ERROR: could not open $utils::PATH_TO_MAILQ$mailq_args \n";
exit $ERRORS{'UNKNOWN'};
}
}elsif( defined $utils::PATH_TO_MAILQ){
@ -330,7 +336,7 @@ elsif ( $mailq eq "postfix" ) {
close MAILQ;
if ( $? ) {
print "CRITICAL: Error code ".($?>>8)." returned from $utils::PATH_TO_MAILQ",$/;
print "CRITICAL: Error code ".($?>>8)." returned from $utils::PATH_TO_MAILQ$mailq_args",$/;
exit $ERRORS{CRITICAL};
}
@ -343,7 +349,7 @@ elsif ( $mailq eq "postfix" ) {
}elsif ($lines[0]=~/Mail queue is empty/) {
$msg_q = 0;
}else{
print "Couldn't match $utils::PATH_TO_MAILQ output\n";
print "Couldn't match $utils::PATH_TO_MAILQ$mailq_args output\n";
exit $ERRORS{'UNKNOWN'};
}
@ -533,7 +539,7 @@ elsif ( $mailq eq "nullmailer" ) {
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$/) {
if (/^[1-9][0-9]*-[01][0-9]-[0-3][0-9]\s[0-2][0-9]\:[0-5][0-9]\:[0-5][0-9]\s+[0-9]+\sbytes/) {
$msg_q++ ;
}
}
@ -561,16 +567,17 @@ exit $state;
sub process_arguments(){
GetOptions
("V" => \$opt_V, "version" => \$opt_V,
"v" => \$opt_v, "verbose" => \$opt_v,
"h" => \$opt_h, "help" => \$opt_h,
("V" => \$opt_V, "version" => \$opt_V,
"v" => \$opt_v, "verbose" => \$opt_v,
"h" => \$opt_h, "help" => \$opt_h,
"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
"c=i" => \$opt_c, "critical=i" => \$opt_c, # critical if above this number
"W=i" => \$opt_W, "warning-domain=i" => \$opt_W, # Warning if above this number
"C=i" => \$opt_C, "critical-domain=i" => \$opt_C, # Critical if above this number
"t=i" => \$opt_t, "timeout=i" => \$opt_t,
"s" => \$opt_s, "sudo" => \$opt_s,
"W=i" => \$opt_W, # warning if above this number
"C=i" => \$opt_C, # critical if above this number
"d:s" => \$opt_d, "configdir:s" => \$opt_d,
);
if ($opt_V) {
@ -651,7 +658,7 @@ sub process_arguments(){
}
sub print_usage () {
print "Usage: $PROGNAME -w <warn> -c <crit> [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-s] [-v]\n";
print "Usage: $PROGNAME -w <warn> -c <crit> [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-s] [-d <CONFIGDIR>] [-v]\n";
}
sub print_help () {
@ -664,14 +671,15 @@ sub print_help () {
print " Feedback/patches to support non-sendmail mailqueue welcome\n\n";
print "-w (--warning) = Min. number of messages in queue to generate warning\n";
print "-c (--critical) = Min. number of messages in queue to generate critical alert ( w < c )\n";
print "-W = Min. number of messages for same domain in queue to generate warning\n";
print "-C = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n";
print "-W (--warning-domain) = Min. number of messages for same domain in queue to generate warning\n";
print "-C (--critical-domain) = 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 "-d (--configdir) = Config file or directory\n";
print "-h (--help)\n";
print "-V (--version)\n";
print "-v (--verbose) = debugging output\n";
print "-v (--verbose) = debugging output\n";
print "\n\n";
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";

View file

@ -8,11 +8,11 @@
PATH="@TRUSTED_PATH@"
export PATH
PROGNAME=`basename $0`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
PROGNAME=$(basename "$0")
PROGPATH=$(echo "$0" | sed -e 's,[\\/][^\\/][^\\/]*$,,')
REVISION="@NP_VERSION@"
. $PROGPATH/utils.sh
. "$PROGPATH"/utils.sh
print_usage() {
@ -29,7 +29,7 @@ print_usage() {
}
print_help() {
print_revision $PROGNAME $REVISION
print_revision "$PROGNAME" "$REVISION"
echo ""
print_usage
echo ""
@ -87,47 +87,47 @@ esac
case "$cmd" in
--help)
print_help
exit $STATE_OK
exit "$STATE_OK"
;;
-h)
print_help
exit $STATE_OK
exit "$STATE_OK"
;;
--version)
print_revision $PROGNAME $REVISION
exit $STATE_OK
print_revision "$PROGNAME" "$REVISION"
exit "$STATE_OK"
;;
-V)
print_revision $PROGNAME $REVISION
exit $STATE_OK
print_revision "$PROGNAME" "$REVISION"
exit "$STATE_OK"
;;
esac
# Hunt down a reasonable ORACLE_HOME
if [ -z "$ORACLE_HOME" ] ; then
# Adjust to taste
for oratab in /var/opt/oracle/oratab /etc/oratab
do
[ ! -f $oratab ] && continue
ORACLE_HOME=`IFS=:
while read SID ORACLE_HOME junk;
do
if [ "$SID" = "$2" -o "$SID" = "*" ] ; then
echo $ORACLE_HOME;
exit;
fi;
done < $oratab`
[ -n "$ORACLE_HOME" ] && break
done
# Adjust to taste
for oratab in /var/opt/oracle/oratab /etc/oratab
do
[ ! -f $oratab ] && continue
ORACLE_HOME=`IFS=:
while read -r SID ORACLE_HOME junk;
do
if [ "$SID" = "$2" ] || [ "$SID" = "*" ] ; then
echo "$ORACLE_HOME";
exit;
fi;
done < $oratab`
[ -n "$ORACLE_HOME" ] && break
done
fi
# Last resort
[ -z "$ORACLE_HOME" -a -d $PROGPATH/oracle ] && ORACLE_HOME=$PROGPATH/oracle
[ -z "$ORACLE_HOME" ] && [ -d "$PROGPATH"/oracle ] && ORACLE_HOME=$PROGPATH/oracle
if [ "$cmd" != "--db" ]; then
if [ -z "$ORACLE_HOME" -o ! -d "$ORACLE_HOME" ] ; then
echo "Cannot determine ORACLE_HOME for sid $2"
exit $STATE_UNKNOWN
fi
if [ -z "$ORACLE_HOME" ] || [ ! -d "$ORACLE_HOME" ] ; then
echo "Cannot determine ORACLE_HOME for sid $2"
exit "$STATE_UNKNOWN"
fi
fi
PATH=$PATH:$ORACLE_HOME/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
@ -135,81 +135,81 @@ export ORACLE_HOME PATH LD_LIBRARY_PATH
case "$cmd" in
--tns)
tnschk=` tnsping $2`
tnschk2=` echo $tnschk | grep -c OK`
if [ ${tnschk2} -eq 1 ] ; then
tnschk3=${tnschk##*(}; tnschk3=${tnschk3%)*}
echo "OK - reply time ${tnschk3} from $2"
exit $STATE_OK
tnschk=$(tnsping "$2")
tnschk2=$(echo "$tnschk" | grep -c OK)
if [ "${tnschk2}" -eq 1 ] ; then
tnschk3=${tnschk##*(}; tnschk3=${tnschk3%)*}
echo "OK - reply time ${tnschk3} from $2"
exit "$STATE_OK"
else
echo "No TNS Listener on $2"
exit $STATE_CRITICAL
echo "No TNS Listener on $2"
exit "$STATE_CRITICAL"
fi
;;
--oranames)
namesctl status $2 | awk '
namesctl status "$2" | awk '
/Server has been running for:/ {
msg = "OK: Up"
for (i = 6; i <= NF; i++) {
msg = msg " " $i
}
status = '$STATE_OK'
msg = "OK: Up"
for (i = 6; i <= NF; i++) {
msg = msg " " $i
}
status = '"$STATE_OK"'
}
/error/ {
msg = "CRITICAL: " $0
status = '$STATE_CRITICAL'
msg = "CRITICAL: " $0
status = '"$STATE_CRITICAL"'
}
END {
print msg
exit status
print msg
exit status
}'
;;
--db)
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
pmonchk=$(pgrep -f "(asm|ora)_pmon_${2}$")
if [ "${pmonchk}" -ge 1 ] ; then
echo "${2} OK - ${pmonchk} PMON process(es) running"
exit "$STATE_OK"
#if [ -f $ORACLE_HOME/dbs/sga*${2}* ] ; then
#if [ ${pmonchk} -eq 1 ] ; then
#if [ ${pmonchk} -eq 1 ] ; then
#utime=`ls -la $ORACLE_HOME/dbs/sga*$2* | cut -c 43-55`
#echo "${2} OK - running since ${utime}"
#exit $STATE_OK
#fi
#echo "${2} OK - running since ${utime}"
#exit $STATE_OK
#fi
else
echo "${2} Database is DOWN"
exit $STATE_CRITICAL
echo "${2} Database is DOWN"
exit "$STATE_CRITICAL"
fi
;;
--login)
loginchk=`sqlplus dummy/user@$2 < /dev/null`
loginchk2=` echo $loginchk | grep -c ORA-01017`
if [ ${loginchk2} -eq 1 ] ; then
echo "OK - dummy login connected"
exit $STATE_OK
loginchk=$(sqlplus dummy/user@"$2" < /dev/null)
loginchk2=$(echo "$loginchk" | grep -c ORA-01017)
if [ "${loginchk2}" -eq 1 ] ; then
echo "OK - dummy login connected"
exit "$STATE_OK"
else
loginchk3=` echo "$loginchk" | grep "ORA-" | head -1`
echo "CRITICAL - $loginchk3"
exit $STATE_CRITICAL
loginchk3=$(echo "$loginchk" | grep "ORA-" | head -1)
echo "CRITICAL - $loginchk3"
exit "$STATE_CRITICAL"
fi
;;
--connect)
connectchk=`sqlplus $2 < /dev/null`
connectchk2=` echo $connectchk | grep -c ORA-`
if [ ${connectchk2} -eq 0 ] ; then
echo "OK - login successful"
exit $STATE_OK
connectchk=$(sqlplus "$2" < /dev/null)
connectchk2=$(echo "$connectchk" | grep -c ORA-)
if [ "${connectchk2}" -eq 0 ] ; then
echo "OK - login successful"
exit "$STATE_OK"
else
connectchk3=` echo "$connectchk" | grep "ORA-" | head -1`
echo "CRITICAL - $connectchk3"
exit $STATE_CRITICAL
connectchk3=$(echo "$connectchk" | grep "ORA-" | head -1)
echo "CRITICAL - $connectchk3"
exit "$STATE_CRITICAL"
fi
;;
--cache)
if [ ${5} -gt ${6} ] ; then
echo "UNKNOWN - Warning level is less then Crit"
exit $STATE_UNKNOWN
if [ "${5}" -gt "${6}" ] ; then
echo "UNKNOWN - Warning level is less then Crit"
exit "$STATE_UNKNOWN"
fi
result=`sqlplus -s ${3}/${4}@${2} << EOF
result=`sqlplus -s "${3}"/"${4}"@"${2}" << EOF
set pagesize 0
set numf '9999999.99'
select (1-(pr.value/(dbg.value+cg.value)))*100
@ -219,48 +219,48 @@ and dbg.name='db block gets'
and cg.name='consistent gets';
EOF`
if [ -n "`echo $result | grep ORA-`" ] ; then
error=` echo "$result" | grep "ORA-" | head -1`
echo "CRITICAL - $error"
exit $STATE_CRITICAL
if echo "$result" | grep -q 'ORA-' ; then
error=$(echo "$result" | grep "ORA-" | head -1)
echo "CRITICAL - $error"
exit "$STATE_CRITICAL"
fi
buf_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'`
buf_hrx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'`
result=`sqlplus -s ${3}/${4}@${2} << EOF
buf_hr=$(echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}')
buf_hrx=$(echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}')
result=`sqlplus -s "${3}"/"${4}"@"${2}" << EOF
set pagesize 0
set numf '9999999.99'
select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100
from v\\$librarycache lc;
EOF`
if [ -n "`echo $result | grep ORA-`" ] ; then
error=` echo "$result" | grep "ORA-" | head -1`
echo "CRITICAL - $error"
exit $STATE_CRITICAL
if echo "$result" | grep -q 'ORA-' ; then
error=$(echo "$result" | grep "ORA-" | head -1)
echo "CRITICAL - $error"
exit "$STATE_CRITICAL"
fi
lib_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'`
lib_hrx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'`
lib_hr=$(echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}')
lib_hrx=$(echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}')
if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then
echo "${2} CRITICAL - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100"
exit $STATE_CRITICAL
if [ "$buf_hr" -le "${5}" ] || [ "$lib_hr" -le "${5}" ] ; then
echo "${2} CRITICAL - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100"
exit "$STATE_CRITICAL"
fi
if [ $buf_hr -le ${6} -o $lib_hr -le ${6} ] ; then
echo "${2} WARNING - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100"
exit $STATE_WARNING
if [ "$buf_hr" -le "${6}" ] || [ "$lib_hr" -le "${6}" ] ; then
echo "${2} WARNING - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100"
exit "$STATE_WARNING"
fi
echo "${2} OK - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100"
exit $STATE_OK
exit "$STATE_OK"
;;
--tablespace)
if [ ${6} -lt ${7} ] ; then
echo "UNKNOWN - Warning level is more then Crit"
exit $STATE_UNKNOWN
if [ "${6}" -lt "${7}" ] ; then
echo "UNKNOWN - Warning level is more then Crit"
exit "$STATE_UNKNOWN"
fi
result=`sqlplus -s ${3}/${4}@${2} << EOF
result=`sqlplus -s "${3}"/"${4}"@"${2}" << EOF
set pagesize 0
set numf '9999999.99'
select NVL(b.free,0.0),a.total,100 - trunc(NVL(b.free,0.0)/a.total * 1000) / 10 prc
@ -273,32 +273,32 @@ from dba_free_space group by tablespace_name) B
ON a.tablespace_name=b.tablespace_name WHERE a.tablespace_name='${5}';
EOF`
if [ -n "`echo $result | grep ORA-`" ] ; then
error=` echo "$result" | grep "ORA-" | head -1`
echo "CRITICAL - $error"
exit $STATE_CRITICAL
if echo "$result" | grep -q 'ORA-' ; then
error=$(echo "$result" | grep "ORA-" | head -1)
echo "CRITICAL - $error"
exit "$STATE_CRITICAL"
fi
ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}'`
ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}'`
ts_pct=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'`
ts_pctx=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print $3}'`
if [ "$ts_free" -eq 0 -a "$ts_total" -eq 0 -a "$ts_pct" -eq 0 ] ; then
ts_free=$(echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}')
ts_total=$(echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}')
ts_pct=$(echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}')
ts_pctx=$(echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print $3}')
if [ "$ts_free" -eq 0 ] && [ "$ts_total" -eq 0 ] && [ "$ts_pct" -eq 0 ] ; then
echo "No data returned by Oracle - tablespace $5 not found?"
exit $STATE_UNKNOWN
exit "$STATE_UNKNOWN"
fi
if [ "$ts_pct" -ge ${6} ] ; then
echo "${2} : ${5} CRITICAL - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100"
exit $STATE_CRITICAL
if [ "$ts_pct" -ge "${6}" ] ; then
echo "${2} : ${5} CRITICAL - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100"
exit "$STATE_CRITICAL"
fi
if [ "$ts_pct" -ge ${7} ] ; then
echo "${2} : ${5} WARNING - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100"
exit $STATE_WARNING
if [ "$ts_pct" -ge "${7}" ] ; then
echo "${2} : ${5} WARNING - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100"
exit "$STATE_WARNING"
fi
echo "${2} : ${5} OK - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100"
exit $STATE_OK
exit "$STATE_OK"
;;
*)
print_usage
exit $STATE_UNKNOWN
exit "$STATE_UNKNOWN"
esac

View file

@ -2,57 +2,57 @@
PATH="@TRUSTED_PATH@"
export PATH
PROGNAME=`basename $0`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
PROGNAME=$(basename "$0")
PROGPATH=$(echo "$0" | sed -e 's,[\\/][^\\/][^\\/]*$,,')
REVISION="@NP_VERSION@"
. $PROGPATH/utils.sh
. "$PROGPATH"/utils.sh
print_usage() {
echo "Usage: $PROGNAME" [--ignore-fault]
}
print_help() {
print_revision $PROGNAME $REVISION
print_revision "$PROGNAME" "$REVISION"
echo ""
print_usage
echo ""
echo "This plugin checks hardware status using the lm_sensors package."
echo ""
support
exit $STATE_OK
exit "$STATE_OK"
}
case "$1" in
--help)
print_help
exit $STATE_OK
exit "$STATE_OK"
;;
-h)
print_help
exit $STATE_OK
exit "$STATE_OK"
;;
--version)
print_revision $PROGNAME $REVISION
exit $STATE_OK
print_revision "$PROGNAME" "$REVISION"
exit "$STATE_OK"
;;
-V)
print_revision $PROGNAME $REVISION
exit $STATE_OK
print_revision "$PROGNAME" "$REVISION"
exit "$STATE_OK"
;;
*)
sensordata=`sensors 2>&1`
sensordata=$(sensors 2>&1)
status=$?
if test ${status} -eq 127; then
text="SENSORS UNKNOWN - command not found (did you install lmsensors?)"
exit=$STATE_UNKNOWN
elif test ${status} -ne 0; then
elif test "${status}" -ne 0; then
text="WARNING - sensors returned state $status"
exit=$STATE_WARNING
elif echo ${sensordata} | egrep ALARM > /dev/null; then
elif echo "${sensordata}" | grep -E ALARM > /dev/null; then
text="SENSOR CRITICAL - Sensor alarm detected!"
exit=$STATE_CRITICAL
elif echo ${sensordata} | egrep FAULT > /dev/null \
elif echo "${sensordata}" | grep -E FAULT > /dev/null \
&& test "$1" != "-i" -a "$1" != "--ignore-fault"; then
text="SENSOR UNKNOWN - Sensor reported fault"
exit=$STATE_UNKNOWN
@ -63,8 +63,8 @@ case "$1" in
echo "$text"
if test "$1" = "-v" -o "$1" = "--verbose"; then
echo ${sensordata}
echo "${sensordata}"
fi
exit $exit
exit "$exit"
;;
esac

View file

@ -25,7 +25,7 @@ use POSIX;
use strict;
use Getopt::Long;
use vars qw($opt_V $opt_h $opt_v $verbose $PROGNAME $opt_w $opt_c
$opt_f $opt_s
$opt_f $opt_s $opt_d
$lower_warn_threshold $upper_warn_threshold
$lower_crit_threshold $upper_crit_threshold
$status $state $msg);
@ -137,9 +137,20 @@ if ( $uptime_seconds > $upper_crit_threshold ) {
$state_str = "OK";
}
# Prepare uptime value (seconds or days)
my $uptime_text = "";
my $uptime_unit = "";
if ( $opt_d ) {
$uptime_text = floor($uptime_seconds / 60 / 60 / 24);
$uptime_unit = "days";
} else {
$uptime_text = $uptime_seconds;
$uptime_unit = "seconds";
}
$msg = "$state_str: ";
$msg .= "uptime is $uptime_seconds seconds. ";
$msg .= "Uptime is $uptime_text $uptime_unit. ";
$msg .= "Exceeds $out_of_bounds_text threshold. " if $out_of_bounds_text;
$msg .= "Running for $pretty_uptime. " if $opt_f;
if ( $opt_s ) {
@ -167,6 +178,7 @@ sub process_arguments(){
"c=s" => \$opt_c, "critical=s" => \$opt_c, # critical if above this number
"f" => \$opt_f, "for" => \$opt_f, # show "running for ..."
"s" => \$opt_s, "since" => \$opt_s, # show "running since ..."
"d" => \$opt_d, "days" => \$opt_d, # report uptime in days
);
if ($opt_V) {
@ -262,6 +274,7 @@ sub print_help () {
print "-c (--critical) = Min. number of uptime to generate critical alert ( w < c )\n";
print "-f (--for) = Show uptime in a pretty format (Running for x weeks, x days, ...)\n";
print "-s (--since) = Show last boot in yyyy-mm-dd HH:MM:SS format (output from 'uptime -s')\n";
print "-d (--days) = Show uptime in days\n";
print "-h (--help)\n";
print "-V (--version)\n";
print "-v (--verbose) = debugging output\n";

View file

@ -5,7 +5,7 @@
#
use strict;
use Test::More tests => 40;
use Test::More tests => 42;
use NPTest;
my $result;
@ -45,30 +45,36 @@ $result = NPTest->testCmd(
cmp_ok( $result->return_code, '==', 2, "Uptime higher than 2 seconds" );
like ( $result->output, '/Running since \d+/', "Output for the s parameter correct" );
$result = NPTest->testCmd(
"./check_uptime -d -w 1 -c 2"
);
cmp_ok( $result->return_code, '==', 2, "Uptime higher than 2 seconds" );
like ( $result->output, '/CRITICAL: Uptime is \d+ days/', "Output for the d parameter correct" );
$result = NPTest->testCmd(
"./check_uptime -w 1 -c 2"
);
cmp_ok( $result->return_code, '==', 2, "Uptime higher than 2 seconds" );
like ( $result->output, '/^CRITICAL: uptime is \d+ seconds/', "Output for uptime higher than 2 seconds correct" );
like ( $result->output, '/^CRITICAL: Uptime is \d+ seconds/', "Output for uptime higher than 2 seconds correct" );
$result = NPTest->testCmd(
"./check_uptime -w 1 -c 9999w"
);
cmp_ok( $result->return_code, '==', 1, "Uptime lower than 9999 weeks" );
like ( $result->output, '/^WARNING: uptime is \d+ seconds/', "Output for uptime lower than 9999 weeks correct" );
like ( $result->output, '/^WARNING: Uptime is \d+ seconds/', "Output for uptime lower than 9999 weeks correct" );
$result = NPTest->testCmd(
"./check_uptime -w 9998w -c 9999w"
);
cmp_ok( $result->return_code, '==', 0, "Uptime lower than 9998 weeks" );
like ( $result->output, '/^OK: uptime is \d+ seconds/', "Output for uptime lower than 9998 weeks correct" );
like ( $result->output, '/^OK: Uptime is \d+ seconds/', "Output for uptime lower than 9998 weeks correct" );
like ( $result->output, '/\|uptime=[0-9]+s;6046790400;6047395200;/', "Checking for performance output" );
$result = NPTest->testCmd(
"./check_uptime -w 111222d -c 222333d"
);
cmp_ok( $result->return_code, '==', 0, "Uptime lower than 111222 days" );
like ( $result->output, '/^OK: uptime is \d+ seconds/', "Output for uptime lower than 111222 days correct" );
like ( $result->output, '/^OK: Uptime is \d+ seconds/', "Output for uptime lower than 111222 days correct" );
like ( $result->output, '/\|uptime=[0-9]+s;9609580800;19209571200;/', "Checking for performance output" );
# Same as before, hopefully uptime is higher than 2 seconds so no warning
@ -76,7 +82,7 @@ $result = NPTest->testCmd(
"./check_uptime -w 2:111222d -c 1:222333d"
);
cmp_ok( $result->return_code, '==', 0, "Uptime lower than 111222 days, and higher 2 seconds" );
like ( $result->output, '/^OK: uptime is \d+ seconds/', "Output for uptime lower than 111222 days, and higher 2 seconds correct" );
like ( $result->output, '/^OK: Uptime is \d+ seconds/', "Output for uptime lower than 111222 days, and higher 2 seconds correct" );
like ( $result->output, '/\|uptime=[0-9]+s;9609580800;19209571200;/', "Checking for performance output" );
# Same as before, now the low warning should trigger
@ -84,7 +90,7 @@ $result = NPTest->testCmd(
"./check_uptime -w 111221d:111222d -c 1:222333d"
);
cmp_ok( $result->return_code, '==', 1, "Uptime lower than 111221 days raises warning" );
like ( $result->output, '/^WARNING: uptime is \d+ seconds/', "Output for uptime lower than 111221 days correct" );
like ( $result->output, '/^WARNING: Uptime is \d+ seconds/', "Output for uptime lower than 111221 days correct" );
like ( $result->output, '/Exceeds lower warn threshold/', "Exceeds text correct" );
like ( $result->output, '/\|uptime=[0-9]+s;9609580800;19209571200;/', "Checking for performance output" );
@ -93,7 +99,7 @@ $result = NPTest->testCmd(
"./check_uptime -w 111221d:111222d -c 111220d:222333d"
);
cmp_ok( $result->return_code, '==', 2, "Uptime lower than 111220 days raises critical" );
like ( $result->output, '/^CRITICAL: uptime is \d+ seconds/', "Output for uptime lower than 111220 days correct" );
like ( $result->output, '/^CRITICAL: Uptime is \d+ seconds/', "Output for uptime lower than 111220 days correct" );
like ( $result->output, '/Exceeds lower crit threshold/', "Exceeds text correct" );
like ( $result->output, '/\|uptime=[0-9]+s;9609580800;19209571200;/', "Checking for performance output" );