Imported Upstream version 2.0
This commit is contained in:
parent
c89ccc3c74
commit
0841b5c7c7
|
@ -1,6 +1,6 @@
|
|||
This file contains the origin of code copied verbatim into some or all of the Nagios plugins.
|
||||
This file contains the origin of code copied verbatim into some or all of the Monitoring Plugins.
|
||||
|
||||
The NagiosPlugin team thanks the original authors.
|
||||
The Monitoring Plugins team thanks the original authors.
|
||||
|
||||
Copied code is cited in the source by indented comments of the form
|
||||
|
||||
|
|
3
AUTHORS
3
AUTHORS
|
@ -1,4 +1,4 @@
|
|||
The Nagios Plugins are brought to you by the Nagios Plugins Development Team.
|
||||
The Monitoring Plugins are brought to you by the Monitoring Plugins Development Team.
|
||||
|
||||
Jeremy T. Bouse
|
||||
Peter Bray
|
||||
|
@ -11,6 +11,7 @@ Subhendu Ghosh
|
|||
Thomas Guyot-Sionnest
|
||||
Stanley Hopcroft
|
||||
Matthew Kent
|
||||
Sam Kottler
|
||||
Harper Mann
|
||||
Benoit Mortier
|
||||
Sven Nierlein
|
||||
|
|
4
CODING
4
CODING
|
@ -12,8 +12,8 @@ Foundation Coding standards (which are currently available at
|
|||
http://www.gnu.org/prep/standards_toc.html). We also follow most of
|
||||
the FSF guidelines. Developers may suggest deviations from the FSF
|
||||
style recommendations, which will be considered by open discussion on
|
||||
the nagiosplug-devel mailing list. Any such deviations will apply to
|
||||
the entire code base to ensure consistency.
|
||||
the Monitoring Plugins devel mailing list. Any such deviations will
|
||||
apply to the entire code base to ensure consistency.
|
||||
|
||||
Currently, the exceptions to FSF recommendations are roughly equivalent
|
||||
to GNU indent with invoked as 'indent -ts 2 -br'. Specifically, the
|
||||
|
|
14
FAQ
14
FAQ
|
@ -15,7 +15,7 @@ A: All plugins that comply with minimal development guideline for
|
|||
this project include detailed version information. When executed
|
||||
with the '-V' option, a version string will be printed:
|
||||
|
||||
check_radius v1.4.16 (nagios-plugins 1.4.16)
|
||||
check_radius v1.4.16 (monitoring-plugins 1.4.16)
|
||||
|
||||
All bug reports and help requests should reference this
|
||||
information.
|
||||
|
@ -32,7 +32,7 @@ A: At a minimum, the output from 'uname -a' and the version string
|
|||
Q: I'm using Redhat Linux (or some other RPM-based distribution).
|
||||
Which packages should I install?
|
||||
|
||||
A: The package nagios-plugins-<version>.<arch>.rpm contains only
|
||||
A: The package monitoring-plugins-<version>.<arch>.rpm contains only
|
||||
those plugins that should work on any POSIX compliant system. In
|
||||
other words, you should be able to install this package on your
|
||||
system, no matter what else is or in not installed.
|
||||
|
@ -42,7 +42,7 @@ A: The package nagios-plugins-<version>.<arch>.rpm contains only
|
|||
each dependency could be installed cleanly, but many people
|
||||
found that this resulted in too many packages. So in the end,
|
||||
all the non-POSIX plugins were folded into one RPM
|
||||
(nagios-plugins-<version>.<arch>.rpm). Most people will need to
|
||||
(monitoring-plugins-<version>.<arch>.rpm). Most people will need to
|
||||
use RPM's '--nodeps' option to install this package.
|
||||
|
||||
|
||||
|
@ -59,10 +59,10 @@ Q: I prefer to build my own RPMs. Do I need to install all of the
|
|||
|
||||
A: Beginning with the 1.2.9-1 release, you may run
|
||||
|
||||
rpm --define 'custom 1' -ta nagios-plugins-<release>.tar.gz
|
||||
rpm --define 'custom 1' -ta monitoring-plugins-<release>.tar.gz
|
||||
|
||||
In prior releases, you must unpack the tarball and build the
|
||||
RPM using nagios-custom.spec with 'rpm -ba'.
|
||||
RPM using monitoring-custom.spec with 'rpm -ba'.
|
||||
|
||||
|
||||
Q: I get an error like
|
||||
|
@ -84,8 +84,8 @@ A: Commonly, system administrators will make security as tight as
|
|||
|
||||
Q: I have a plugin to offer. What can I do?
|
||||
|
||||
A: You can make it available on NagiosExchange (http://nagiosexchange.org)
|
||||
A: You can make it available on MonitoringExchange (http://monitoringexchange.org)
|
||||
where other people can find it for use.
|
||||
|
||||
You can also get feedback on improving the plugin via the
|
||||
nagiosplug-devel@lists.sourceforge.net mailing list.
|
||||
devel@monitoring-plugins.org mailing list.
|
||||
|
|
|
@ -5,7 +5,7 @@ SUBDIRS = gl tap lib plugins plugins-scripts plugins-root po @PERLMODS_DIR@
|
|||
EXTRA_DIST = config.rpath \
|
||||
ABOUT-NLS ACKNOWLEDGEMENTS AUTHORS CODING ChangeLog FAQ LEGAL NEWS \
|
||||
NP-VERSION-GEN REQUIREMENTS SUPPORT THANKS \
|
||||
NPTest.pm pkg nagios-plugins.spec \
|
||||
NPTest.pm pkg monitoring-plugins.spec \
|
||||
config_test/Makefile config_test/run_tests config_test/child_test.c \
|
||||
tools/build_perl_modules \
|
||||
tools/tinderbox_build
|
||||
|
@ -51,7 +51,7 @@ solpkg:
|
|||
cd $(BUILDDIR) && $(PERL) ../$(PKGSCRIPT) ../$(PACKDIR)
|
||||
|
||||
THANKS: THANKS.in
|
||||
@echo "This software is brought to you by the Nagios Plugins Development Team. However," > $@
|
||||
@echo "This software is brought to you by the Monitoring Plugins Development Team. However," > $@
|
||||
@echo "there have been many contributors to this project. Everyone below has helped in " >> $@
|
||||
@echo "raising bug reports, creating patches or contributing new plugins." >> $@
|
||||
@echo "" >> $@
|
||||
|
|
43
Makefile.in
43
Makefile.in
|
@ -52,7 +52,7 @@ host_triplet = @host@
|
|||
subdir = .
|
||||
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
|
||||
$(srcdir)/nagios-plugins.spec.in $(srcdir)/test.pl.in \
|
||||
$(srcdir)/monitoring-plugins.spec.in $(srcdir)/test.pl.in \
|
||||
$(top_srcdir)/configure $(top_srcdir)/pkg/solaris/pkginfo.in \
|
||||
ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS THANKS \
|
||||
build-aux/compile build-aux/config.guess \
|
||||
|
@ -85,6 +85,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 \
|
||||
|
@ -134,11 +135,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 \
|
||||
|
@ -153,14 +155,15 @@ 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)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES = nagios-plugins.spec test.pl pkg/solaris/pkginfo
|
||||
CONFIG_CLEAN_FILES = monitoring-plugins.spec test.pl \
|
||||
pkg/solaris/pkginfo
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
|
@ -336,6 +339,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@
|
||||
|
@ -701,6 +705,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@
|
||||
|
@ -730,6 +735,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@
|
||||
|
@ -841,8 +847,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@
|
||||
|
@ -933,7 +941,6 @@ LD = @LD@
|
|||
LDAPINCLUDE = @LDAPINCLUDE@
|
||||
LDAPLIBS = @LDAPLIBS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
|
||||
LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@
|
||||
LIBGNU_LTLIBDEPS = @LIBGNU_LTLIBDEPS@
|
||||
LIBICONV = @LIBICONV@
|
||||
|
@ -959,6 +966,7 @@ LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
|
|||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LTLIBPTH = @LTLIBPTH@
|
||||
LTLIBTHREAD = @LTLIBTHREAD@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MATHLIBS = @MATHLIBS@
|
||||
|
@ -984,6 +992,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@
|
||||
|
@ -1004,6 +1013,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@
|
||||
|
@ -1063,7 +1073,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@
|
||||
|
@ -1255,7 +1264,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@
|
||||
|
@ -1279,6 +1287,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@
|
||||
|
@ -1347,7 +1356,7 @@ SUBDIRS = gl tap lib plugins plugins-scripts plugins-root po @PERLMODS_DIR@
|
|||
EXTRA_DIST = config.rpath \
|
||||
ABOUT-NLS ACKNOWLEDGEMENTS AUTHORS CODING ChangeLog FAQ LEGAL NEWS \
|
||||
NP-VERSION-GEN REQUIREMENTS SUPPORT THANKS \
|
||||
NPTest.pm pkg nagios-plugins.spec \
|
||||
NPTest.pm pkg monitoring-plugins.spec \
|
||||
config_test/Makefile config_test/run_tests config_test/child_test.c \
|
||||
tools/build_perl_modules \
|
||||
tools/tinderbox_build
|
||||
|
@ -1364,7 +1373,7 @@ all: config.h
|
|||
.SUFFIXES:
|
||||
am--refresh: Makefile
|
||||
@:
|
||||
$(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*) \
|
||||
|
@ -1391,9 +1400,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
|||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
|
@ -1404,14 +1413,14 @@ config.h: stamp-h1
|
|||
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h1
|
||||
cd $(top_builddir) && $(SHELL) ./config.status config.h
|
||||
$(srcdir)/config.h.in: $(am__configure_deps)
|
||||
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
|
||||
rm -f stamp-h1
|
||||
touch $@
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h stamp-h1
|
||||
nagios-plugins.spec: $(top_builddir)/config.status $(srcdir)/nagios-plugins.spec.in
|
||||
monitoring-plugins.spec: $(top_builddir)/config.status $(srcdir)/monitoring-plugins.spec.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
test.pl: $(top_builddir)/config.status $(srcdir)/test.pl.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@
|
||||
|
@ -1909,7 +1918,7 @@ solpkg:
|
|||
cd $(BUILDDIR) && $(PERL) ../$(PKGSCRIPT) ../$(PACKDIR)
|
||||
|
||||
THANKS: THANKS.in
|
||||
@echo "This software is brought to you by the Nagios Plugins Development Team. However," > $@
|
||||
@echo "This software is brought to you by the Monitoring Plugins Development Team. However," > $@
|
||||
@echo "there have been many contributors to this project. Everyone below has helped in " >> $@
|
||||
@echo "raising bug reports, creating patches or contributing new plugins." >> $@
|
||||
@echo "" >> $@
|
||||
|
|
55
NEWS
55
NEWS
|
@ -1,5 +1,55 @@
|
|||
This file documents the major additions and syntax changes between releases.
|
||||
|
||||
2.0 11th July 2014
|
||||
ENHANCEMENTS
|
||||
check_mailq now supports auto detection of qmail, postfix, exim and nullmailer with
|
||||
fallback to sendmail
|
||||
check_ide_smart now defaults to plugin output, original output appended with -v
|
||||
Extra-Opts are now enabled by default, see:
|
||||
https://www.monitoring-plugins.org/doc/extra-opts.html
|
||||
check_swap now supports a configurable state when there is no swap
|
||||
check_radius now supports the FreeRADIUS Client library
|
||||
New check_mysql_query -f option to specify a client options file
|
||||
New check_mysql_query -g option to specify a client options group
|
||||
Add performance data to check_mysql_query
|
||||
New check_file_age -i/--ignore-missing option to return OK on nonexistent files
|
||||
Make check_ping, check_users, and check_disk work on Windows
|
||||
New check_ssh -P option to specify the expected SSH protocol version
|
||||
check_dns now emits the warning and critical thresholds with the performance data
|
||||
|
||||
FIXES
|
||||
Don't let e.g. check_http's -C option reset SSL version if e.g. -S 1 -C 5 is specified
|
||||
Don't have check_http's -N option expect an argument
|
||||
check_ide_smart could disable offline auto tests but could not re-enable them.
|
||||
For this reason all SMART command modes have been disabled.
|
||||
check_dig: fix wrong IPv6 arguments order (Stéphane Bortzmeyer)
|
||||
check_dig: make sure not to give up too early when a timeout is specified with -t
|
||||
check_log: don't stumble over log lines that include a "%" character
|
||||
check_nt: add UPTIME to perfdata
|
||||
Handle SNMPv3 noAuthNoPriv properly with check_snmp
|
||||
Fix compilation with GnuTLS
|
||||
|
||||
WARNINGS
|
||||
New default installation prefix: /usr/local instead of /usr/local/nagios
|
||||
check_snmp now evaluates negative values properly, which means it might return CRITICAL
|
||||
in cases where it used to return OK. If this is undesired, the warning/critical
|
||||
threshold(s) must be fixed by specifying e.g. ~:100 instead of 100
|
||||
check_procs now ignores its parent process to avoid unexpected results when invoked via
|
||||
certain shells
|
||||
utils.sh no longer defines ECH
|
||||
check_ide_smart -q/--quiet and -n/--nagios (Nagios-compatible output) are now deprecated
|
||||
but accepted for backward-compatibility
|
||||
check_ide_smart -0/--auto-off, -1/--auto-on and -i/--immediate: options have
|
||||
been disabled because they were broken
|
||||
State retention: the NAGIOS_PLUGIN_STATE_DIRECTORY environment variable has been
|
||||
renamed MP_STATE_PATH. The old variable will continue to work in v2.0.x
|
||||
Add the UID of the invoking user to the state retention file path. This helps solving
|
||||
permission issues when different users run the same plugin
|
||||
check_swap used to allow returning OK on a system without swap when only percent thresholds
|
||||
were used. This is no longer the case and one must now use -n/--no-swap=<state>
|
||||
The Perl and Shell plugins now use the PATH specified via ./configure's --trusted-path
|
||||
option, or "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" by default
|
||||
|
||||
1.5 2nd October 2013
|
||||
ENHANCEMENTS
|
||||
New check_dbi plugin for checking an (SQL) database using DBI
|
||||
|
@ -46,6 +96,7 @@ This file documents the major additions and syntax changes between releases.
|
|||
WARNINGS
|
||||
check_http behaviour of -k/--header changed since it does not seperate multiple headers by semicolons anymore. Use multiple -k switches instead.
|
||||
check_http's --proxy_authorization option is now called --proxy-authorization (it was always documented this way)
|
||||
The contrib directory has been removed from this distribution
|
||||
|
||||
1.4.16 27th June 2012
|
||||
ENHANCEMENTS
|
||||
|
@ -287,7 +338,7 @@ This file documents the major additions and syntax changes between releases.
|
|||
check_icmp fix for *BSD when running for long time
|
||||
check_ping times out 1 second quicker if host is unreachable
|
||||
Root plugins installed with world executable
|
||||
check_sybase from contrib now maintained in NagiosExchange
|
||||
check_sybase from contrib now maintained in MonitoringExchange
|
||||
--with-nagios-user/group reinstated ./configure option
|
||||
New --without-world-permissions ./configure option
|
||||
|
||||
|
@ -311,7 +362,7 @@ This file documents the major additions and syntax changes between releases.
|
|||
New C based check_ntp. The perl version is now deprecated.
|
||||
New check_apt plugin
|
||||
Notice: plugins in contrib/ will start to be removed from this distribution.
|
||||
Please check at http://www.nagiosexchange.org for contributed plugins
|
||||
Please check at http://www.monitoringexchange.org for contributed plugins
|
||||
Major bug fixes to check_disk where values were incorrectly calculated and alerted on.
|
||||
check_udp2 removed. check_udp is now linked to check_tcp.c
|
||||
check_mailq now errors if the sub-program run returns non-zero return code. This would appear
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
SRC_ROOT=`dirname $0`
|
||||
|
||||
NPVF=NP-VERSION-FILE
|
||||
DEF_VER=1.5.git
|
||||
DEF_VER=2.0.git
|
||||
|
||||
LF='
|
||||
'
|
||||
|
|
81
NPTest.pm
81
NPTest.pm
|
@ -1,12 +1,12 @@
|
|||
package NPTest;
|
||||
|
||||
#
|
||||
# Helper Functions for testing Nagios Plugins
|
||||
# Helper Functions for testing Monitoring Plugins
|
||||
#
|
||||
|
||||
require Exporter;
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(getTestParameter checkCmd skipMissingCmd);
|
||||
@EXPORT = qw(getTestParameter checkCmd skipMissingCmd skipMsg);
|
||||
@EXPORT_OK = qw(DetermineTestHarnessDirectory TestsFrom SetCacheFilename);
|
||||
|
||||
use strict;
|
||||
|
@ -25,21 +25,21 @@ $VERSION = "1556."; # must be all one line, for MakeMaker
|
|||
|
||||
=head1 NAME
|
||||
|
||||
NPTest - Simplify the testing of Nagios Plugins
|
||||
NPTest - Simplify the testing of Monitoring Plugins
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This modules provides convenience functions to assist in the testing
|
||||
of Nagios Plugins, making the testing code easier to read and write;
|
||||
of Monitoring Plugins, making the testing code easier to read and write;
|
||||
hopefully encouraging the development of a more complete test suite for
|
||||
the Nagios Plugins. It is based on the patterns of testing seen in the
|
||||
the Monitoring Plugins. It is based on the patterns of testing seen in the
|
||||
1.4.0 release, and continues to use the L<Test> module as the basis of
|
||||
testing.
|
||||
|
||||
=head1 FUNCTIONS
|
||||
|
||||
This module defines three public functions, C<getTestParameter(...)>,
|
||||
C<checkCmd(...)> and C<skipMissingCmd(...)>. These are exported by
|
||||
This module defines four public functions, C<getTestParameter(...)>,
|
||||
C<checkCmd(...)>, C<skipMissingCmd(...)> and C<skipMsg(...)>. These are exported by
|
||||
default via the C<use NPTest;> statement.
|
||||
|
||||
=over
|
||||
|
@ -92,7 +92,7 @@ Testing of results would be done in your test script, not in this module.
|
|||
This function is obsolete. Use C<testCmd()> instead.
|
||||
|
||||
This function attempts to encompass the majority of test styles used
|
||||
in testing Nagios Plugins. As each plug-in is a separate command, the
|
||||
in testing Monitoring Plugins. As each plug-in is a separate command, the
|
||||
typical tests we wish to perform are against the exit status of the
|
||||
command and the output (if any) it generated. Simplifying these tests
|
||||
into a single function call, makes the test harness easier to read and
|
||||
|
@ -132,7 +132,7 @@ of either C<Test::ok(...)> or C<Test::skip(...)>, so remember this
|
|||
when counting the number of tests to place in the C<Test::plan(...)>
|
||||
call.
|
||||
|
||||
Many Nagios Plugins test network services, some of which may not be
|
||||
Many Monitoring Plugins test network services, some of which may not be
|
||||
present on all systems. To cater for this, C<checkCmd(...)> allows the
|
||||
tester to define exceptions based on the command's exit status. These
|
||||
exceptions are provided to skip tests if the test case developer
|
||||
|
@ -185,6 +185,15 @@ of times.
|
|||
|
||||
=back
|
||||
|
||||
=item C<skipMsg(...)>
|
||||
|
||||
If for any reason the test harness must C<Test::skip()> some
|
||||
or all of the tests in a given test harness this function provides a
|
||||
simple iterator to issue an appropriate message the requested number
|
||||
of times.
|
||||
|
||||
=back
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<Test>
|
||||
|
@ -199,7 +208,7 @@ Copyright (c) 2005 Peter Bray. All rights reserved.
|
|||
|
||||
This package is free software and is provided "as is" without express
|
||||
or implied warranty. It may be used, redistributed and/or modified
|
||||
under the same terms as the Nagios Plugins release.
|
||||
under the same terms as the Monitoring Plugins release.
|
||||
|
||||
=cut
|
||||
|
||||
|
@ -304,6 +313,20 @@ sub skipMissingCmd
|
|||
return $testStatus;
|
||||
}
|
||||
|
||||
sub skipMsg
|
||||
{
|
||||
my( $msg, $count ) = @_;
|
||||
|
||||
my $testStatus;
|
||||
|
||||
for ( 1 .. $count )
|
||||
{
|
||||
$testStatus += skip( $msg, 1 );
|
||||
}
|
||||
|
||||
return $testStatus;
|
||||
}
|
||||
|
||||
sub getTestParameter
|
||||
{
|
||||
my( $param, $envvar, $default, $brief, $scoped );
|
||||
|
@ -347,7 +370,7 @@ sub getTestParameter
|
|||
}
|
||||
|
||||
# Set "none" if no terminal attached (eg, tinderbox build servers when new variables set)
|
||||
return "" unless (-t STDERR);
|
||||
return "" unless (-t STDIN);
|
||||
|
||||
my $userResponse = "";
|
||||
|
||||
|
@ -438,7 +461,7 @@ sub LoadCache
|
|||
|
||||
chomp($fileContents);
|
||||
my( $contentsRef ) = eval $fileContents;
|
||||
%CACHE = %{$contentsRef};
|
||||
%CACHE = %{$contentsRef} if (defined($contentsRef));
|
||||
|
||||
}
|
||||
|
||||
|
@ -494,25 +517,34 @@ sub SetCacheFilename
|
|||
|
||||
sub DetermineTestHarnessDirectory
|
||||
{
|
||||
my( $userSupplied ) = @_;
|
||||
my( @userSupplied ) = @_;
|
||||
my @dirs;
|
||||
|
||||
# User Supplied
|
||||
if ( defined( $userSupplied ) && $userSupplied )
|
||||
if ( @userSupplied > 0 )
|
||||
{
|
||||
if ( -d $userSupplied )
|
||||
for my $u ( @userSupplied )
|
||||
{
|
||||
return $userSupplied;
|
||||
if ( -d $u )
|
||||
{
|
||||
push ( @dirs, $u );
|
||||
}
|
||||
else
|
||||
{
|
||||
return undef; # userSupplied is invalid -> FAIL
|
||||
}
|
||||
}
|
||||
|
||||
# Simple Case : "t" is a subdirectory of the current directory
|
||||
# Simple Cases: "t" and tests are subdirectories of the current directory
|
||||
if ( -d "./t" )
|
||||
{
|
||||
return "./t";
|
||||
push ( @dirs, "./t");
|
||||
}
|
||||
if ( -d "./tests" )
|
||||
{
|
||||
push ( @dirs, "./tests");
|
||||
}
|
||||
|
||||
if ( @dirs > 0 )
|
||||
{
|
||||
return @dirs;
|
||||
}
|
||||
|
||||
# To be honest I don't understand which case satisfies the
|
||||
|
@ -526,7 +558,7 @@ sub DetermineTestHarnessDirectory
|
|||
|
||||
if ( $pwd =~ m|/t$| )
|
||||
{
|
||||
return $pwd;
|
||||
push ( @dirs, $pwd );
|
||||
|
||||
# The alternate that might work better is
|
||||
# chdir( ".." );
|
||||
|
@ -535,7 +567,7 @@ sub DetermineTestHarnessDirectory
|
|||
# to be tested is in the current directory (ie "./check_disk ....")
|
||||
}
|
||||
|
||||
return undef;
|
||||
return @dirs;
|
||||
}
|
||||
|
||||
sub TestsFrom
|
||||
|
@ -620,10 +652,11 @@ sub only_output {
|
|||
sub testCmd {
|
||||
my $class = shift;
|
||||
my $command = shift or die "No command passed to testCmd";
|
||||
my $timeout = shift || 120;
|
||||
my $object = $class->new;
|
||||
|
||||
local $SIG{'ALRM'} = sub { die("timeout in command: $command"); };
|
||||
alarm(120); # no test should take longer than 120 seconds
|
||||
alarm($timeout); # no test should take longer than 120 seconds
|
||||
|
||||
my $output = `$command`;
|
||||
$object->return_code($? >> 8);
|
||||
|
|
58
README
58
README
|
@ -1,9 +1,9 @@
|
|||
Nagios Plugins
|
||||
==============
|
||||
Monitoring Plugins
|
||||
==================
|
||||
|
||||
* For instructions on installing these plugins for use with Nagios,
|
||||
see below. In addition, generic instructions for the GNU toolchain can be
|
||||
found in the `INSTALL` file.
|
||||
* For instructions on installing these plugins for use with your monitoring
|
||||
system, see below. In addition, generic instructions for the GNU
|
||||
toolchain can be found in the `INSTALL` file.
|
||||
|
||||
* For major changes between releases, read the `NEWS` file.
|
||||
|
||||
|
@ -21,19 +21,20 @@ Nagios Plugins
|
|||
|
||||
You can check for the latest plugins at:
|
||||
|
||||
* <https://www.nagios-plugins.org/>
|
||||
* <https://www.monitoring-plugins.org/>
|
||||
|
||||
Send an email to <nagiosplug-help@lists.sourceforge.net> for assistance.
|
||||
Please include the OS type and version that you are using. Also, run the
|
||||
plugin with the `-vvv` option and provide the resulting version information.
|
||||
Of course, there may be additional diagnostic information required as well.
|
||||
Send an email to <help@monitoring-plugins.org> for assistance. Please
|
||||
include the OS type and version that you are using. Also, run the plugin
|
||||
with the `-vvv` option and provide the resulting version information. Of
|
||||
course, there may be additional diagnostic information required as well.
|
||||
Use good judgment.
|
||||
|
||||
Send an email to <nagiosplug-devel@lists.sourceforge.net> for developer
|
||||
discussions.
|
||||
Send an email to <devel@monitoring-plugins.org> for developer discussions.
|
||||
|
||||
For patch submissions and bug reports, please use the appropriate resources
|
||||
at <https://github.com/nagios-plugins/nagios-plugins>.
|
||||
at:
|
||||
|
||||
* <https://github.com/monitoring-plugins>
|
||||
|
||||
|
||||
Installation Instructions
|
||||
|
@ -45,17 +46,17 @@ Installation Instructions
|
|||
./tools/setup
|
||||
|
||||
For more detail, see the developer guidelines at
|
||||
<https://www.nagios-plugins.org/doc/guidelines.html>.
|
||||
<https://www.monitoring-plugins.org/doc/guidelines.html>.
|
||||
|
||||
2. Run the configure script to initialize variables and create a Makefile,
|
||||
etc.
|
||||
|
||||
./configure --prefix=BASEDIRECTORY --with-cgiurl=SOMEURL
|
||||
|
||||
Replace `BASEDIRECTORY` with the path of the directory under which Nagios
|
||||
is installed (default is `/usr/local/nagios`), and replace `SOMEURL` with
|
||||
the path used to access the Nagios CGIs with a web browser (default is
|
||||
`/nagios/cgi-bin`).
|
||||
Replace `BASEDIRECTORY` with the path of the directory under which your
|
||||
monitoring system is installed (default is `/usr/local`), and replace
|
||||
`SOMEURL` with the path used to access the monitoring system CGIs with a
|
||||
web browser (default is `/nagios/cgi-bin`).
|
||||
|
||||
3. Compile the plugins with the following command:
|
||||
|
||||
|
@ -77,14 +78,21 @@ Installation Instructions
|
|||
make install-root
|
||||
|
||||
That's it! If you have any problems or questions, feel free to send an
|
||||
email to <nagiosplug-help@lists.sourceforge.net>.
|
||||
email to <help@monitoring-plugins.org>.
|
||||
|
||||
|
||||
License Stuff
|
||||
-------------
|
||||
License Notice
|
||||
--------------
|
||||
|
||||
This software is released under the GNU General Public License, Version 3,
|
||||
with the additional exemption that compiling, linking and/or using OpenSSL
|
||||
is allowed.
|
||||
You can redistribute and/or modify this software under the terms of the GNU
|
||||
General Public License as published by the Free Software Foundation; either
|
||||
version 3 of the License, or (at your option) any later version; with the
|
||||
additional exemption that compiling, linking, and/or using OpenSSL is
|
||||
allowed.
|
||||
|
||||
See the `COPYING` file for the complete GPLv3 text.
|
||||
This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the `COPYING` file for the complete text of the GNU General Public
|
||||
License, version 3.
|
||||
|
|
14
REQUIREMENTS
14
REQUIREMENTS
|
@ -1,4 +1,4 @@
|
|||
Nagios Plugin Requirements
|
||||
Monitoring Plugins Requirements
|
||||
--------------------------
|
||||
|
||||
Some plugins require that you have additional programs and/or
|
||||
|
@ -50,14 +50,16 @@ check_dbi:
|
|||
http://libdbi.sourceforge.net/
|
||||
|
||||
check_radius:
|
||||
- Requires the radiusclient-ng library available from:
|
||||
http://developer.berlios.de/projects/radiusclient-ng/
|
||||
- Requires the FreeRADIUS Client library available from:
|
||||
http://freeradius.org/freeradius-client/
|
||||
- As an alternative, the radiusclient-ng library may be used:
|
||||
http://sourceforge.net/projects/radiusclient-ng.berlios/
|
||||
- This plugin also works with the original radiusclient library from
|
||||
ftp://ftp.cityline.net/pub/radiusclient/
|
||||
RPM (rpmfind): radiusclient 0.3.2, radiusclient-devel-0.3.2
|
||||
Unless you're using a distro-maintained version of this library you
|
||||
probably want to use radiusclient-ng. The original radiusclient library is
|
||||
unmaintained and has many known issues, particularly with 64bit systems.
|
||||
However, you probably want to use the FreeRADIUS Client library, as
|
||||
both radiusclient and radiusclient-ng are unmaintained and have known
|
||||
issues.
|
||||
|
||||
check_snmp:
|
||||
- Requires the NET-SNMP package available from
|
||||
|
|
18
SUPPORT
18
SUPPORT
|
@ -1,14 +1,14 @@
|
|||
SUPPORT
|
||||
|
||||
Using the mailing lists and tracker databases at SourceForge are the
|
||||
best ways to obtain direct support for the Nagios Plugins. There may
|
||||
Using the mailing lists and issue tracker at GitHub are the
|
||||
best ways to obtain direct support for the Monitoring Plugins. There may
|
||||
also be commercial support options available to you -- check
|
||||
http://www.nagios.org/ to track the current status of commercial
|
||||
support offerings.
|
||||
|
||||
There are two mailing lists associated with Nagios Plugin development:
|
||||
'help' (mailto:nagiosplug-help@lists.sourceforge.net), and 'devel'
|
||||
(mailto:nagiosplug-devel@lists.sourceforge.net). Unless you are fairly
|
||||
There are two mailing lists associated with Monitoring Plugins development:
|
||||
'help' (mailto:help@monitoring-plugins.org), and 'devel'
|
||||
(mailto:help@monitoring-plugins.org). Unless you are fairly
|
||||
certain you have found a bug or that you are requesting a new feature,
|
||||
please direct support requests to 'help'.
|
||||
|
||||
|
@ -19,7 +19,7 @@ you interest to do a modest amount of legwork before posting to either
|
|||
of these lists.
|
||||
|
||||
Plugins that are in the contrib directories are provided as-is. We will
|
||||
try to help, but sometimes the plugins have dependencies that the nagios-plugin
|
||||
try to help, but sometimes the plugins have dependencies that the monitoring-plugin
|
||||
developers do not have access to. You may be able to try the authors
|
||||
directly.
|
||||
|
||||
|
@ -34,7 +34,7 @@ Requests to 'help' require posting the version number of the
|
|||
plugin. The best place to include the version information is in the
|
||||
subject. A good post would have a subject like:
|
||||
|
||||
Can I use SSL with check_imap (nagios-plugins 1.3.0-beta2) 1.12
|
||||
Can I use SSL with check_imap (monitoring-plugins 1.3.0-beta2) 1.12
|
||||
|
||||
If you do not include the version of the plugin, you risk having your
|
||||
post silently ignored.
|
||||
|
@ -48,7 +48,7 @@ REPORTING BUGS AND SUBMITTING PATCHES
|
|||
|
||||
Bug reports, investigations of possible bugs, feature requests, and
|
||||
patch submissions should be submitted to the development list at
|
||||
mailto:nagiosplug-devel@lists.sourceforge.net. Please raise an issue first
|
||||
mailto:devel@monitoring-plugins.org. Please raise an issue first
|
||||
in GitHub, otherwise your email is likely to be missed over time.
|
||||
|
||||
You should identify the version, preferably in the subject line.
|
||||
|
@ -58,7 +58,7 @@ reference your report to one of the following sources:
|
|||
1) The most recent release, including beta's
|
||||
|
||||
2) The current snapshots (there's a link provided on
|
||||
https://www.nagios-plugins.org/download.html)
|
||||
https://www.monitoring-plugins.org/download.html)
|
||||
|
||||
3) The current Git code from GitHub
|
||||
|
||||
|
|
23
THANKS
23
THANKS
|
@ -1,4 +1,4 @@
|
|||
This software is brought to you by the Nagios Plugins Development Team. However,
|
||||
This software is brought to you by the Monitoring Plugins Development Team. However,
|
||||
there have been many contributors to this project. Everyone below has helped in
|
||||
raising bug reports, creating patches or contributing new plugins.
|
||||
|
||||
|
@ -36,20 +36,25 @@ Guy Van Den Bergh
|
|||
Jimmy Bergman
|
||||
Jochen Bern
|
||||
Tom Bertelston
|
||||
Gunnar Beutner
|
||||
Daniel Bimschas
|
||||
Jeffery Blank
|
||||
Tom De Blende
|
||||
Eric Bollengier
|
||||
Aurelien Bompard
|
||||
Stéphane Bortzmeyer
|
||||
Alex Bradley
|
||||
Andy Brist
|
||||
Richard Brodie
|
||||
Dominique Broeglin
|
||||
Matthew Brown
|
||||
Tobias Brox
|
||||
Tilmann Bubeck
|
||||
Dick van den Burg
|
||||
Jason Burnett
|
||||
Grant Byers
|
||||
Carlos Canau
|
||||
Jethro Carr
|
||||
Jim Carroll
|
||||
Ian Cass
|
||||
Arnold Cavazos
|
||||
|
@ -58,10 +63,12 @@ Stephane Chazelas
|
|||
Eric Chen
|
||||
Alwyn Cherrington
|
||||
Ben Clewett
|
||||
Jean-Claude Computing
|
||||
Lionel Cons
|
||||
Garry Cook
|
||||
Charlie Cook
|
||||
Ollie Cook
|
||||
Luca Corti
|
||||
Jason Crawford
|
||||
David Croft
|
||||
Robert Dale
|
||||
|
@ -87,6 +94,7 @@ Ragnar Hojland Espinosa
|
|||
O'Shaughnessy Evans
|
||||
Merijn Evertse
|
||||
Karl Ewald
|
||||
Mikael Falkvidd
|
||||
Paul Farrall
|
||||
Reuben Farrelly
|
||||
Mark Favas
|
||||
|
@ -107,6 +115,8 @@ Matt Garrett
|
|||
Robby Giffin
|
||||
Flo Gleixner
|
||||
Florian Gleixner
|
||||
Evgeni Golov
|
||||
Joseph Gooch
|
||||
Aravind Gottipati
|
||||
Kev Green
|
||||
Steve Greenland
|
||||
|
@ -155,6 +165,7 @@ Marcel Kuiper
|
|||
Alexander Kulak
|
||||
Bill Kunkel
|
||||
Brian Landers
|
||||
Stephane Lapie
|
||||
Pascal Larisch
|
||||
Charles-Henri Larose
|
||||
Tim Laszlo
|
||||
|
@ -165,13 +176,17 @@ William Leibzon
|
|||
Pedro Leite
|
||||
Richard Leitner
|
||||
Craig Leres
|
||||
Oskar Liljeblad
|
||||
Joerg Linge
|
||||
Jan Lipphaus
|
||||
Anton Lofgren
|
||||
Larry Low
|
||||
Jacob Lundqvist
|
||||
Jason Lunn
|
||||
Davide Madrisan
|
||||
Guenther Mair
|
||||
Pawel Malachowski
|
||||
Ricardo Maraschini
|
||||
Michael Markstaller
|
||||
John Marquart
|
||||
Ernst-Dieter Martin
|
||||
|
@ -190,15 +205,18 @@ Emil Michles
|
|||
Christian Mies
|
||||
Jonathan Milby
|
||||
Russell Miller
|
||||
Eric J. Mislivec
|
||||
Janos Mohacsi
|
||||
Gerd Mueller
|
||||
Michael Musikhin
|
||||
Damian Myerscough
|
||||
Jan-Frode Myklebust
|
||||
Sivakumar Nellurandi
|
||||
Truongchinh Nguyen
|
||||
Simon L Nielsen
|
||||
Thomas Nilsen
|
||||
Sebastian Nohn
|
||||
Geoff Oakham
|
||||
Walbert Oberngruber
|
||||
Craig Orsinger
|
||||
Vaclav Ovsik
|
||||
|
@ -224,6 +242,7 @@ Olivier 'Babar' Raginel
|
|||
Phil Randal
|
||||
Abid Rasheed
|
||||
Jeremy Reed
|
||||
Spenser Reinhardt
|
||||
Marc Remy
|
||||
Alessandro Ren
|
||||
Joe Rhett
|
||||
|
@ -287,6 +306,7 @@ Carole Verdon
|
|||
Ludse Verhoeven
|
||||
Robert August Vincent
|
||||
Dave Viner
|
||||
Lars Vogdt
|
||||
Jan Wagner
|
||||
Dieter Van de Walle
|
||||
John Warburton
|
||||
|
@ -297,6 +317,7 @@ Steve Weinreich
|
|||
Erik Welch
|
||||
Torsten Werner
|
||||
Ben Whaley
|
||||
Andrew Widdersheim
|
||||
Adrian Wieczorek
|
||||
Sebastian Wiesinger
|
||||
Paul Wiggins
|
||||
|
|
55
aclocal.m4
vendored
55
aclocal.m4
vendored
|
@ -416,18 +416,6 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
|||
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
|
||||
])
|
||||
|
||||
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# serial 8
|
||||
|
||||
# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
|
||||
AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
|
@ -612,6 +600,46 @@ fi
|
|||
rmdir .tst 2>/dev/null
|
||||
AC_SUBST([am__leading_dot])])
|
||||
|
||||
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
|
||||
# From Jim Meyering
|
||||
|
||||
# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
|
||||
# 2011 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file 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.
|
||||
|
||||
# serial 5
|
||||
|
||||
# AM_MAINTAINER_MODE([DEFAULT-MODE])
|
||||
# ----------------------------------
|
||||
# Control maintainer-specific portions of Makefiles.
|
||||
# Default is to disable them, unless `enable' is passed literally.
|
||||
# For symmetry, `disable' may be passed as well. Anyway, the user
|
||||
# can override the default with the --enable/--disable switch.
|
||||
AC_DEFUN([AM_MAINTAINER_MODE],
|
||||
[m4_case(m4_default([$1], [disable]),
|
||||
[enable], [m4_define([am_maintainer_other], [disable])],
|
||||
[disable], [m4_define([am_maintainer_other], [enable])],
|
||||
[m4_define([am_maintainer_other], [enable])
|
||||
m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
|
||||
AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
|
||||
dnl maintainer-mode's default is 'disable' unless 'enable' is passed
|
||||
AC_ARG_ENABLE([maintainer-mode],
|
||||
[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful
|
||||
(and sometimes confusing) to the casual installer],
|
||||
[USE_MAINTAINER_MODE=$enableval],
|
||||
[USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
|
||||
AC_MSG_RESULT([$USE_MAINTAINER_MODE])
|
||||
AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
|
||||
MAINT=$MAINTAINER_MODE_TRUE
|
||||
AC_SUBST([MAINT])dnl
|
||||
]
|
||||
)
|
||||
|
||||
AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
|
||||
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
|
||||
|
@ -1048,6 +1076,7 @@ m4_include([gl/m4/gnulib-common.m4])
|
|||
m4_include([gl/m4/gnulib-comp.m4])
|
||||
m4_include([gl/m4/hostent.m4])
|
||||
m4_include([gl/m4/iconv.m4])
|
||||
m4_include([gl/m4/idpriv.m4])
|
||||
m4_include([gl/m4/include_next.m4])
|
||||
m4_include([gl/m4/inet_ntop.m4])
|
||||
m4_include([gl/m4/intlmacosx.m4])
|
||||
|
@ -1116,8 +1145,10 @@ m4_include([gl/m4/stdint.m4])
|
|||
m4_include([gl/m4/stdint_h.m4])
|
||||
m4_include([gl/m4/stdio_h.m4])
|
||||
m4_include([gl/m4/stdlib_h.m4])
|
||||
m4_include([gl/m4/strcase.m4])
|
||||
m4_include([gl/m4/strerror.m4])
|
||||
m4_include([gl/m4/string_h.m4])
|
||||
m4_include([gl/m4/strings_h.m4])
|
||||
m4_include([gl/m4/strndup.m4])
|
||||
m4_include([gl/m4/strnlen.m4])
|
||||
m4_include([gl/m4/strsep.m4])
|
||||
|
|
64
config.h.in
64
config.h.in
|
@ -1,4 +1,4 @@
|
|||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define if building universal (internal helper macro) */
|
||||
#undef AC_APPLE_UNIVERSAL_BUILD
|
||||
|
@ -273,6 +273,10 @@
|
|||
don't. */
|
||||
#undef HAVE_DECL_STRERROR_R
|
||||
|
||||
/* Define to 1 if you have the declaration of `strncasecmp', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_STRNCASECMP
|
||||
|
||||
/* Define to 1 if you have the declaration of `strndup', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_STRNDUP
|
||||
|
@ -336,6 +340,15 @@
|
|||
/* Define to 1 if you have the `fs_stat_dev' function. */
|
||||
#undef HAVE_FS_STAT_DEV
|
||||
|
||||
/* Define to 1 if you have the 'getegid' function. */
|
||||
#undef HAVE_GETEGID
|
||||
|
||||
/* Define to 1 if you have the 'geteuid' function. */
|
||||
#undef HAVE_GETEUID
|
||||
|
||||
/* Define to 1 if you have the 'getgid' function. */
|
||||
#undef HAVE_GETGID
|
||||
|
||||
/* Define to 1 if you have the `gethostbyname' function. */
|
||||
#undef HAVE_GETHOSTBYNAME
|
||||
|
||||
|
@ -354,6 +367,12 @@
|
|||
/* Define to 1 if you have the `getopt_long_only' function. */
|
||||
#undef HAVE_GETOPT_LONG_ONLY
|
||||
|
||||
/* Define to 1 if you have the 'getresgid' function. */
|
||||
#undef HAVE_GETRESGID
|
||||
|
||||
/* Define to 1 if you have the 'getresuid' function. */
|
||||
#undef HAVE_GETRESUID
|
||||
|
||||
/* Define to 1 if you have the `getservbyname' function. */
|
||||
#undef HAVE_GETSERVBYNAME
|
||||
|
||||
|
@ -363,6 +382,9 @@
|
|||
/* Define if gettimeofday is found */
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
|
||||
/* Define to 1 if you have the 'getuid' function. */
|
||||
#undef HAVE_GETUID
|
||||
|
||||
/* Define to 1 if you have the <gnutls/openssl.h> header file. */
|
||||
#undef HAVE_GNUTLS_OPENSSL_H
|
||||
|
||||
|
@ -436,6 +458,10 @@
|
|||
/* Define to 1 if you have the `dl' library (-ldl). */
|
||||
#undef HAVE_LIBDL
|
||||
|
||||
/* Define to 1 if you have the `freeradius-client' library
|
||||
(-lfreeradius-client). */
|
||||
#undef HAVE_LIBFREERADIUS_CLIENT
|
||||
|
||||
/* Define to 1 if you have the <libintl.h> header file. */
|
||||
#undef HAVE_LIBINTL_H
|
||||
|
||||
|
@ -723,6 +749,9 @@
|
|||
/* Define to 1 if fdatasync is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_FDATASYNC
|
||||
|
||||
/* Define to 1 if ffs is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_FFS
|
||||
|
||||
/* Define to 1 if ffsl is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_FFSL
|
||||
|
||||
|
@ -1152,6 +1181,9 @@
|
|||
/* Define to 1 if stpncpy is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_STPNCPY
|
||||
|
||||
/* Define to 1 if strcasecmp is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_STRCASECMP
|
||||
|
||||
/* Define to 1 if strcasestr is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_STRCASESTR
|
||||
|
||||
|
@ -1164,6 +1196,9 @@
|
|||
/* Define to 1 if strerror_r is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_STRERROR_R
|
||||
|
||||
/* Define to 1 if strncasecmp is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_STRNCASECMP
|
||||
|
||||
/* Define to 1 if strncat is declared even after undefining macros. */
|
||||
#undef HAVE_RAW_DECL_STRNCAT
|
||||
|
||||
|
@ -1371,9 +1406,27 @@
|
|||
/* Define to 1 if you have the `select' function. */
|
||||
#undef HAVE_SELECT
|
||||
|
||||
/* Define to 1 if you have the 'setegid' function. */
|
||||
#undef HAVE_SETEGID
|
||||
|
||||
/* Define to 1 if you have the 'setenv' function. */
|
||||
#undef HAVE_SETENV
|
||||
|
||||
/* Define to 1 if you have the 'seteuid' function. */
|
||||
#undef HAVE_SETEUID
|
||||
|
||||
/* Define to 1 if you have the 'setregid' function. */
|
||||
#undef HAVE_SETREGID
|
||||
|
||||
/* Define to 1 if you have the 'setresgid' function. */
|
||||
#undef HAVE_SETRESGID
|
||||
|
||||
/* Define to 1 if you have the 'setresuid' function. */
|
||||
#undef HAVE_SETRESUID
|
||||
|
||||
/* Define to 1 if you have the 'setreuid' function. */
|
||||
#undef HAVE_SETREUID
|
||||
|
||||
/* Define to 1 if you have the `shutdown' function. */
|
||||
#undef HAVE_SHUTDOWN
|
||||
|
||||
|
@ -1422,6 +1475,9 @@
|
|||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `strcasecmp' function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
/* Define to 1 if you have the `strdup' function. */
|
||||
#undef HAVE_STRDUP
|
||||
|
||||
|
@ -1434,6 +1490,9 @@
|
|||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the `strncasecmp' function. */
|
||||
#undef HAVE_STRNCASECMP
|
||||
|
||||
/* Define to 1 if you have the 'strndup' function. */
|
||||
#undef HAVE_STRNDUP
|
||||
|
||||
|
@ -1653,6 +1712,9 @@
|
|||
/* Define to 1 if you have the <ws2tcpip.h> header file. */
|
||||
#undef HAVE_WS2TCPIP_H
|
||||
|
||||
/* Define to 1 if you have the <wtsapi32.h> header file. */
|
||||
#undef HAVE_WTSAPI32_H
|
||||
|
||||
/* Define to 1 if you have the <x509.h> header file. */
|
||||
#undef HAVE_X509_H
|
||||
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT(nagios-plugins,1.5)
|
||||
AC_INIT(monitoring-plugins,2.0)
|
||||
AC_CONFIG_SRCDIR(NPTest.pm)
|
||||
AC_CONFIG_FILES([gl/Makefile
|
||||
nagios-plugins.spec])
|
||||
monitoring-plugins.spec])
|
||||
AC_CONFIG_AUX_DIR(build-aux)
|
||||
AM_INIT_AUTOMAKE([1.8.3])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_MAINTAINER_MODE([enable])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
DEFAULT_PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
|
||||
RELEASE=1
|
||||
AC_SUBST(RELEASE)
|
||||
|
||||
AC_PREFIX_DEFAULT(/usr/local/nagios)
|
||||
|
||||
dnl Deprecated configure options
|
||||
|
||||
|
||||
|
@ -58,10 +58,10 @@ AC_SUBST(PLUGIN_TEST)dnl
|
|||
SCRIPT_TEST=`echo $srcdir/plugins-scripts/t/*.t|sed -e 's,\.*/plugins-scripts/,,g'`
|
||||
AC_SUBST(SCRIPT_TEST)dnl
|
||||
|
||||
WARRANTY="The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugins under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n"
|
||||
WARRANTY="The Monitoring Plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\ncopies of the plugins under the terms of the GNU General Public License.\nFor more information about these matters, see the file named COPYING.\n"
|
||||
AC_SUBST(WARRANTY)
|
||||
|
||||
SUPPORT="Send email to nagios-users@lists.sourceforge.net if you have questions\nregarding use of this software. To submit patches or suggest improvements,\nsend email to nagiosplug-devel@lists.sourceforge.net.\nPlease include version information with all correspondence (when possible,\nuse output from the --version option of the plugin itself).\n"
|
||||
SUPPORT="Send email to help@monitoring-plugins.org if you have questions regarding use\nof this software. To submit patches or suggest improvements, send email to\ndevel@monitoring-plugins.org. Please include version information with all\ncorrespondence (when possible, use output from the --version option of the\nplugin itself).\n"
|
||||
AC_SUBST(SUPPORT)
|
||||
|
||||
dnl CGIURL has changed for Nagios with 1.0 beta
|
||||
|
@ -75,9 +75,9 @@ AC_DEFINE_UNQUOTED(CGIURL,"$CGIURL",[URL of CGI programs])
|
|||
|
||||
AC_ARG_WITH(trusted_path,
|
||||
ACX_HELP_STRING([--with-trusted-path=PATH],
|
||||
[sets trusted path for executables called by scripts (default=/bin:/sbin:/usr/bin:/usr/sbin)]),
|
||||
[sets trusted path for executables called by scripts]),
|
||||
with_trusted_path=$withval,
|
||||
with_trusted_path=/bin:/sbin:/usr/bin:/usr/sbin)
|
||||
with_trusted_path=$DEFAULT_PATH)
|
||||
AC_SUBST(with_trusted_path)
|
||||
|
||||
EXTRAS=
|
||||
|
@ -90,6 +90,7 @@ ac_cv_uname_m=`uname -m`
|
|||
ac_cv_uname_s=`uname -s`
|
||||
ac_cv_uname_r=`uname -r`
|
||||
ac_cv_uname_v=`uname -v`
|
||||
ac_cv_uname_o=`uname -o`
|
||||
|
||||
PKG_ARCH=`uname -p`
|
||||
REV_DATESTAMP=`date '+%Y.%m.%d.%H.%M'`
|
||||
|
@ -111,10 +112,7 @@ fi
|
|||
AC_SUBST(NP_RELEASE)
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PATH_PROG(PYTHON,python)
|
||||
AC_PATH_PROG(SH,sh)
|
||||
AC_PATH_PROG(PERL,perl)
|
||||
AC_PATH_PROG(LIBGNUTLS_CONFIG,libgnutls-config)
|
||||
AC_PATH_PROG(HOSTNAME,hostname)
|
||||
AC_PATH_PROG(BASENAME,basename)
|
||||
|
||||
|
@ -194,7 +192,7 @@ AC_ARG_ENABLE(extra-opts,
|
|||
AC_HELP_STRING([--enable-extra-opts],
|
||||
[Enables parsing of plugins ini config files for extra options (default: no)]),
|
||||
[enable_extra_opts=$enableval],
|
||||
[enable_extra_opts=no])
|
||||
[enable_extra_opts=yes])
|
||||
AM_CONDITIONAL([USE_PARSE_INI],[test "$enable_extra_opts" = "yes"])
|
||||
if test "$enable_extra_opts" = "yes" ; then
|
||||
AC_DEFINE(NP_EXTRA_OPTS,[1],[Enable INI file parsing.])
|
||||
|
@ -241,7 +239,7 @@ if test "$ac_cv_lib_crypt_main" = "yes" -a "x$PGSQL" != "xno"; then
|
|||
else
|
||||
AC_SUBST(PGLIBS)
|
||||
AC_SUBST(PGINCLUDE)
|
||||
EXTRAS="$EXTRAS check_pgsql"
|
||||
EXTRAS="$EXTRAS check_pgsql\$(EXEEXT)"
|
||||
fi
|
||||
else
|
||||
AC_MSG_WARN([Skipping PostgreSQL plugin (check_pgsql)])
|
||||
|
@ -261,7 +259,7 @@ AS_IF([test "x$with_dbi" != "xno"], [
|
|||
_SAVEDLIBS="$LIBS"
|
||||
AC_CHECK_LIB(dbi,dbi_initialize)
|
||||
if test "$ac_cv_lib_dbi_dbi_initialize" = "yes"; then
|
||||
EXTRAS="$EXTRAS check_dbi"
|
||||
EXTRAS="$EXTRAS check_dbi\$(EXEEXT)"
|
||||
DBILIBS="-ldbi"
|
||||
AC_SUBST(DBILIBS)
|
||||
else
|
||||
|
@ -276,22 +274,29 @@ AC_ARG_WITH([radius], [AS_HELP_STRING([--without-radius], [Skips the radius plug
|
|||
dnl Check for radius libraries
|
||||
AS_IF([test "x$with_radius" != "xno"], [
|
||||
_SAVEDLIBS="$LIBS"
|
||||
AC_CHECK_LIB(radiusclient,rc_read_config)
|
||||
if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
|
||||
EXTRAS="$EXTRAS check_radius"
|
||||
RADIUSLIBS="-lradiusclient"
|
||||
AC_CHECK_LIB(freeradius-client,rc_read_config)
|
||||
if test "$ac_cv_lib_freeradius_client_rc_read_config" = "yes"; then
|
||||
EXTRAS="$EXTRAS check_radius\$(EXEEXT)"
|
||||
RADIUSLIBS="-lfreeradius-client"
|
||||
AC_SUBST(RADIUSLIBS)
|
||||
else
|
||||
AC_CHECK_LIB(radiusclient-ng,rc_read_config)
|
||||
if test "$ac_cv_lib_radiusclient_ng_rc_read_config" = "yes"; then
|
||||
EXTRAS="$EXTRAS check_radius"
|
||||
EXTRAS="$EXTRAS check_radius\$(EXEEXT)"
|
||||
RADIUSLIBS="-lradiusclient-ng"
|
||||
AC_SUBST(RADIUSLIBS)
|
||||
else
|
||||
AC_CHECK_LIB(radiusclient,rc_read_config)
|
||||
if test "$ac_cv_lib_radiusclient_rc_read_config" = "yes"; then
|
||||
EXTRAS="$EXTRAS check_radius\$(EXEEXT)"
|
||||
RADIUSLIBS="-lradiusclient"
|
||||
AC_SUBST(RADIUSLIBS)
|
||||
else
|
||||
AC_MSG_WARN([Skipping radius plugin])
|
||||
AC_MSG_WARN([install radius libs to compile this plugin (see REQUIREMENTS).])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
LIBS="$_SAVEDLIBS"
|
||||
])
|
||||
|
||||
|
@ -307,7 +312,7 @@ AS_IF([test "x$with_ldap" != "xno"], [
|
|||
AC_SUBST(LDAPLIBS)
|
||||
AC_SUBST(LDAPINCLUDE)
|
||||
AC_CHECK_FUNCS(ldap_set_option)
|
||||
EXTRAS="$EXTRAS check_ldap"
|
||||
EXTRAS="$EXTRAS check_ldap\$(EXEEXT)"
|
||||
AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s)
|
||||
else
|
||||
AC_MSG_WARN([Skipping LDAP plugin])
|
||||
|
@ -344,7 +349,7 @@ case $host in
|
|||
esac
|
||||
|
||||
if test "$FOUNDINCLUDE" = "yes" ; then
|
||||
EXTRAS="$EXTRAS check_ide_smart"
|
||||
EXTRAS="$EXTRAS check_ide_smart\$(EXEEXT)"
|
||||
fi
|
||||
|
||||
dnl Check for mysql libraries
|
||||
|
@ -353,7 +358,7 @@ if test $with_mysql = "no" ; then
|
|||
AC_MSG_WARN([Skipping mysql plugin])
|
||||
AC_MSG_WARN([install mysql client libs to compile this plugin (see REQUIREMENTS).])
|
||||
else
|
||||
EXTRAS="$EXTRAS check_mysql check_mysql_query"
|
||||
EXTRAS="$EXTRAS check_mysql\$(EXEEXT) check_mysql_query\$(EXEEXT)"
|
||||
MYSQLINCLUDE="$np_mysql_include"
|
||||
MYSQLLIBS="$np_mysql_libs"
|
||||
MYSQLCFLAGS="$np_mysql_cflags"
|
||||
|
@ -366,8 +371,16 @@ dnl Check for headers used by check_users
|
|||
AC_CHECK_HEADERS(utmpx.h)
|
||||
AM_CONDITIONAL([HAVE_UTMPX], [test "$ac_cv_header_utmpx_h" = "yes"])
|
||||
|
||||
AC_CHECK_HEADERS(wtsapi32.h, [], [], [#include <windows.h>])
|
||||
AM_CONDITIONAL([HAVE_WTS32API], [test "$ac_cv_header_wtsapi32_h" = "yes"])
|
||||
|
||||
if test "$ac_cv_header_wtsapi32_h" = "yes"; then
|
||||
WTSAPI32LIBS="-lwtsapi32"
|
||||
AC_SUBST(WTSAPI32LIBS)
|
||||
fi
|
||||
|
||||
dnl Fallback to who(1) if the system doesn't provide an utmpx(5) interface
|
||||
if test "$ac_cv_header_utmpx_h" = "no"
|
||||
if test "$ac_cv_header_utmpx_h" = "no" -a "$ac_cv_header_wtsapi32_h" = "no"
|
||||
then
|
||||
AC_PATH_PROG(PATH_TO_WHO,who)
|
||||
|
||||
|
@ -503,8 +516,6 @@ dnl check for gnutls if openssl isn't found (or is disabled)
|
|||
if test ! "$FOUNDOPENSSL" = "yes" && test ! "$with_gnutls" = "no"; then
|
||||
if test ! "$with_gnutls" = ""; then
|
||||
CPPFLAGS="$CPPFLAGS -I${with_gnutls}/include"
|
||||
elif test ! "$LIBGNUTLS_CONFIG" = ""; then
|
||||
CPPFLAGS="$CPPFLAGS -I`$LIBGNUTLS_CONFIG --prefix`"
|
||||
fi
|
||||
AC_CHECK_HEADERS([gnutls/openssl.h],FOUNDGNUTLS="yes",)
|
||||
if test "$FOUNDGNUTLS" = "yes"; then
|
||||
|
@ -648,14 +659,14 @@ elif test "$ac_cv_uname_s" = "SunOS"; then
|
|||
ac_cv_ps_format="%s %d %d %d %d %d %f %s %n"
|
||||
ac_cv_ps_varlist="[procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos]"
|
||||
ac_cv_ps_cols=9
|
||||
AC_MSG_RESULT([using nagios-plugins internal ps command (pst3) for solaris])
|
||||
AC_MSG_RESULT([using monitoring-plugins internal ps command (pst3) for solaris])
|
||||
if test `isainfo -b` = 64 ; then
|
||||
pst3_use_64bit=1
|
||||
AC_MSG_NOTICE([using 64bit pst3])
|
||||
else
|
||||
AC_MSG_NOTICE([using 32bit pst3])
|
||||
fi
|
||||
EXTRAS_ROOT="$EXTRAS_ROOT pst3"
|
||||
EXTRAS_ROOT="$EXTRAS_ROOT pst3\$(EXEEXT)"
|
||||
|
||||
if test "$pst3_use_64bit" = 1; then
|
||||
dnl Test if we can actually compile code in 64bit
|
||||
|
@ -980,7 +991,7 @@ if test -n "$ac_cv_ps_varlist" ; then
|
|||
[Format string for scanning ps output in check_procs])
|
||||
AC_DEFINE_UNQUOTED(PS_COLS,$ac_cv_ps_cols,
|
||||
[Number of columns in ps command])
|
||||
EXTRAS="$EXTRAS check_procs check_nagios"
|
||||
EXTRAS="$EXTRAS check_procs check_nagios\$(EXEEXT)"
|
||||
if echo "$ac_cv_ps_varlist" | grep "procetime" >/dev/null; then
|
||||
AC_DEFINE(PS_USES_PROCETIME,"yes",
|
||||
[Whether the ps utility uses the "procetime" field])
|
||||
|
@ -1014,6 +1025,13 @@ then
|
|||
ac_cv_ping_packets_first=yes
|
||||
fi
|
||||
|
||||
elif [[ "z$ac_cv_uname_o" = "zCygwin" ]]
|
||||
then
|
||||
with_ping_command="$PATH_TO_PING -n %d -w %d000 %s"
|
||||
ac_cv_ping_packets_first=yes
|
||||
ac_cv_ping_has_timeout=yes
|
||||
AC_MSG_RESULT([$with_ping_command])
|
||||
|
||||
elif [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
|
||||
$PATH_TO_PING -n -s 127.0.0.1 56 1 2>/dev/null | \
|
||||
egrep -i "^round-trip|^rtt" >/dev/null
|
||||
|
@ -1124,7 +1142,11 @@ then
|
|||
then
|
||||
ac_cv_ping6_packets_first=yes
|
||||
fi
|
||||
|
||||
elif [[ "z$ac_cv_uname_o" = "zCygwin" -a "x$PATH_TO_PING" != "x" ]]; then
|
||||
with_ping6_command="$PATH_TO_PING -6 -n %d -w %d000 %s"
|
||||
ac_cv_ping6_packets_first=yes
|
||||
ac_cv_ping_has_timeout=yes
|
||||
AC_MSG_RESULT([$with_ping6_command])
|
||||
elif test "x$PATH_TO_PING6" != "x"; then
|
||||
if [[ "z$ac_cv_uname_s" = "zUnixWare" ]] && \
|
||||
$PATH_TO_PING6 -n -s ::1 56 1 2>/dev/null | \
|
||||
|
@ -1302,7 +1324,7 @@ else
|
|||
fi
|
||||
|
||||
if test -n "$ac_cv_nslookup_command"; then
|
||||
EXTRAS="$EXTRAS check_dns"
|
||||
EXTRAS="$EXTRAS check_dns\$(EXEEXT)"
|
||||
AC_DEFINE_UNQUOTED(NSLOOKUP_COMMAND,"$ac_cv_nslookup_command", [path and args for nslookup])
|
||||
fi
|
||||
|
||||
|
@ -1362,7 +1384,7 @@ AC_ARG_WITH(snmpget_command,
|
|||
if test -n "$PATH_TO_SNMPGET"
|
||||
then
|
||||
AC_DEFINE_UNQUOTED(PATH_TO_SNMPGET,"$PATH_TO_SNMPGET",[path to snmpget binary])
|
||||
EXTRAS="$EXTRAS check_hpjd check_snmp"
|
||||
EXTRAS="$EXTRAS check_hpjd check_snmp\$(EXEEXT)"
|
||||
else
|
||||
AC_MSG_WARN([Get snmpget from http://net-snmp.sourceforge.net to make check_hpjd and check_snmp plugins])
|
||||
fi
|
||||
|
@ -1394,12 +1416,12 @@ AC_ARG_WITH(qstat_command,
|
|||
if test -x "$PATH_TO_QUAKESTAT"
|
||||
then
|
||||
ac_cv_path_to_qstat="$PATH_TO_QUAKESTAT"
|
||||
EXTRAS="$EXTRAS check_game"
|
||||
EXTRAS="$EXTRAS check_game\$(EXEEXT)"
|
||||
|
||||
elif test -n "$PATH_TO_QSTAT"
|
||||
then
|
||||
ac_cv_path_to_qstat="$PATH_TO_QSTAT"
|
||||
EXTRAS="$EXTRAS check_game"
|
||||
EXTRAS="$EXTRAS check_game\$(EXEEXT)"
|
||||
else
|
||||
AC_MSG_WARN([Get qstat from http://www.activesw.com/people/steve/qstat.html in order to make check_game plugin])
|
||||
fi
|
||||
|
@ -1423,7 +1445,7 @@ AC_ARG_WITH(fping6_command,
|
|||
if test -n "$PATH_TO_FPING"
|
||||
then
|
||||
AC_DEFINE_UNQUOTED(PATH_TO_FPING,"$PATH_TO_FPING",[path to fping])
|
||||
EXTRAS="$EXTRAS check_fping"
|
||||
EXTRAS="$EXTRAS check_fping\$(EXEEXT)"
|
||||
if test x"$with_ipv6" != xno && test -n "$PATH_TO_FPING6"; then
|
||||
AC_DEFINE_UNQUOTED(PATH_TO_FPING6,"$PATH_TO_FPING6",[path to fping6])
|
||||
fi
|
||||
|
@ -1438,7 +1460,7 @@ AC_ARG_WITH(ssh_command,
|
|||
if test -n "$PATH_TO_SSH"
|
||||
then
|
||||
AC_DEFINE_UNQUOTED(SSH_COMMAND,"$PATH_TO_SSH",[path to ssh binary])
|
||||
EXTRAS="$EXTRAS check_by_ssh"
|
||||
EXTRAS="$EXTRAS check_by_ssh\$(EXEEXT)"
|
||||
else
|
||||
AC_MSG_WARN([Get ssh in order to make check_by_ssh plugin])
|
||||
fi
|
||||
|
@ -1574,7 +1596,7 @@ AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
|
|||
|
||||
if test "$ac_cv_have_decl_swapctl" = "yes";
|
||||
then
|
||||
EXTRAS="$EXTRAS check_swap"
|
||||
EXTRAS="$EXTRAS check_swap\$(EXEEXT)"
|
||||
AC_MSG_CHECKING([for 2-arg (SVR4) swapctl])
|
||||
if test "$ac_cv_type_swaptbl_t" = "yes" -a \
|
||||
"$ac_cv_type_swapent_t" = "yes";
|
||||
|
@ -1630,7 +1652,7 @@ dnl
|
|||
if test "x$ac_cv_have_swap" != "x"
|
||||
then
|
||||
AC_DEFINE(HAVE_SWAP,1,[Define if swap/swapinfo command is found])
|
||||
EXTRAS="$EXTRAS check_swap"
|
||||
EXTRAS="$EXTRAS check_swap\$(EXEEXT)"
|
||||
fi
|
||||
if test "x$ac_cv_swap_command" != "x"
|
||||
then
|
||||
|
@ -1662,7 +1684,7 @@ fi
|
|||
if test -n "$ac_cv_proc_meminfo"; then
|
||||
AC_DEFINE(HAVE_PROC_MEMINFO,1,[Define if we have /proc/meminfo])
|
||||
AC_DEFINE_UNQUOTED(PROC_MEMINFO,"$ac_cv_proc_meminfo",[path to /proc/meminfo if name changes])
|
||||
EXTRAS="$EXTRAS check_swap"
|
||||
EXTRAS="$EXTRAS check_swap\$(EXEEXT)"
|
||||
fi
|
||||
|
||||
AC_PATH_PROG(PATH_TO_DIG,dig)
|
||||
|
@ -1670,7 +1692,7 @@ AC_ARG_WITH(dig_command,
|
|||
ACX_HELP_STRING([--with-dig-command=PATH],
|
||||
[Path to dig command]), PATH_TO_DIG=$withval)
|
||||
if test -n "$PATH_TO_DIG"; then
|
||||
EXTRAS="$EXTRAS check_dig"
|
||||
EXTRAS="$EXTRAS check_dig\$(EXEEXT)"
|
||||
AC_DEFINE_UNQUOTED(PATH_TO_DIG,"$PATH_TO_DIG",[Path to dig command, if present])
|
||||
fi
|
||||
|
||||
|
@ -1682,12 +1704,12 @@ AC_ARG_WITH(apt-get_command,
|
|||
with_apt_get_command=$PATH_TO_APTGET)
|
||||
AC_DEFINE_UNQUOTED(PATH_TO_APTGET,"$PATH_TO_APTGET",[Path to apt-get command, if present])
|
||||
if test -n "$PATH_TO_APTGET" ; then
|
||||
EXTRAS="$EXTRAS check_apt"
|
||||
EXTRAS="$EXTRAS check_apt\$(EXEEXT)"
|
||||
fi
|
||||
|
||||
|
||||
if test -f $srcdir/plugins/check_nt.c ; then
|
||||
EXTRAS="$EXTRAS check_nt"
|
||||
EXTRAS="$EXTRAS check_nt\$(EXEEXT)"
|
||||
fi
|
||||
|
||||
|
||||
|
@ -1731,7 +1753,7 @@ AC_ARG_ENABLE(redhat-pthread-workaround,
|
|||
[ac_cv_enable_redhat_pthread_workaround=test])
|
||||
if test "$ac_cv_enable_redhat_pthread_workaround" = "test" ; then
|
||||
if echo $ac_cv_uname_r | egrep "\.EL(smp)?$" >/dev/null 2>&1 ; then
|
||||
AC_MSG_NOTICE([See http://nagiosplugins.org/faq/compile/configure_appears_to_hang if this next part takes a long time])
|
||||
AC_MSG_NOTICE([See https://www.monitoring-plugins.org/doc/faq/configure-hangs.html if this next part takes a long time])
|
||||
AC_MSG_CHECKING(for redhat spopen problem)
|
||||
( cd config_test && make && make test ) > /dev/null 2>&1
|
||||
if test $? -eq 0 ; then
|
||||
|
@ -1748,7 +1770,7 @@ fi
|
|||
dnl Perl modules
|
||||
AC_ARG_ENABLE(perl-modules,
|
||||
AC_HELP_STRING([--enable-perl-modules],
|
||||
[Enables installation of Nagios::Plugin and its dependencies (default: no)]),
|
||||
[Enables installation of Monitoring::Plugin and its dependencies (default: no)]),
|
||||
[enable_perl_modules=$enableval],
|
||||
[enable_perl_modules=no])
|
||||
if test "$enable_perl_modules" = "yes" ; then
|
||||
|
@ -1783,10 +1805,8 @@ AC_OUTPUT(
|
|||
lib/tests/Makefile
|
||||
plugins-root/Makefile
|
||||
plugins-scripts/Makefile
|
||||
plugins-scripts/subst
|
||||
plugins-scripts/utils.pm
|
||||
plugins-scripts/utils.sh
|
||||
perlmods/Makefile
|
||||
test.pl
|
||||
pkg/solaris/pkginfo
|
||||
po/Makefile.in
|
|
@ -21,7 +21,7 @@
|
|||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# Generated by gnulib-tool.
|
||||
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files base64 crypto/sha1 dirname environ floorf fsusage getaddrinfo gethostname getloadavg getopt-gnu gettext mountlist regex setenv strsep timegm unsetenv vasprintf vsnprintf
|
||||
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files base64 crypto/sha1 dirname environ floorf fsusage getaddrinfo gethostname getloadavg getopt-gnu gettext idpriv-droptemp mountlist regex setenv strcase strsep timegm unsetenv vasprintf vsnprintf
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.9.6 gnits subdir-objects
|
||||
|
||||
|
@ -402,6 +402,14 @@ EXTRA_DIST += $(top_srcdir)/build-aux/config.rpath
|
|||
|
||||
## end gnulib module havelib
|
||||
|
||||
## begin gnulib module idpriv-droptemp
|
||||
|
||||
libgnu_a_SOURCES += idpriv-droptemp.c
|
||||
|
||||
EXTRA_DIST += idpriv.h
|
||||
|
||||
## end gnulib module idpriv-droptemp
|
||||
|
||||
## begin gnulib module inet_ntop
|
||||
|
||||
|
||||
|
@ -1536,6 +1544,15 @@ EXTRA_DIST += stdlib.in.h
|
|||
|
||||
## end gnulib module stdlib
|
||||
|
||||
## begin gnulib module strcase
|
||||
|
||||
|
||||
EXTRA_DIST += strcasecmp.c strncasecmp.c
|
||||
|
||||
EXTRA_libgnu_a_SOURCES += strcasecmp.c strncasecmp.c
|
||||
|
||||
## end gnulib module strcase
|
||||
|
||||
## begin gnulib module streq
|
||||
|
||||
|
||||
|
@ -1661,6 +1678,37 @@ EXTRA_DIST += string.in.h
|
|||
|
||||
## end gnulib module string
|
||||
|
||||
## begin gnulib module strings
|
||||
|
||||
BUILT_SOURCES += strings.h
|
||||
|
||||
# We need the following in order to create <strings.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
strings.h: strings.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
|
||||
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
|
||||
-e 's|@''HAVE_STRINGS_H''@|$(HAVE_STRINGS_H)|g' \
|
||||
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
|
||||
-e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \
|
||||
-e 's|@''GNULIB_FFS''@|$(GNULIB_FFS)|g' \
|
||||
-e 's|@''HAVE_FFS''@|$(HAVE_FFS)|g' \
|
||||
-e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
|
||||
-e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
|
||||
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
|
||||
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
|
||||
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
|
||||
< $(srcdir)/strings.in.h; \
|
||||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += strings.h strings.h-t
|
||||
|
||||
EXTRA_DIST += strings.in.h
|
||||
|
||||
## end gnulib module strings
|
||||
|
||||
## begin gnulib module strndup
|
||||
|
||||
|
||||
|
|
134
gl/Makefile.in
134
gl/Makefile.in
|
@ -36,7 +36,7 @@
|
|||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# Generated by gnulib-tool.
|
||||
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files base64 crypto/sha1 dirname environ floorf fsusage getaddrinfo gethostname getloadavg getopt-gnu gettext mountlist regex setenv strsep timegm unsetenv vasprintf vsnprintf
|
||||
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files base64 crypto/sha1 dirname environ floorf fsusage getaddrinfo gethostname getloadavg getopt-gnu gettext idpriv-droptemp mountlist regex setenv strcase strsep timegm unsetenv vasprintf vsnprintf
|
||||
|
||||
|
||||
|
||||
|
@ -104,6 +104,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 \
|
||||
|
@ -153,11 +154,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 \
|
||||
|
@ -172,7 +174,7 @@ 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
|
||||
|
@ -187,9 +189,9 @@ am_libgnu_a_OBJECTS = base64.$(OBJEXT) sha1.$(OBJEXT) \
|
|||
dirname.$(OBJEXT) basename.$(OBJEXT) dirname-lgpl.$(OBJEXT) \
|
||||
basename-lgpl.$(OBJEXT) stripslash.$(OBJEXT) \
|
||||
exitfail.$(OBJEXT) fd-hook.$(OBJEXT) full-read.$(OBJEXT) \
|
||||
localcharset.$(OBJEXT) glthread/lock.$(OBJEXT) \
|
||||
malloca.$(OBJEXT) math.$(OBJEXT) safe-read.$(OBJEXT) \
|
||||
sockets.$(OBJEXT) sys_socket.$(OBJEXT) \
|
||||
idpriv-droptemp.$(OBJEXT) localcharset.$(OBJEXT) \
|
||||
glthread/lock.$(OBJEXT) malloca.$(OBJEXT) math.$(OBJEXT) \
|
||||
safe-read.$(OBJEXT) sockets.$(OBJEXT) sys_socket.$(OBJEXT) \
|
||||
glthread/threadlib.$(OBJEXT) unistd.$(OBJEXT) \
|
||||
wctype-h.$(OBJEXT) xmalloc.$(OBJEXT) xalloc-die.$(OBJEXT) \
|
||||
xsize.$(OBJEXT) xstrndup.$(OBJEXT)
|
||||
|
@ -369,6 +371,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@
|
||||
|
@ -734,6 +737,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@
|
||||
|
@ -763,6 +767,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@
|
||||
|
@ -874,8 +879,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@
|
||||
|
@ -966,7 +973,6 @@ LD = @LD@
|
|||
LDAPINCLUDE = @LDAPINCLUDE@
|
||||
LDAPLIBS = @LDAPLIBS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
|
||||
LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@
|
||||
LIBGNU_LTLIBDEPS = @LIBGNU_LTLIBDEPS@
|
||||
LIBICONV = @LIBICONV@
|
||||
|
@ -992,6 +998,7 @@ LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
|
|||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LTLIBPTH = @LTLIBPTH@
|
||||
LTLIBTHREAD = @LTLIBTHREAD@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MATHLIBS = @MATHLIBS@
|
||||
|
@ -1017,6 +1024,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@
|
||||
|
@ -1037,6 +1045,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@
|
||||
|
@ -1096,7 +1105,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@
|
||||
|
@ -1288,7 +1296,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@
|
||||
|
@ -1312,6 +1319,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@
|
||||
|
@ -1399,30 +1407,31 @@ EXTRA_DIST = m4/gnulib-cache.m4 alloca.in.h arpa_inet.in.h btowc.c \
|
|||
gai_strerror.c getaddrinfo.c gethostname.c w32sock.h \
|
||||
getloadavg.c getopt.c getopt.in.h getopt1.c getopt_int.h \
|
||||
$(top_srcdir)/build-aux/config.rpath \
|
||||
$(top_srcdir)/build-aux/config.rpath inet_ntop.c intprops.h \
|
||||
langinfo.in.h config.charset ref-add.sin ref-del.sin \
|
||||
locale.in.h localeconv.c malloc.c malloc.c malloca.h \
|
||||
malloca.valgrind math.in.h mbrtowc.c mbsinit.c mbtowc-impl.h \
|
||||
mbtowc.c memchr.c memchr.valgrind mktime-internal.h mktime.c \
|
||||
mktime-internal.h mktime.c mountlist.c mountlist.h \
|
||||
msvc-inval.c msvc-inval.h msvc-nothrow.c msvc-nothrow.h \
|
||||
netdb.in.h netinet_in.in.h nl_langinfo.c read.c regcomp.c \
|
||||
regex.c regex.h regex_internal.c regex_internal.h regexec.c \
|
||||
safe-read.h setenv.c \
|
||||
$(top_srcdir)/build-aux/snippet/_Noreturn.h \
|
||||
$(top_srcdir)/build-aux/config.rpath idpriv.h inet_ntop.c \
|
||||
intprops.h langinfo.in.h config.charset ref-add.sin \
|
||||
ref-del.sin locale.in.h localeconv.c malloc.c malloc.c \
|
||||
malloca.h malloca.valgrind math.in.h mbrtowc.c mbsinit.c \
|
||||
mbtowc-impl.h mbtowc.c memchr.c memchr.valgrind \
|
||||
mktime-internal.h mktime.c mktime-internal.h mktime.c \
|
||||
mountlist.c mountlist.h msvc-inval.c msvc-inval.h \
|
||||
msvc-nothrow.c msvc-nothrow.h netdb.in.h netinet_in.in.h \
|
||||
nl_langinfo.c read.c regcomp.c regex.c regex.h \
|
||||
regex_internal.c regex_internal.h regexec.c safe-read.h \
|
||||
setenv.c $(top_srcdir)/build-aux/snippet/_Noreturn.h \
|
||||
$(top_srcdir)/build-aux/snippet/arg-nonnull.h \
|
||||
$(top_srcdir)/build-aux/snippet/c++defs.h \
|
||||
$(top_srcdir)/build-aux/snippet/warn-on-use.h snprintf.c \
|
||||
w32sock.h stdalign.in.h stdbool.in.h stddef.in.h stdint.in.h \
|
||||
stdio.in.h stdlib.in.h streq.h strerror.c strerror-override.c \
|
||||
strerror-override.h string.in.h strndup.c strnlen.c strsep.c \
|
||||
str-two-way.h strstr.c sys_socket.in.h sys_types.in.h \
|
||||
sys_uio.in.h $(top_srcdir)/build-aux/config.rpath time.in.h \
|
||||
time_r.c mktime-internal.h timegm.c unistd.in.h unsetenv.c \
|
||||
asnprintf.c float+.h printf-args.c printf-args.h \
|
||||
printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h \
|
||||
asprintf.c vasprintf.c verify.h vsnprintf.c wchar.in.h \
|
||||
wcrtomb.c wctype.in.h xalloc.h xalloc-oversized.h
|
||||
stdio.in.h stdlib.in.h strcasecmp.c strncasecmp.c streq.h \
|
||||
strerror.c strerror-override.c strerror-override.h string.in.h \
|
||||
strings.in.h strndup.c strnlen.c strsep.c str-two-way.h \
|
||||
strstr.c sys_socket.in.h sys_types.in.h sys_uio.in.h \
|
||||
$(top_srcdir)/build-aux/config.rpath time.in.h time_r.c \
|
||||
mktime-internal.h timegm.c unistd.in.h unsetenv.c asnprintf.c \
|
||||
float+.h printf-args.c printf-args.h printf-parse.c \
|
||||
printf-parse.h vasnprintf.c vasnprintf.h asprintf.c \
|
||||
vasprintf.c verify.h vsnprintf.c wchar.in.h wcrtomb.c \
|
||||
wctype.in.h xalloc.h xalloc-oversized.h
|
||||
|
||||
# The BUILT_SOURCES created by this Makefile snippet are not used via #include
|
||||
# statements but through direct file reference. Therefore this snippet must be
|
||||
|
@ -1437,8 +1446,8 @@ BUILT_SOURCES = $(ALLOCA_H) arpa/inet.h configmake.h $(ERRNO_H) \
|
|||
$(FLOAT_H) $(GETOPT_H) langinfo.h locale.h math.h netdb.h \
|
||||
$(NETINET_IN_H) arg-nonnull.h c++defs.h warn-on-use.h \
|
||||
$(STDALIGN_H) $(STDBOOL_H) $(STDDEF_H) $(STDINT_H) stdio.h \
|
||||
stdlib.h string.h sys/socket.h sys/types.h sys/uio.h time.h \
|
||||
unistd.h wchar.h wctype.h
|
||||
stdlib.h string.h strings.h sys/socket.h sys/types.h sys/uio.h \
|
||||
time.h unistd.h wchar.h wctype.h
|
||||
SUFFIXES = .sed .sin
|
||||
MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t arpa/inet.h \
|
||||
arpa/inet.h-t errno.h errno.h-t float.h float.h-t getopt.h \
|
||||
|
@ -1448,9 +1457,9 @@ MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t arpa/inet.h \
|
|||
warn-on-use.h warn-on-use.h-t stdalign.h stdalign.h-t \
|
||||
stdbool.h stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t \
|
||||
stdio.h stdio.h-t stdlib.h stdlib.h-t string.h string.h-t \
|
||||
sys/socket.h sys/socket.h-t sys/types.h sys/types.h-t \
|
||||
sys/uio.h sys/uio.h-t time.h time.h-t unistd.h unistd.h-t \
|
||||
wchar.h wchar.h-t wctype.h wctype.h-t
|
||||
strings.h strings.h-t sys/socket.h sys/socket.h-t sys/types.h \
|
||||
sys/types.h-t sys/uio.h sys/uio.h-t time.h time.h-t unistd.h \
|
||||
unistd.h-t wchar.h wchar.h-t wctype.h wctype.h-t
|
||||
MOSTLYCLEANDIRS = arpa netinet sys sys
|
||||
CLEANFILES = configmake.h configmake.h-t charset.alias ref-add.sed \
|
||||
ref-del.sed
|
||||
|
@ -1460,11 +1469,11 @@ AM_CPPFLAGS =
|
|||
AM_CFLAGS =
|
||||
libgnu_a_SOURCES = base64.h base64.c sha1.c dirname.c basename.c \
|
||||
dirname-lgpl.c basename-lgpl.c stripslash.c exitfail.c \
|
||||
fd-hook.c full-read.h full-read.c gettext.h localcharset.h \
|
||||
localcharset.c glthread/lock.h glthread/lock.c malloca.c \
|
||||
math.c safe-read.c size_max.h sockets.h sockets.c sys_socket.c \
|
||||
glthread/threadlib.c unistd.c wctype-h.c xmalloc.c \
|
||||
xalloc-die.c xsize.h xsize.c xstrndup.h xstrndup.c
|
||||
fd-hook.c full-read.h full-read.c gettext.h idpriv-droptemp.c \
|
||||
localcharset.h localcharset.c glthread/lock.h glthread/lock.c \
|
||||
malloca.c math.c safe-read.c size_max.h sockets.h sockets.c \
|
||||
sys_socket.c glthread/threadlib.c unistd.c wctype-h.c \
|
||||
xmalloc.c xalloc-die.c xsize.h xsize.c xstrndup.h xstrndup.c
|
||||
libgnu_a_LIBADD = $(gl_LIBOBJS)
|
||||
libgnu_a_DEPENDENCIES = $(gl_LIBOBJS)
|
||||
EXTRA_libgnu_a_SOURCES = btowc.c stripslash.c error.c float.c itold.c \
|
||||
|
@ -1473,11 +1482,11 @@ EXTRA_libgnu_a_SOURCES = btowc.c stripslash.c error.c float.c itold.c \
|
|||
inet_ntop.c localeconv.c malloc.c malloc.c mbrtowc.c mbsinit.c \
|
||||
mbtowc.c memchr.c mktime.c mktime.c mountlist.c msvc-inval.c \
|
||||
msvc-nothrow.c nl_langinfo.c read.c regcomp.c regex.c \
|
||||
regex_internal.c regexec.c setenv.c snprintf.c strerror.c \
|
||||
strerror-override.c strndup.c strnlen.c strsep.c strstr.c \
|
||||
time_r.c timegm.c unsetenv.c asnprintf.c printf-args.c \
|
||||
printf-parse.c vasnprintf.c asprintf.c vasprintf.c vsnprintf.c \
|
||||
wcrtomb.c
|
||||
regex_internal.c regexec.c setenv.c snprintf.c strcasecmp.c \
|
||||
strncasecmp.c strerror.c strerror-override.c strndup.c \
|
||||
strnlen.c strsep.c strstr.c time_r.c timegm.c unsetenv.c \
|
||||
asnprintf.c printf-args.c printf-parse.c vasnprintf.c \
|
||||
asprintf.c vasprintf.c vsnprintf.c wcrtomb.c
|
||||
charset_alias = $(DESTDIR)$(libdir)/charset.alias
|
||||
charset_tmp = $(DESTDIR)$(libdir)/charset.tmp
|
||||
|
||||
|
@ -1493,7 +1502,7 @@ all: $(BUILT_SOURCES)
|
|||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .sed .sin .c .lo .o .obj
|
||||
$(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*) \
|
||||
|
@ -1518,9 +1527,9 @@ 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):
|
||||
|
||||
|
@ -1581,6 +1590,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getloadavg.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idpriv-droptemp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inet_ntop.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/itold.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localcharset.Po@am__quote@
|
||||
|
@ -1609,9 +1619,11 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha1.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snprintf.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sockets.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strcasecmp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerror-override.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerror.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stripslash.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strncasecmp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strndup.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnlen.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strsep.Po@am__quote@
|
||||
|
@ -2952,6 +2964,28 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
|
|||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
# We need the following in order to create <strings.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
strings.h: strings.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
|
||||
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
|
||||
-e 's|@''HAVE_STRINGS_H''@|$(HAVE_STRINGS_H)|g' \
|
||||
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
|
||||
-e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \
|
||||
-e 's|@''GNULIB_FFS''@|$(GNULIB_FFS)|g' \
|
||||
-e 's|@''HAVE_FFS''@|$(HAVE_FFS)|g' \
|
||||
-e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
|
||||
-e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
|
||||
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
|
||||
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
|
||||
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
|
||||
< $(srcdir)/strings.in.h; \
|
||||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
|
||||
# We need the following in order to create <sys/socket.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
sys/socket.h: sys_socket.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
|
||||
|
|
204
gl/idpriv-droptemp.c
Normal file
204
gl/idpriv-droptemp.c
Normal file
|
@ -0,0 +1,204 @@
|
|||
/* Dropping uid/gid privileges of the current process temporarily.
|
||||
Copyright (C) 2009-2013 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "idpriv.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* The privileged uid and gid that the process had earlier. */
|
||||
#if HAVE_GETUID
|
||||
static int saved_uid = -1;
|
||||
#endif
|
||||
#if HAVE_GETGID
|
||||
static int saved_gid = -1;
|
||||
#endif
|
||||
|
||||
int
|
||||
idpriv_temp_drop (void)
|
||||
{
|
||||
#if HAVE_GETEUID && HAVE_GETEGID && (HAVE_SETRESUID || HAVE_SETREUID) && (HAVE_SETRESGID || HAVE_SETREGID)
|
||||
int uid = getuid ();
|
||||
int gid = getgid ();
|
||||
|
||||
/* Find out about the privileged uid and gid at the first call. */
|
||||
if (saved_uid == -1)
|
||||
saved_uid = geteuid ();
|
||||
if (saved_gid == -1)
|
||||
saved_gid = getegid ();
|
||||
|
||||
/* Drop the gid privilege first, because in some cases the gid privilege
|
||||
cannot be dropped after the uid privilege has been dropped. */
|
||||
|
||||
/* This is for executables that have the setgid bit set. */
|
||||
# if HAVE_SETRESGID /* glibc, FreeBSD, OpenBSD, HP-UX */
|
||||
if (setresgid (-1, gid, saved_gid) < 0)
|
||||
return -1;
|
||||
# else /* Mac OS X, NetBSD, AIX, IRIX, Solaris >= 2.5, OSF/1, Cygwin */
|
||||
if (setregid (-1, gid) < 0)
|
||||
return -1;
|
||||
# endif
|
||||
|
||||
/* This is for executables that have the setuid bit set. */
|
||||
# if HAVE_SETRESUID /* glibc, FreeBSD, OpenBSD, HP-UX */
|
||||
/* See <http://www.usenix.org/events/sec02/full_papers/chen/chen.pdf>
|
||||
figure 14. */
|
||||
if (setresuid (-1, uid, saved_uid) < 0)
|
||||
return -1;
|
||||
# else /* Mac OS X, NetBSD, AIX, IRIX, Solaris >= 2.5, OSF/1, Cygwin */
|
||||
if (setreuid (-1, uid) < 0)
|
||||
return -1;
|
||||
# endif
|
||||
|
||||
/* Verify that the privileges have really been dropped.
|
||||
This verification is here for security reasons. Doesn't matter if it
|
||||
takes a couple of system calls.
|
||||
When the verification fails, it indicates that we need to use different
|
||||
API in the code above. Therefore 'abort ()', not 'return -1'. */
|
||||
# if HAVE_GETRESUID /* glibc, FreeBSD, OpenBSD, HP-UX */
|
||||
{
|
||||
uid_t real;
|
||||
uid_t effective;
|
||||
uid_t saved;
|
||||
if (getresuid (&real, &effective, &saved) < 0
|
||||
|| real != uid
|
||||
|| effective != uid
|
||||
|| saved != saved_uid)
|
||||
abort ();
|
||||
}
|
||||
# else
|
||||
# if HAVE_GETEUID
|
||||
if (geteuid () != uid)
|
||||
abort ();
|
||||
# endif
|
||||
if (getuid () != uid)
|
||||
abort ();
|
||||
# endif
|
||||
# if HAVE_GETRESGID /* glibc, FreeBSD, OpenBSD, HP-UX */
|
||||
{
|
||||
uid_t real;
|
||||
uid_t effective;
|
||||
uid_t saved;
|
||||
if (getresgid (&real, &effective, &saved) < 0
|
||||
|| real != gid
|
||||
|| effective != gid
|
||||
|| saved != saved_gid)
|
||||
abort ();
|
||||
}
|
||||
# else
|
||||
# if HAVE_GETEGID
|
||||
if (getegid () != gid)
|
||||
abort ();
|
||||
# endif
|
||||
if (getgid () != gid)
|
||||
abort ();
|
||||
# endif
|
||||
|
||||
return 0;
|
||||
#else
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
idpriv_temp_restore (void)
|
||||
{
|
||||
#if HAVE_GETEUID && HAVE_GETEGID && (HAVE_SETRESUID || HAVE_SETREUID) && (HAVE_SETRESGID || HAVE_SETREGID)
|
||||
int uid = getuid ();
|
||||
int gid = getgid ();
|
||||
|
||||
if (saved_uid == -1 || saved_gid == -1)
|
||||
/* Caller error: idpriv_temp_drop was never invoked. */
|
||||
abort ();
|
||||
|
||||
/* Acquire the gid privilege last, because in some cases the gid privilege
|
||||
cannot be acquired before the uid privilege has been acquired. */
|
||||
|
||||
/* This is for executables that have the setuid bit set. */
|
||||
# if HAVE_SETRESUID /* glibc, FreeBSD, OpenBSD, HP-UX */
|
||||
/* See <http://www.usenix.org/events/sec02/full_papers/chen/chen.pdf>
|
||||
figure 14. */
|
||||
if (setresuid (-1, saved_uid, -1) < 0)
|
||||
return -1;
|
||||
# else /* Mac OS X, NetBSD, AIX, IRIX, Solaris >= 2.5, OSF/1, Cygwin */
|
||||
if (setreuid (-1, saved_uid) < 0)
|
||||
return -1;
|
||||
# endif
|
||||
|
||||
/* This is for executables that have the setgid bit set. */
|
||||
# if HAVE_SETRESGID /* glibc, FreeBSD, OpenBSD, HP-UX */
|
||||
if (setresgid (-1, saved_gid, -1) < 0)
|
||||
return -1;
|
||||
# else /* Mac OS X, NetBSD, AIX, IRIX, Solaris >= 2.5, OSF/1, Cygwin */
|
||||
if (setregid (-1, saved_gid) < 0)
|
||||
return -1;
|
||||
# endif
|
||||
|
||||
/* Verify that the privileges have really been acquired.
|
||||
This verification is here for security reasons. Doesn't matter if it
|
||||
takes a couple of system calls.
|
||||
When the verification fails, it indicates that we need to use different
|
||||
API in the code above. Therefore 'abort ()', not 'return -1'. */
|
||||
# if HAVE_GETRESUID /* glibc, FreeBSD, OpenBSD, HP-UX */
|
||||
{
|
||||
uid_t real;
|
||||
uid_t effective;
|
||||
uid_t saved;
|
||||
if (getresuid (&real, &effective, &saved) < 0
|
||||
|| real != uid
|
||||
|| effective != saved_uid
|
||||
|| saved != saved_uid)
|
||||
abort ();
|
||||
}
|
||||
# else
|
||||
# if HAVE_GETEUID
|
||||
if (geteuid () != saved_uid)
|
||||
abort ();
|
||||
# endif
|
||||
if (getuid () != uid)
|
||||
abort ();
|
||||
# endif
|
||||
# if HAVE_GETRESGID /* glibc, FreeBSD, OpenBSD, HP-UX */
|
||||
{
|
||||
uid_t real;
|
||||
uid_t effective;
|
||||
uid_t saved;
|
||||
if (getresgid (&real, &effective, &saved) < 0
|
||||
|| real != gid
|
||||
|| effective != saved_gid
|
||||
|| saved != saved_gid)
|
||||
abort ();
|
||||
}
|
||||
# else
|
||||
# if HAVE_GETEGID
|
||||
if (getegid () != saved_gid)
|
||||
abort ();
|
||||
# endif
|
||||
if (getgid () != gid)
|
||||
abort ();
|
||||
# endif
|
||||
|
||||
return 0;
|
||||
#else
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
#endif
|
||||
}
|
116
gl/idpriv.h
Normal file
116
gl/idpriv.h
Normal file
|
@ -0,0 +1,116 @@
|
|||
/* Dropping uid/gid privileges of the current process.
|
||||
Copyright (C) 2009-2013 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _IDPRIV_H
|
||||
#define _IDPRIV_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This module allows programs which are installed with setuid or setgid bit
|
||||
(and which therefore initially run with an effective user id or group id
|
||||
different from the one of the current user) to drop their uid or gid
|
||||
privilege, either permanently or temporarily.
|
||||
|
||||
It is absolutely necessary to minimize the amount of code that is running
|
||||
with escalated privileges (e.g. with effective uid = root). The reason is
|
||||
that any bug or exploit in a part of a program that is running with
|
||||
escalated privileges is a security vulnerability that - upon discovery -
|
||||
puts the users in danger and requires immediate fixing. Then consider that
|
||||
there's a bug every 10 or 20 lines of code on average...
|
||||
|
||||
For programs that temporarily drop privileges but have the ability to
|
||||
restore them later, there are additionally the dangers that
|
||||
- Any bug in the non-privileged part of the program may be used to
|
||||
create invalid data structures that will trigger security
|
||||
vulnerabilities in the privileged part of the program.
|
||||
- Code execution exploits in the non-privileged part of the program may
|
||||
be used to invoke the function that restores high privileges and then
|
||||
execute additional arbitrary code.
|
||||
|
||||
1) The usual, and reasonably safe, way to minimize the amount of code
|
||||
running with privileges is to create a separate executable, with setuid
|
||||
or setgid bit, that contains only code for the tasks that require
|
||||
privileges (and,of course, strict checking of the arguments, so that the
|
||||
program cannot be abused). The main program is installed without setuid
|
||||
or setgid bit.
|
||||
|
||||
2) A less safe way is to do some privileged tasks at the beginning of the
|
||||
program's run, and drop privileges permanently as soon as possible.
|
||||
|
||||
Note: There may still be security issues if the privileged task puts
|
||||
sensitive data into the process memory or opens communication channels
|
||||
to restricted facilities.
|
||||
|
||||
3) The most unsafe way is to drop privileges temporarily for most of the
|
||||
main program but to re-enable them for the duration of privileged tasks.
|
||||
|
||||
As explained above, this approach has uncontrollable dangers for
|
||||
security.
|
||||
|
||||
This approach is normally not usable in multithreaded programs, because
|
||||
you cannot know what kind of system calls the other threads could be
|
||||
doing during the time the privileges are enabled.
|
||||
|
||||
With approach 1, you don't need gnulib modules.
|
||||
With approach 2, you need the gnulib module 'idpriv-drop'.
|
||||
With approach 3, you need the gnulib module 'idpriv-droptemp'. But really,
|
||||
you should better stay away from this approach.
|
||||
*/
|
||||
|
||||
/* For more in-depth discussion of these topics, see the papers/articles
|
||||
* Hao Chen, David Wagner, Drew Dean: Setuid Demystified
|
||||
<http://www.usenix.org/events/sec02/full_papers/chen/chen.pdf>
|
||||
* Dan Tsafrir, Dilma da Silva, David Wagner: The Murky Issue of Changing
|
||||
Process Identity: Revising "Setuid Demystified"
|
||||
<http://www.eecs.berkeley.edu/~daw/papers/setuid-login08b.pdf>
|
||||
<http://code.google.com/p/change-process-identity/>
|
||||
* Dhruv Mohindra: Observe correct revocation order while relinquishing
|
||||
privileges
|
||||
<https://www.securecoding.cert.org/confluence/display/seccode/POS36-C.+Observe+correct+revocation+order+while+relinquishing+privileges>
|
||||
*/
|
||||
|
||||
|
||||
/* For approach 2. */
|
||||
|
||||
/* Drop the uid and gid privileges of the current process.
|
||||
Return 0 if successful, or -1 with errno set upon failure. The recommended
|
||||
handling of failure is to terminate the process. */
|
||||
extern int idpriv_drop (void);
|
||||
|
||||
|
||||
/* For approach 3. */
|
||||
|
||||
/* Drop the uid and gid privileges of the current process in a way that allows
|
||||
them to be restored later.
|
||||
Return 0 if successful, or -1 with errno set upon failure. The recommended
|
||||
handling of failure is to terminate the process. */
|
||||
extern int idpriv_temp_drop (void);
|
||||
|
||||
/* Restore the uid and gid privileges of the current process.
|
||||
Return 0 if successful, or -1 with errno set upon failure. The recommended
|
||||
handling of failure is to not perform the actions that require the escalated
|
||||
privileges. */
|
||||
extern int idpriv_temp_restore (void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _IDPRIV_H */
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
|
||||
# Specification in the form of a command-line invocation:
|
||||
# gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files base64 crypto/sha1 dirname environ floorf fsusage getaddrinfo gethostname getloadavg getopt-gnu gettext mountlist regex setenv strsep timegm unsetenv vasprintf vsnprintf
|
||||
# gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files base64 crypto/sha1 dirname environ floorf fsusage getaddrinfo gethostname getloadavg getopt-gnu gettext idpriv-droptemp mountlist regex setenv strcase strsep timegm unsetenv vasprintf vsnprintf
|
||||
|
||||
# Specification in the form of a few gnulib-tool.m4 macro invocations:
|
||||
gl_LOCAL_DIR([])
|
||||
|
@ -43,9 +43,11 @@ gl_MODULES([
|
|||
getloadavg
|
||||
getopt-gnu
|
||||
gettext
|
||||
idpriv-droptemp
|
||||
mountlist
|
||||
regex
|
||||
setenv
|
||||
strcase
|
||||
strsep
|
||||
timegm
|
||||
unsetenv
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
# other built files.
|
||||
|
||||
|
||||
# This macro should be invoked from ./configure.in, in the section
|
||||
# This macro should be invoked from ./configure.ac, in the section
|
||||
# "Checks for programs", right after AC_PROG_CC, and certainly before
|
||||
# any checks for libraries, header files, types and library functions.
|
||||
AC_DEFUN([gl_EARLY],
|
||||
|
@ -70,6 +70,7 @@ AC_DEFUN([gl_EARLY],
|
|||
# Code from module gettext-h:
|
||||
# Code from module havelib:
|
||||
# Code from module hostent:
|
||||
# Code from module idpriv-droptemp:
|
||||
# Code from module include_next:
|
||||
# Code from module inet_ntop:
|
||||
# Code from module intprops:
|
||||
|
@ -119,10 +120,12 @@ AC_DEFUN([gl_EARLY],
|
|||
# Code from module stdint:
|
||||
# Code from module stdio:
|
||||
# Code from module stdlib:
|
||||
# Code from module strcase:
|
||||
# Code from module streq:
|
||||
# Code from module strerror:
|
||||
# Code from module strerror-override:
|
||||
# Code from module string:
|
||||
# Code from module strings:
|
||||
# Code from module strndup:
|
||||
# Code from module strnlen:
|
||||
# Code from module strsep:
|
||||
|
@ -151,7 +154,7 @@ AC_DEFUN([gl_EARLY],
|
|||
# Code from module xstrndup:
|
||||
])
|
||||
|
||||
# This macro should be invoked from ./configure.in, in the section
|
||||
# This macro should be invoked from ./configure.ac, in the section
|
||||
# "Check for header files, types and library functions".
|
||||
AC_DEFUN([gl_INIT],
|
||||
[
|
||||
|
@ -256,6 +259,7 @@ AC_DEFUN([gl_INIT],
|
|||
AC_SUBST([LIBINTL])
|
||||
AC_SUBST([LTLIBINTL])
|
||||
gl_HOSTENT
|
||||
gl_IDPRIV
|
||||
gl_FUNC_INET_NTOP
|
||||
if test $HAVE_INET_NTOP = 0 || test $REPLACE_INET_NTOP = 1; then
|
||||
AC_LIBOBJ([inet_ntop])
|
||||
|
@ -377,6 +381,15 @@ AC_DEFUN([gl_INIT],
|
|||
gl_STDINT_H
|
||||
gl_STDIO_H
|
||||
gl_STDLIB_H
|
||||
gl_STRCASE
|
||||
if test $HAVE_STRCASECMP = 0; then
|
||||
AC_LIBOBJ([strcasecmp])
|
||||
gl_PREREQ_STRCASECMP
|
||||
fi
|
||||
if test $HAVE_STRNCASECMP = 0; then
|
||||
AC_LIBOBJ([strncasecmp])
|
||||
gl_PREREQ_STRNCASECMP
|
||||
fi
|
||||
gl_FUNC_STRERROR
|
||||
if test $REPLACE_STRERROR = 1; then
|
||||
AC_LIBOBJ([strerror])
|
||||
|
@ -390,6 +403,7 @@ AC_DEFUN([gl_INIT],
|
|||
gl_PREREQ_SYS_H_WINSOCK2
|
||||
fi
|
||||
gl_HEADER_STRING_H
|
||||
gl_HEADER_STRINGS_H
|
||||
gl_FUNC_STRNDUP
|
||||
if test $HAVE_STRNDUP = 0 || test $REPLACE_STRNDUP = 1; then
|
||||
AC_LIBOBJ([strndup])
|
||||
|
@ -646,6 +660,8 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
lib/glthread/lock.c
|
||||
lib/glthread/lock.h
|
||||
lib/glthread/threadlib.c
|
||||
lib/idpriv-droptemp.c
|
||||
lib/idpriv.h
|
||||
lib/inet_ntop.c
|
||||
lib/intprops.h
|
||||
lib/itold.c
|
||||
|
@ -706,12 +722,15 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
lib/stdio.in.h
|
||||
lib/stdlib.in.h
|
||||
lib/str-two-way.h
|
||||
lib/strcasecmp.c
|
||||
lib/streq.h
|
||||
lib/strerror-override.c
|
||||
lib/strerror-override.h
|
||||
lib/strerror.c
|
||||
lib/string.in.h
|
||||
lib/strings.in.h
|
||||
lib/stripslash.c
|
||||
lib/strncasecmp.c
|
||||
lib/strndup.c
|
||||
lib/strnlen.c
|
||||
lib/strsep.c
|
||||
|
@ -775,6 +794,7 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
m4/gnulib-common.m4
|
||||
m4/hostent.m4
|
||||
m4/iconv.m4
|
||||
m4/idpriv.m4
|
||||
m4/include_next.m4
|
||||
m4/inet_ntop.m4
|
||||
m4/intdiv0.m4
|
||||
|
@ -845,8 +865,10 @@ AC_DEFUN([gl_FILE_LIST], [
|
|||
m4/stdint_h.m4
|
||||
m4/stdio_h.m4
|
||||
m4/stdlib_h.m4
|
||||
m4/strcase.m4
|
||||
m4/strerror.m4
|
||||
m4/string_h.m4
|
||||
m4/strings_h.m4
|
||||
m4/strndup.m4
|
||||
m4/strnlen.m4
|
||||
m4/strsep.m4
|
||||
|
|
14
gl/m4/idpriv.m4
Normal file
14
gl/m4/idpriv.m4
Normal file
|
@ -0,0 +1,14 @@
|
|||
# idpriv.m4 serial 1
|
||||
dnl Copyright (C) 2009-2013 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_IDPRIV],
|
||||
[
|
||||
dnl Persuade glibc <unistd.h> to declare {get,set}res{uid,gid}.
|
||||
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
|
||||
|
||||
AC_CHECK_FUNCS_ONCE([getuid geteuid getresuid getgid getegid getresgid])
|
||||
AC_CHECK_FUNCS_ONCE([setresuid setreuid seteuid setresgid setregid setegid])
|
||||
])
|
45
gl/m4/strcase.m4
Normal file
45
gl/m4/strcase.m4
Normal file
|
@ -0,0 +1,45 @@
|
|||
# strcase.m4 serial 11
|
||||
dnl Copyright (C) 2002, 2005-2013 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_STRCASE],
|
||||
[
|
||||
gl_FUNC_STRCASECMP
|
||||
gl_FUNC_STRNCASECMP
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_FUNC_STRCASECMP],
|
||||
[
|
||||
AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
|
||||
AC_CHECK_FUNCS([strcasecmp])
|
||||
if test $ac_cv_func_strcasecmp = no; then
|
||||
HAVE_STRCASECMP=0
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_FUNC_STRNCASECMP],
|
||||
[
|
||||
AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
|
||||
AC_CHECK_FUNCS([strncasecmp])
|
||||
if test $ac_cv_func_strncasecmp = yes; then
|
||||
HAVE_STRNCASECMP=1
|
||||
else
|
||||
HAVE_STRNCASECMP=0
|
||||
fi
|
||||
AC_CHECK_DECLS([strncasecmp])
|
||||
if test $ac_cv_have_decl_strncasecmp = no; then
|
||||
HAVE_DECL_STRNCASECMP=0
|
||||
fi
|
||||
])
|
||||
|
||||
# Prerequisites of lib/strcasecmp.c.
|
||||
AC_DEFUN([gl_PREREQ_STRCASECMP], [
|
||||
:
|
||||
])
|
||||
|
||||
# Prerequisites of lib/strncasecmp.c.
|
||||
AC_DEFUN([gl_PREREQ_STRNCASECMP], [
|
||||
:
|
||||
])
|
52
gl/m4/strings_h.m4
Normal file
52
gl/m4/strings_h.m4
Normal file
|
@ -0,0 +1,52 @@
|
|||
# Configure a replacement for <strings.h>.
|
||||
# serial 6
|
||||
|
||||
# Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
|
||||
# This file 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.
|
||||
|
||||
AC_DEFUN([gl_HEADER_STRINGS_H],
|
||||
[
|
||||
dnl Use AC_REQUIRE here, so that the default behavior below is expanded
|
||||
dnl once only, before all statements that occur in other macros.
|
||||
AC_REQUIRE([gl_HEADER_STRINGS_H_BODY])
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_HEADER_STRINGS_H_BODY],
|
||||
[
|
||||
AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
|
||||
|
||||
gl_CHECK_NEXT_HEADERS([strings.h])
|
||||
if test $ac_cv_header_strings_h = yes; then
|
||||
HAVE_STRINGS_H=1
|
||||
else
|
||||
HAVE_STRINGS_H=0
|
||||
fi
|
||||
AC_SUBST([HAVE_STRINGS_H])
|
||||
|
||||
dnl Check for declarations of anything we want to poison if the
|
||||
dnl corresponding gnulib module is not in use.
|
||||
gl_WARN_ON_USE_PREPARE([[
|
||||
/* Minix 3.1.8 has a bug: <sys/types.h> must be included before
|
||||
<strings.h>. */
|
||||
#include <sys/types.h>
|
||||
#include <strings.h>
|
||||
]], [ffs strcasecmp strncasecmp])
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_STRINGS_MODULE_INDICATOR],
|
||||
[
|
||||
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
|
||||
AC_REQUIRE([gl_HEADER_STRINGS_H_DEFAULTS])
|
||||
gl_MODULE_INDICATOR_SET_VARIABLE([$1])
|
||||
])
|
||||
|
||||
AC_DEFUN([gl_HEADER_STRINGS_H_DEFAULTS],
|
||||
[
|
||||
GNULIB_FFS=0; AC_SUBST([GNULIB_FFS])
|
||||
dnl Assume proper GNU behavior unless another module says otherwise.
|
||||
HAVE_FFS=1; AC_SUBST([HAVE_FFS])
|
||||
HAVE_STRCASECMP=1; AC_SUBST([HAVE_STRCASECMP])
|
||||
HAVE_DECL_STRNCASECMP=1; AC_SUBST([HAVE_DECL_STRNCASECMP])
|
||||
])
|
62
gl/strcasecmp.c
Normal file
62
gl/strcasecmp.c
Normal file
|
@ -0,0 +1,62 @@
|
|||
/* Case-insensitive string comparison function.
|
||||
Copyright (C) 1998-1999, 2005-2007, 2009-2013 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <string.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
|
||||
|
||||
/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
|
||||
greater than zero if S1 is lexicographically less than, equal to or greater
|
||||
than S2.
|
||||
Note: This function does not work with multibyte strings! */
|
||||
|
||||
int
|
||||
strcasecmp (const char *s1, const char *s2)
|
||||
{
|
||||
const unsigned char *p1 = (const unsigned char *) s1;
|
||||
const unsigned char *p2 = (const unsigned char *) s2;
|
||||
unsigned char c1, c2;
|
||||
|
||||
if (p1 == p2)
|
||||
return 0;
|
||||
|
||||
do
|
||||
{
|
||||
c1 = TOLOWER (*p1);
|
||||
c2 = TOLOWER (*p2);
|
||||
|
||||
if (c1 == '\0')
|
||||
break;
|
||||
|
||||
++p1;
|
||||
++p2;
|
||||
}
|
||||
while (c1 == c2);
|
||||
|
||||
if (UCHAR_MAX <= INT_MAX)
|
||||
return c1 - c2;
|
||||
else
|
||||
/* On machines where 'char' and 'int' are types of the same size, the
|
||||
difference of two 'unsigned char' values - including the sign bit -
|
||||
doesn't fit in an 'int'. */
|
||||
return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
|
||||
}
|
122
gl/strings.in.h
Normal file
122
gl/strings.in.h
Normal file
|
@ -0,0 +1,122 @@
|
|||
/* A substitute <strings.h>.
|
||||
|
||||
Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_STRINGS_H
|
||||
|
||||
#if __GNUC__ >= 3
|
||||
@PRAGMA_SYSTEM_HEADER@
|
||||
#endif
|
||||
@PRAGMA_COLUMNS@
|
||||
|
||||
/* Minix 3.1.8 has a bug: <sys/types.h> must be included before <strings.h>.
|
||||
But avoid namespace pollution on glibc systems. */
|
||||
#if defined __minix && !defined __GLIBC__
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
/* The include_next requires a split double-inclusion guard. */
|
||||
#if @HAVE_STRINGS_H@
|
||||
# @INCLUDE_NEXT@ @NEXT_STRINGS_H@
|
||||
#endif
|
||||
|
||||
#ifndef _@GUARD_PREFIX@_STRINGS_H
|
||||
#define _@GUARD_PREFIX@_STRINGS_H
|
||||
|
||||
#if ! @HAVE_DECL_STRNCASECMP@
|
||||
/* Get size_t. */
|
||||
# include <stddef.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
||||
|
||||
/* The definition of _GL_ARG_NONNULL is copied here. */
|
||||
|
||||
/* The definition of _GL_WARN_ON_USE is copied here. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Find the index of the least-significant set bit. */
|
||||
#if @GNULIB_FFS@
|
||||
# if !@HAVE_FFS@
|
||||
_GL_FUNCDECL_SYS (ffs, int, (int i));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (ffs, int, (int i));
|
||||
_GL_CXXALIASWARN (ffs);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef ffs
|
||||
# if HAVE_RAW_DECL_FFS
|
||||
_GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
|
||||
greater than zero if S1 is lexicographically less than, equal to or greater
|
||||
than S2.
|
||||
Note: This function does not work in multibyte locales. */
|
||||
#if ! @HAVE_STRCASECMP@
|
||||
extern int strcasecmp (char const *s1, char const *s2)
|
||||
_GL_ARG_NONNULL ((1, 2));
|
||||
#endif
|
||||
#if defined GNULIB_POSIXCHECK
|
||||
/* strcasecmp() does not work with multibyte strings:
|
||||
POSIX says that it operates on "strings", and "string" in POSIX is defined
|
||||
as a sequence of bytes, not of characters. */
|
||||
# undef strcasecmp
|
||||
# if HAVE_RAW_DECL_STRCASECMP
|
||||
_GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character "
|
||||
"strings in multibyte locales - "
|
||||
"use mbscasecmp if you care about "
|
||||
"internationalization, or use c_strcasecmp , "
|
||||
"gnulib module c-strcase) if you want a locale "
|
||||
"independent function");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Compare no more than N bytes of strings S1 and S2, ignoring case,
|
||||
returning less than, equal to or greater than zero if S1 is
|
||||
lexicographically less than, equal to or greater than S2.
|
||||
Note: This function cannot work correctly in multibyte locales. */
|
||||
#if ! @HAVE_DECL_STRNCASECMP@
|
||||
extern int strncasecmp (char const *s1, char const *s2, size_t n)
|
||||
_GL_ARG_NONNULL ((1, 2));
|
||||
#endif
|
||||
#if defined GNULIB_POSIXCHECK
|
||||
/* strncasecmp() does not work with multibyte strings:
|
||||
POSIX says that it operates on "strings", and "string" in POSIX is defined
|
||||
as a sequence of bytes, not of characters. */
|
||||
# undef strncasecmp
|
||||
# if HAVE_RAW_DECL_STRNCASECMP
|
||||
_GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character "
|
||||
"strings in multibyte locales - "
|
||||
"use mbsncasecmp or mbspcasecmp if you care about "
|
||||
"internationalization, or use c_strncasecmp , "
|
||||
"gnulib module c-strcase) if you want a locale "
|
||||
"independent function");
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _@GUARD_PREFIX@_STRING_H */
|
||||
#endif /* _@GUARD_PREFIX@_STRING_H */
|
62
gl/strncasecmp.c
Normal file
62
gl/strncasecmp.c
Normal file
|
@ -0,0 +1,62 @@
|
|||
/* strncasecmp.c -- case insensitive string comparator
|
||||
Copyright (C) 1998-1999, 2005-2007, 2009-2013 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <string.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
|
||||
|
||||
/* Compare no more than N bytes of strings S1 and S2, ignoring case,
|
||||
returning less than, equal to or greater than zero if S1 is
|
||||
lexicographically less than, equal to or greater than S2.
|
||||
Note: This function cannot work correctly in multibyte locales. */
|
||||
|
||||
int
|
||||
strncasecmp (const char *s1, const char *s2, size_t n)
|
||||
{
|
||||
register const unsigned char *p1 = (const unsigned char *) s1;
|
||||
register const unsigned char *p2 = (const unsigned char *) s2;
|
||||
unsigned char c1, c2;
|
||||
|
||||
if (p1 == p2 || n == 0)
|
||||
return 0;
|
||||
|
||||
do
|
||||
{
|
||||
c1 = TOLOWER (*p1);
|
||||
c2 = TOLOWER (*p2);
|
||||
|
||||
if (--n == 0 || c1 == '\0')
|
||||
break;
|
||||
|
||||
++p1;
|
||||
++p2;
|
||||
}
|
||||
while (c1 == c2);
|
||||
|
||||
if (UCHAR_MAX <= INT_MAX)
|
||||
return c1 - c2;
|
||||
else
|
||||
/* On machines where 'char' and 'int' are types of the same size, the
|
||||
difference of two 'unsigned char' values - including the sign bit -
|
||||
doesn't fit in an 'int'. */
|
||||
return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
|
||||
}
|
|
@ -2,19 +2,18 @@
|
|||
|
||||
SUBDIRS = . tests
|
||||
|
||||
noinst_LIBRARIES = libnagiosplug.a
|
||||
noinst_LIBRARIES = libmonitoringplug.a
|
||||
|
||||
AM_CPPFLAGS = -DNP_STATE_DIR_PREFIX=\"$(localstatedir)\"
|
||||
AM_CPPFLAGS = -DNP_STATE_DIR_PREFIX=\"$(localstatedir)\" \
|
||||
-I$(srcdir) -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins
|
||||
|
||||
libnagiosplug_a_SOURCES = utils_base.c utils_disk.c utils_tcp.c utils_cmd.c
|
||||
libmonitoringplug_a_SOURCES = utils_base.c utils_disk.c utils_tcp.c utils_cmd.c
|
||||
EXTRA_DIST = utils_base.h utils_disk.h utils_tcp.h utils_cmd.h parse_ini.h extra_opts.h
|
||||
|
||||
if USE_PARSE_INI
|
||||
libnagiosplug_a_SOURCES += parse_ini.c extra_opts.c
|
||||
libmonitoringplug_a_SOURCES += parse_ini.c extra_opts.c
|
||||
endif USE_PARSE_INI
|
||||
|
||||
INCLUDES = -I$(srcdir) -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins
|
||||
|
||||
test test-debug:
|
||||
cd tests && make $@
|
||||
|
||||
|
|
|
@ -79,6 +79,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 \
|
||||
|
@ -128,11 +129,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 \
|
||||
|
@ -147,7 +149,7 @@ 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
|
||||
|
@ -155,15 +157,16 @@ CONFIG_HEADER = $(top_builddir)/config.h
|
|||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
LIBRARIES = $(noinst_LIBRARIES)
|
||||
libnagiosplug_a_AR = $(AR) $(ARFLAGS)
|
||||
libnagiosplug_a_LIBADD =
|
||||
am__libnagiosplug_a_SOURCES_DIST = utils_base.c utils_disk.c \
|
||||
libmonitoringplug_a_AR = $(AR) $(ARFLAGS)
|
||||
libmonitoringplug_a_LIBADD =
|
||||
am__libmonitoringplug_a_SOURCES_DIST = utils_base.c utils_disk.c \
|
||||
utils_tcp.c utils_cmd.c parse_ini.c extra_opts.c
|
||||
@USE_PARSE_INI_TRUE@am__objects_1 = parse_ini.$(OBJEXT) \
|
||||
@USE_PARSE_INI_TRUE@ extra_opts.$(OBJEXT)
|
||||
am_libnagiosplug_a_OBJECTS = utils_base.$(OBJEXT) utils_disk.$(OBJEXT) \
|
||||
utils_tcp.$(OBJEXT) utils_cmd.$(OBJEXT) $(am__objects_1)
|
||||
libnagiosplug_a_OBJECTS = $(am_libnagiosplug_a_OBJECTS)
|
||||
am_libmonitoringplug_a_OBJECTS = utils_base.$(OBJEXT) \
|
||||
utils_disk.$(OBJEXT) utils_tcp.$(OBJEXT) utils_cmd.$(OBJEXT) \
|
||||
$(am__objects_1)
|
||||
libmonitoringplug_a_OBJECTS = $(am_libmonitoringplug_a_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
|
@ -177,8 +180,8 @@ CCLD = $(CC)
|
|||
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
SOURCES = $(libnagiosplug_a_SOURCES)
|
||||
DIST_SOURCES = $(am__libnagiosplug_a_SOURCES_DIST)
|
||||
SOURCES = $(libmonitoringplug_a_SOURCES)
|
||||
DIST_SOURCES = $(am__libmonitoringplug_a_SOURCES_DIST)
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
||||
html-recursive info-recursive install-data-recursive \
|
||||
install-dvi-recursive install-exec-recursive \
|
||||
|
@ -337,6 +340,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@
|
||||
|
@ -702,6 +706,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@
|
||||
|
@ -731,6 +736,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@
|
||||
|
@ -842,8 +848,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@
|
||||
|
@ -934,7 +942,6 @@ LD = @LD@
|
|||
LDAPINCLUDE = @LDAPINCLUDE@
|
||||
LDAPLIBS = @LDAPLIBS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
|
||||
LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@
|
||||
LIBGNU_LTLIBDEPS = @LIBGNU_LTLIBDEPS@
|
||||
LIBICONV = @LIBICONV@
|
||||
|
@ -960,6 +967,7 @@ LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
|
|||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LTLIBPTH = @LTLIBPTH@
|
||||
LTLIBTHREAD = @LTLIBTHREAD@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MATHLIBS = @MATHLIBS@
|
||||
|
@ -985,6 +993,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@
|
||||
|
@ -1005,6 +1014,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@
|
||||
|
@ -1064,7 +1074,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@
|
||||
|
@ -1256,7 +1265,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@
|
||||
|
@ -1280,6 +1288,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@
|
||||
|
@ -1345,17 +1354,18 @@ top_builddir = @top_builddir@
|
|||
top_srcdir = @top_srcdir@
|
||||
with_trusted_path = @with_trusted_path@
|
||||
SUBDIRS = . tests
|
||||
noinst_LIBRARIES = libnagiosplug.a
|
||||
AM_CPPFLAGS = -DNP_STATE_DIR_PREFIX=\"$(localstatedir)\"
|
||||
libnagiosplug_a_SOURCES = utils_base.c utils_disk.c utils_tcp.c \
|
||||
noinst_LIBRARIES = libmonitoringplug.a
|
||||
AM_CPPFLAGS = -DNP_STATE_DIR_PREFIX=\"$(localstatedir)\" \
|
||||
-I$(srcdir) -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins
|
||||
|
||||
libmonitoringplug_a_SOURCES = utils_base.c utils_disk.c utils_tcp.c \
|
||||
utils_cmd.c $(am__append_1)
|
||||
EXTRA_DIST = utils_base.h utils_disk.h utils_tcp.h utils_cmd.h parse_ini.h extra_opts.h
|
||||
INCLUDES = -I$(srcdir) -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(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*) \
|
||||
|
@ -1380,18 +1390,18 @@ 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):
|
||||
|
||||
clean-noinstLIBRARIES:
|
||||
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
|
||||
libnagiosplug.a: $(libnagiosplug_a_OBJECTS) $(libnagiosplug_a_DEPENDENCIES) $(EXTRA_libnagiosplug_a_DEPENDENCIES)
|
||||
-rm -f libnagiosplug.a
|
||||
$(libnagiosplug_a_AR) libnagiosplug.a $(libnagiosplug_a_OBJECTS) $(libnagiosplug_a_LIBADD)
|
||||
$(RANLIB) libnagiosplug.a
|
||||
libmonitoringplug.a: $(libmonitoringplug_a_OBJECTS) $(libmonitoringplug_a_DEPENDENCIES) $(EXTRA_libmonitoringplug_a_DEPENDENCIES)
|
||||
-rm -f libmonitoringplug.a
|
||||
$(libmonitoringplug_a_AR) libmonitoringplug.a $(libmonitoringplug_a_OBJECTS) $(libmonitoringplug_a_LIBADD)
|
||||
$(RANLIB) libmonitoringplug.a
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios-plugins extra_opts library
|
||||
* Monitoring Plugins extra_opts library
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define _EXTRA_OPTS_H_
|
||||
|
||||
/*
|
||||
* extra_opts.h: routines for loading nagios-plugin defaults from ini
|
||||
* extra_opts.h: routines for loading monitoring-plugin defaults from ini
|
||||
* configuration files.
|
||||
*/
|
||||
|
||||
|
|
435
lib/parse_ini.c
435
lib/parse_ini.c
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios-plugins parse_ini library
|
||||
* Monitoring Plugins parse_ini library
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -22,16 +22,15 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "common.h"
|
||||
#include "idpriv.h"
|
||||
#include "utils_base.h"
|
||||
#include "parse_ini.h"
|
||||
#include <ctype.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* TODO: die like N::P if config file is not found */
|
||||
|
||||
/* np_ini_info contains the result of parsing a "locator" in the format
|
||||
* [stanza_name][@config_filename] (check_foo@/etc/foo.ini, for example)
|
||||
*/
|
||||
|
@ -40,131 +39,175 @@ typedef struct {
|
|||
char *stanza;
|
||||
} np_ini_info;
|
||||
|
||||
static char *default_ini_file_names[] = {
|
||||
"monitoring-plugins.ini",
|
||||
"plugins.ini",
|
||||
"nagios-plugins.ini",
|
||||
NULL
|
||||
};
|
||||
|
||||
static char *default_ini_path_names[] = {
|
||||
"/usr/local/etc/monitoring-plugins/monitoring-plugins.ini",
|
||||
"/usr/local/etc/monitoring-plugins.ini",
|
||||
"/etc/monitoring-plugins/monitoring-plugins.ini",
|
||||
"/etc/monitoring-plugins.ini",
|
||||
/* deprecated path names (for backward compatibility): */
|
||||
"/etc/nagios/plugins.ini",
|
||||
"/usr/local/nagios/etc/plugins.ini",
|
||||
"/usr/local/etc/nagios/plugins.ini",
|
||||
"/etc/opt/nagios/plugins.ini",
|
||||
"/etc/nagios-plugins.ini",
|
||||
"/usr/local/etc/nagios-plugins.ini",
|
||||
"/etc/opt/nagios-plugins.ini",
|
||||
NULL
|
||||
};
|
||||
|
||||
/* eat all characters from a FILE pointer until n is encountered */
|
||||
#define GOBBLE_TO(f, c, n) do { (c)=fgetc((f)); } while((c)!=EOF && (c)!=(n))
|
||||
|
||||
/* internal function that returns the constructed defaults options */
|
||||
static int read_defaults(FILE *f, const char *stanza, np_arg_list **opts);
|
||||
|
||||
/* internal function that converts a single line into options format */
|
||||
static int add_option(FILE *f, np_arg_list **optlst);
|
||||
/* internal function to find default file */
|
||||
static char* default_file(void);
|
||||
/* internal function to stat() files */
|
||||
static int test_file(const char* env, int len, const char* file, char* temp_file);
|
||||
|
||||
/* parse_locator decomposes a string of the form
|
||||
/* internal functions to find default file */
|
||||
static char *default_file(void);
|
||||
static char *default_file_in_path(void);
|
||||
|
||||
/*
|
||||
* Parse_locator decomposes a string of the form
|
||||
* [stanza][@filename]
|
||||
* into its seperate parts
|
||||
* into its seperate parts.
|
||||
*/
|
||||
static void parse_locator(const char *locator, const char *def_stanza, np_ini_info *i){
|
||||
size_t locator_len=0, stanza_len=0;
|
||||
static void
|
||||
parse_locator(const char *locator, const char *def_stanza, np_ini_info *i)
|
||||
{
|
||||
size_t locator_len = 0, stanza_len = 0;
|
||||
|
||||
/* if locator is NULL we'll use default values */
|
||||
if(locator){
|
||||
locator_len=strlen(locator);
|
||||
stanza_len=strcspn(locator, "@");
|
||||
if (locator != NULL) {
|
||||
locator_len = strlen(locator);
|
||||
stanza_len = strcspn(locator, "@");
|
||||
}
|
||||
/* if a non-default stanza is provided */
|
||||
if(stanza_len>0){
|
||||
i->stanza=(char*)malloc(sizeof(char)*(stanza_len+1));
|
||||
if (stanza_len > 0) {
|
||||
i->stanza = malloc(sizeof(char) * (stanza_len + 1));
|
||||
strncpy(i->stanza, locator, stanza_len);
|
||||
i->stanza[stanza_len]='\0';
|
||||
} else { /* otherwise we use the default stanza */
|
||||
i->stanza=strdup(def_stanza);
|
||||
}
|
||||
/* if there is no @file part */
|
||||
if(stanza_len==locator_len){
|
||||
i->file=default_file();
|
||||
if(strcmp(i->file, "") == 0){
|
||||
die(STATE_UNKNOWN, _("Cannot find '%s' or '%s' in any standard location.\n"), NP_DEFAULT_INI_FILENAME1, NP_DEFAULT_INI_FILENAME2);
|
||||
}
|
||||
} else {
|
||||
i->file=strdup(&(locator[stanza_len+1]));
|
||||
}
|
||||
i->stanza[stanza_len] = '\0';
|
||||
} else /* otherwise we use the default stanza */
|
||||
i->stanza = strdup(def_stanza);
|
||||
|
||||
if(i->file==NULL || i->stanza==NULL){
|
||||
if (i->stanza == NULL)
|
||||
die(STATE_UNKNOWN, _("malloc() failed!\n"));
|
||||
}
|
||||
|
||||
/* check whether there's an @file part */
|
||||
i->file = stanza_len == locator_len
|
||||
? default_file()
|
||||
: strdup(&(locator[stanza_len + 1]));
|
||||
if (i->file == NULL || i->file[0] == '\0')
|
||||
die(STATE_UNKNOWN,
|
||||
_("Cannot find config file in any standard location.\n"));
|
||||
}
|
||||
|
||||
/* this is the externally visible function used by extra_opts */
|
||||
np_arg_list* np_get_defaults(const char *locator, const char *default_section){
|
||||
FILE *inifile=NULL;
|
||||
np_arg_list *defaults=NULL;
|
||||
/*
|
||||
* This is the externally visible function used by extra_opts.
|
||||
*/
|
||||
np_arg_list *
|
||||
np_get_defaults(const char *locator, const char *default_section)
|
||||
{
|
||||
FILE *inifile = NULL;
|
||||
np_arg_list *defaults = NULL;
|
||||
np_ini_info i;
|
||||
int is_suid_plugin = mp_suid();
|
||||
|
||||
if (is_suid_plugin && idpriv_temp_drop() == -1)
|
||||
die(STATE_UNKNOWN, _("Cannot drop privileges: %s\n"),
|
||||
strerror(errno));
|
||||
|
||||
parse_locator(locator, default_section, &i);
|
||||
/* if a file was specified or if we're using the default file */
|
||||
if(i.file != NULL && strlen(i.file) > 0){
|
||||
if(strcmp(i.file, "-")==0){
|
||||
inifile=stdin;
|
||||
} else {
|
||||
inifile=fopen(i.file, "r");
|
||||
}
|
||||
if(inifile==NULL) die(STATE_UNKNOWN, _("Can't read config file"));
|
||||
if(read_defaults(inifile, i.stanza, &defaults)==FALSE)
|
||||
die(STATE_UNKNOWN, _("Invalid section '%s' in config file '%s'\n"), i.stanza, i.file);
|
||||
inifile = strcmp(i.file, "-") == 0 ? stdin : fopen(i.file, "r");
|
||||
|
||||
if (inifile == NULL)
|
||||
die(STATE_UNKNOWN, _("Can't read config file: %s\n"),
|
||||
strerror(errno));
|
||||
if (read_defaults(inifile, i.stanza, &defaults) == FALSE)
|
||||
die(STATE_UNKNOWN,
|
||||
_("Invalid section '%s' in config file '%s'\n"), i.stanza,
|
||||
i.file);
|
||||
|
||||
free(i.file);
|
||||
if(inifile!=stdin) fclose(inifile);
|
||||
}
|
||||
if (inifile != stdin)
|
||||
fclose(inifile);
|
||||
free(i.stanza);
|
||||
if (is_suid_plugin && idpriv_temp_restore() == -1)
|
||||
die(STATE_UNKNOWN, _("Cannot restore privileges: %s\n"),
|
||||
strerror(errno));
|
||||
|
||||
return defaults;
|
||||
}
|
||||
|
||||
/* read_defaults is where the meat of the parsing takes place.
|
||||
/*
|
||||
* The read_defaults() function is where the meat of the parsing takes place.
|
||||
*
|
||||
* note that this may be called by a setuid binary, so we need to
|
||||
* Note that this may be called by a setuid binary, so we need to
|
||||
* be extra careful about user-supplied input (i.e. avoiding possible
|
||||
* format string vulnerabilities, etc)
|
||||
* format string vulnerabilities, etc).
|
||||
*/
|
||||
static int read_defaults(FILE *f, const char *stanza, np_arg_list **opts){
|
||||
int c, status=FALSE;
|
||||
static int
|
||||
read_defaults(FILE *f, const char *stanza, np_arg_list **opts)
|
||||
{
|
||||
int c, status = FALSE;
|
||||
size_t i, stanza_len;
|
||||
enum { NOSTANZA, WRONGSTANZA, RIGHTSTANZA } stanzastate=NOSTANZA;
|
||||
enum { NOSTANZA, WRONGSTANZA, RIGHTSTANZA } stanzastate = NOSTANZA;
|
||||
|
||||
stanza_len=strlen(stanza);
|
||||
stanza_len = strlen(stanza);
|
||||
|
||||
/* our little stanza-parsing state machine. */
|
||||
while((c=fgetc(f))!=EOF){
|
||||
/* our little stanza-parsing state machine */
|
||||
while ((c = fgetc(f)) != EOF) {
|
||||
/* gobble up leading whitespace */
|
||||
if(isspace(c)) continue;
|
||||
switch(c){
|
||||
if (isspace(c))
|
||||
continue;
|
||||
switch (c) {
|
||||
/* globble up coment lines */
|
||||
case ';':
|
||||
case '#':
|
||||
GOBBLE_TO(f, c, '\n');
|
||||
break;
|
||||
/* start of a stanza. check to see if it matches */
|
||||
/* start of a stanza, check to see if it matches */
|
||||
case '[':
|
||||
stanzastate=WRONGSTANZA;
|
||||
for(i=0; i<stanza_len; i++){
|
||||
c=fgetc(f);
|
||||
/* Strip leading whitespace */
|
||||
if(i==0) for(c; isspace(c); c=fgetc(f));
|
||||
stanzastate = WRONGSTANZA;
|
||||
for (i = 0; i < stanza_len; i++) {
|
||||
c = fgetc(f);
|
||||
/* strip leading whitespace */
|
||||
if (i == 0)
|
||||
for (; isspace(c); c = fgetc(f))
|
||||
continue;
|
||||
/* nope, read to the end of the line */
|
||||
if(c!=stanza[i]) {
|
||||
if (c != stanza[i]) {
|
||||
GOBBLE_TO(f, c, '\n');
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* if it matched up to here and the next char is ']'... */
|
||||
if(i==stanza_len){
|
||||
c=fgetc(f);
|
||||
/* Strip trailing whitespace */
|
||||
for(c; isspace(c); c=fgetc(f));
|
||||
if(c==']') stanzastate=RIGHTSTANZA;
|
||||
if (i == stanza_len) {
|
||||
c = fgetc(f);
|
||||
/* strip trailing whitespace */
|
||||
for (; isspace(c); c = fgetc(f))
|
||||
continue;
|
||||
if (c == ']')
|
||||
stanzastate = RIGHTSTANZA;
|
||||
}
|
||||
break;
|
||||
/* otherwise, we're in the body of a stanza or a parse error */
|
||||
default:
|
||||
switch(stanzastate){
|
||||
switch (stanzastate) {
|
||||
/* we never found the start of the first stanza, so
|
||||
* we're dealing with a config error
|
||||
*/
|
||||
case NOSTANZA:
|
||||
die(STATE_UNKNOWN, _("Config file error"));
|
||||
break;
|
||||
die(STATE_UNKNOWN, "%s\n",
|
||||
_("Config file error"));
|
||||
/* we're in a stanza, but for a different plugin */
|
||||
case WRONGSTANZA:
|
||||
GOBBLE_TO(f, c, '\n');
|
||||
|
@ -172,10 +215,11 @@ static int read_defaults(FILE *f, const char *stanza, np_arg_list **opts){
|
|||
/* okay, this is where we start taking the config */
|
||||
case RIGHTSTANZA:
|
||||
ungetc(c, f);
|
||||
if(add_option(f, opts)){
|
||||
die(STATE_UNKNOWN, _("Config file error"));
|
||||
if (add_option(f, opts)) {
|
||||
die(STATE_UNKNOWN, "%s\n",
|
||||
_("Config file error"));
|
||||
}
|
||||
status=TRUE;
|
||||
status = TRUE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -185,109 +229,124 @@ static int read_defaults(FILE *f, const char *stanza, np_arg_list **opts){
|
|||
}
|
||||
|
||||
/*
|
||||
* read one line of input in the format
|
||||
* Read one line of input in the format
|
||||
* ^option[[:space:]]*(=[[:space:]]*value)?
|
||||
* and creates it as a cmdline argument
|
||||
* and create it as a cmdline argument
|
||||
* --option[=value]
|
||||
* appending it to the linked list optbuf.
|
||||
*/
|
||||
static int add_option(FILE *f, np_arg_list **optlst){
|
||||
np_arg_list *opttmp=*optlst, *optnew;
|
||||
char *linebuf=NULL, *lineend=NULL, *optptr=NULL, *optend=NULL;
|
||||
char *eqptr=NULL, *valptr=NULL, *spaceptr=NULL, *valend=NULL;
|
||||
short done_reading=0, equals=0, value=0;
|
||||
size_t cfg_len=0, read_sz=8, linebuf_sz=0, read_pos=0;
|
||||
size_t opt_len=0, val_len=0;
|
||||
static int
|
||||
add_option(FILE *f, np_arg_list **optlst)
|
||||
{
|
||||
np_arg_list *opttmp = *optlst, *optnew;
|
||||
char *linebuf = NULL, *lineend = NULL, *optptr = NULL, *optend = NULL;
|
||||
char *eqptr = NULL, *valptr = NULL, *valend = NULL;
|
||||
short done_reading = 0, equals = 0, value = 0;
|
||||
size_t cfg_len = 0, read_sz = 8, linebuf_sz = 0, read_pos = 0;
|
||||
size_t opt_len = 0, val_len = 0;
|
||||
|
||||
/* read one line from the file */
|
||||
while(!done_reading){
|
||||
while (!done_reading) {
|
||||
/* grow if necessary */
|
||||
if(linebuf==NULL || read_pos+read_sz >= linebuf_sz){
|
||||
linebuf_sz=(linebuf_sz>0)?linebuf_sz<<1:read_sz;
|
||||
linebuf=realloc(linebuf, linebuf_sz);
|
||||
if(linebuf==NULL) die(STATE_UNKNOWN, _("malloc() failed!\n"));
|
||||
if (linebuf == NULL || read_pos + read_sz >= linebuf_sz) {
|
||||
linebuf_sz = linebuf_sz > 0 ? linebuf_sz << 1 : read_sz;
|
||||
linebuf = realloc(linebuf, linebuf_sz);
|
||||
if (linebuf == NULL)
|
||||
die(STATE_UNKNOWN, _("malloc() failed!\n"));
|
||||
}
|
||||
if(fgets(&linebuf[read_pos], read_sz, f)==NULL) done_reading=1;
|
||||
if (fgets(&linebuf[read_pos], (int)read_sz, f) == NULL)
|
||||
done_reading = 1;
|
||||
else {
|
||||
read_pos=strlen(linebuf);
|
||||
if(linebuf[read_pos-1]=='\n') {
|
||||
linebuf[--read_pos]='\0';
|
||||
done_reading=1;
|
||||
read_pos = strlen(linebuf);
|
||||
if (linebuf[read_pos - 1] == '\n') {
|
||||
linebuf[--read_pos] = '\0';
|
||||
done_reading = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
lineend=&linebuf[read_pos];
|
||||
/* all that to read one line. isn't C fun? :) now comes the parsing :/ */
|
||||
lineend = &linebuf[read_pos];
|
||||
/* all that to read one line, isn't C fun? :) now comes the parsing :/ */
|
||||
|
||||
/* skip leading whitespace */
|
||||
for(optptr=linebuf; optptr<lineend && isspace(*optptr); optptr++);
|
||||
for (optptr = linebuf; optptr < lineend && isspace(*optptr); optptr++)
|
||||
continue;
|
||||
/* continue to '=' or EOL, watching for spaces that might precede it */
|
||||
for(eqptr=optptr; eqptr<lineend && *eqptr!='='; eqptr++){
|
||||
if(isspace(*eqptr) && optend==NULL) optend=eqptr;
|
||||
else optend=NULL;
|
||||
for (eqptr = optptr; eqptr < lineend && *eqptr != '='; eqptr++) {
|
||||
if (isspace(*eqptr) && optend == NULL)
|
||||
optend = eqptr;
|
||||
else
|
||||
optend = NULL;
|
||||
}
|
||||
if(optend==NULL) optend=eqptr;
|
||||
if (optend == NULL)
|
||||
optend = eqptr;
|
||||
--optend;
|
||||
/* ^[[:space:]]*=foo is a syntax error */
|
||||
if(optptr==eqptr) die(STATE_UNKNOWN, _("Config file error\n"));
|
||||
if (optptr == eqptr)
|
||||
die(STATE_UNKNOWN, "%s\n", _("Config file error"));
|
||||
/* continue from '=' to start of value or EOL */
|
||||
for(valptr=eqptr+1; valptr<lineend && isspace(*valptr); valptr++);
|
||||
for (valptr = eqptr + 1; valptr < lineend && isspace(*valptr);
|
||||
valptr++)
|
||||
continue;
|
||||
/* continue to the end of value */
|
||||
for(valend=valptr; valend<lineend; valend++);
|
||||
for (valend = valptr; valend < lineend; valend++)
|
||||
continue;
|
||||
--valend;
|
||||
/* Finally trim off trailing spaces */
|
||||
for(valend; isspace(*valend); valend--);
|
||||
/* finally trim off trailing spaces */
|
||||
for (; isspace(*valend); valend--)
|
||||
continue;
|
||||
/* calculate the length of "--foo" */
|
||||
opt_len=1+optend-optptr;
|
||||
opt_len = (size_t)(1 + optend - optptr);
|
||||
/* 1-character params needs only one dash */
|
||||
if(opt_len==1)
|
||||
cfg_len=1+(opt_len);
|
||||
if (opt_len == 1)
|
||||
cfg_len = 1 + (opt_len);
|
||||
else
|
||||
cfg_len=2+(opt_len);
|
||||
cfg_len = 2 + (opt_len);
|
||||
/* if valptr<lineend then we have to also allocate space for "=bar" */
|
||||
if(valptr<lineend) {
|
||||
equals=value=1;
|
||||
val_len=1+valend-valptr;
|
||||
cfg_len+=1+val_len;
|
||||
if (valptr < lineend) {
|
||||
equals = value = 1;
|
||||
val_len = (size_t)(1 + valend - valptr);
|
||||
cfg_len += 1 + val_len;
|
||||
}
|
||||
/* if valptr==valend then we have "=" but no "bar" */
|
||||
else if(valptr==lineend) {
|
||||
equals=1;
|
||||
cfg_len+=1;
|
||||
else if (valptr == lineend) {
|
||||
equals = 1;
|
||||
cfg_len += 1;
|
||||
}
|
||||
/* A line with no equal sign isn't valid */
|
||||
if(equals==0) die(STATE_UNKNOWN, _("Config file error\n"));
|
||||
/* a line with no equal sign isn't valid */
|
||||
if (equals == 0)
|
||||
die(STATE_UNKNOWN, "%s\n", _("Config file error"));
|
||||
|
||||
/* okay, now we have all the info we need, so we create a new np_arg_list
|
||||
* element and set the argument...
|
||||
*/
|
||||
optnew=(np_arg_list *)malloc(sizeof(np_arg_list));
|
||||
optnew->next=NULL;
|
||||
optnew = malloc(sizeof(np_arg_list));
|
||||
optnew->next = NULL;
|
||||
|
||||
read_pos=0;
|
||||
optnew->arg=(char *)malloc(cfg_len+1);
|
||||
read_pos = 0;
|
||||
optnew->arg = malloc(cfg_len + 1);
|
||||
/* 1-character params needs only one dash */
|
||||
if(opt_len==1) {
|
||||
if (opt_len == 1) {
|
||||
strncpy(&optnew->arg[read_pos], "-", 1);
|
||||
read_pos+=1;
|
||||
read_pos += 1;
|
||||
} else {
|
||||
strncpy(&optnew->arg[read_pos], "--", 2);
|
||||
read_pos+=2;
|
||||
read_pos += 2;
|
||||
}
|
||||
strncpy(&optnew->arg[read_pos], optptr, opt_len); read_pos+=opt_len;
|
||||
if(value) {
|
||||
optnew->arg[read_pos++]='=';
|
||||
strncpy(&optnew->arg[read_pos], valptr, val_len); read_pos+=val_len;
|
||||
strncpy(&optnew->arg[read_pos], optptr, opt_len);
|
||||
read_pos += opt_len;
|
||||
if (value) {
|
||||
optnew->arg[read_pos++] = '=';
|
||||
strncpy(&optnew->arg[read_pos], valptr, val_len);
|
||||
read_pos += val_len;
|
||||
}
|
||||
optnew->arg[read_pos]='\0';
|
||||
optnew->arg[read_pos] = '\0';
|
||||
|
||||
/* ...and put that to the end of the list */
|
||||
if(*optlst==NULL) {
|
||||
*optlst=optnew;
|
||||
} else {
|
||||
while(opttmp->next!=NULL) {
|
||||
opttmp=opttmp->next;
|
||||
}
|
||||
if (*optlst == NULL)
|
||||
*optlst = optnew;
|
||||
else {
|
||||
while (opttmp->next != NULL)
|
||||
opttmp = opttmp->next;
|
||||
opttmp->next = optnew;
|
||||
}
|
||||
|
||||
|
@ -295,72 +354,42 @@ static int add_option(FILE *f, np_arg_list **optlst){
|
|||
return 0;
|
||||
}
|
||||
|
||||
static char* default_file(void){
|
||||
struct stat sb;
|
||||
char *np_env=NULL, *default_file=NULL;
|
||||
char temp_file[MAX_INPUT_BUFFER];
|
||||
size_t len;
|
||||
static char *
|
||||
default_file(void)
|
||||
{
|
||||
char **p, *ini_file;
|
||||
|
||||
if((np_env=getenv("NAGIOS_CONFIG_PATH"))!=NULL) {
|
||||
/* skip any starting colon... */
|
||||
while(*np_env==':') np_env++;
|
||||
/* Look for NP_DEFAULT_INI_FILENAME1 and NP_DEFAULT_INI_FILENAME2 in
|
||||
* every PATHs defined (colon-separated).
|
||||
*/
|
||||
while((len=strcspn(np_env,":"))>0){
|
||||
/* Test NP_DEFAULT_INI_FILENAME[1-2] in current np_env token */
|
||||
if(test_file(np_env,len,NP_DEFAULT_INI_FILENAME1,temp_file)==1 ||
|
||||
test_file(np_env,len,NP_DEFAULT_INI_FILENAME2,temp_file)==1){
|
||||
default_file=strdup(temp_file);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Move on to the next token */
|
||||
np_env+=len;
|
||||
while(*np_env==':') np_env++;
|
||||
} /* while(...) */
|
||||
} /* if(getenv("NAGIOS_CONFIG_PATH")) */
|
||||
|
||||
/* Look for NP_DEFAULT_INI_FILENAME1 in NP_DEFAULT_INI_NAGIOS_PATH[1-4] */
|
||||
if(!default_file){
|
||||
if(test_file(NP_DEFAULT_INI_NAGIOS_PATH1,strlen(NP_DEFAULT_INI_NAGIOS_PATH1),NP_DEFAULT_INI_FILENAME1,temp_file)==1 ||
|
||||
test_file(NP_DEFAULT_INI_NAGIOS_PATH2,strlen(NP_DEFAULT_INI_NAGIOS_PATH2),NP_DEFAULT_INI_FILENAME1,temp_file)==1 ||
|
||||
test_file(NP_DEFAULT_INI_NAGIOS_PATH3,strlen(NP_DEFAULT_INI_NAGIOS_PATH3),NP_DEFAULT_INI_FILENAME1,temp_file)==1 ||
|
||||
test_file(NP_DEFAULT_INI_NAGIOS_PATH4,strlen(NP_DEFAULT_INI_NAGIOS_PATH4),NP_DEFAULT_INI_FILENAME1,temp_file)==1)
|
||||
default_file=strdup(temp_file);
|
||||
}
|
||||
|
||||
/* Look for NP_DEFAULT_INI_FILENAME2 in NP_DEFAULT_INI_PATH[1-3] */
|
||||
if(!default_file){
|
||||
if(test_file(NP_DEFAULT_INI_PATH1,strlen(NP_DEFAULT_INI_PATH1),NP_DEFAULT_INI_FILENAME2,temp_file)==1 ||
|
||||
test_file(NP_DEFAULT_INI_PATH2,strlen(NP_DEFAULT_INI_PATH2),NP_DEFAULT_INI_FILENAME2,temp_file)==1 ||
|
||||
test_file(NP_DEFAULT_INI_PATH3,strlen(NP_DEFAULT_INI_PATH3),NP_DEFAULT_INI_FILENAME2,temp_file)==1)
|
||||
default_file=strdup(temp_file);
|
||||
}
|
||||
|
||||
/* Return default_file or empty string (should return NULL if we want plugins
|
||||
* to die there)...
|
||||
*/
|
||||
if(default_file)
|
||||
return default_file;
|
||||
return "";
|
||||
if ((ini_file = getenv("MP_CONFIG_FILE")) != NULL ||
|
||||
(ini_file = default_file_in_path()) != NULL)
|
||||
return ini_file;
|
||||
for (p = default_ini_path_names; *p != NULL; p++)
|
||||
if (access(*p, F_OK) == 0)
|
||||
return *p;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* put together len bytes from env and the filename and test for its
|
||||
* existence. Returns 1 if found, 0 if not and -1 if test wasn't performed.
|
||||
*/
|
||||
static int test_file(const char* env, int len, const char* file, char* temp_file){
|
||||
struct stat sb;
|
||||
static char *
|
||||
default_file_in_path(void)
|
||||
{
|
||||
char *config_path, **file;
|
||||
char *dir, *ini_file, *tokens;
|
||||
|
||||
/* test if len + filelen + '/' + '\0' fits in temp_file */
|
||||
if((len+strlen(file)+2)>MAX_INPUT_BUFFER) return -1;
|
||||
if ((config_path = getenv("NAGIOS_CONFIG_PATH")) == NULL)
|
||||
return NULL;
|
||||
/* shall we spit out a warning that NAGIOS_CONFIG_PATH is deprecated? */
|
||||
|
||||
strncpy(temp_file,env,len);
|
||||
temp_file[len]='\0';
|
||||
strncat(temp_file,"/",len+1);
|
||||
strncat(temp_file,file,len+strlen(file)+1);
|
||||
|
||||
if(stat(temp_file, &sb) != -1) return 1;
|
||||
return 0;
|
||||
if ((tokens = strdup(config_path)) == NULL)
|
||||
die(STATE_UNKNOWN, "%s\n", _("Insufficient Memory"));
|
||||
for (dir = strtok(tokens, ":"); dir != NULL; dir = strtok(NULL, ":")) {
|
||||
for (file = default_ini_file_names; *file != NULL; file++) {
|
||||
if ((asprintf(&ini_file, "%s/%s", dir, *file)) < 0)
|
||||
die(STATE_UNKNOWN, "%s\n", _("Insufficient Memory"));
|
||||
if (access(ini_file, F_OK) == 0) {
|
||||
free(tokens);
|
||||
return ini_file;
|
||||
}
|
||||
}
|
||||
}
|
||||
free(tokens);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define _PARSE_INI_H_
|
||||
|
||||
/*
|
||||
* parse_ini.h: routines for loading nagios-plugin defaults from ini
|
||||
* parse_ini.h: routines for loading monitoring-plugin defaults from ini
|
||||
* configuration files.
|
||||
*/
|
||||
|
||||
|
@ -13,50 +13,10 @@ typedef struct np_arg_el {
|
|||
struct np_arg_el *next;
|
||||
} np_arg_list;
|
||||
|
||||
/* FIXME: This is in plugins/common.c. Should be eventually moved to lib/
|
||||
* (although for this particular one a configure settings should be ideal)
|
||||
*/
|
||||
#ifndef MAX_INPUT_BUFFER
|
||||
# define MAX_INPUT_BUFFER 8192
|
||||
#endif /* MAX_INPUT_BUFFER */
|
||||
|
||||
/* Filenames (see below) */
|
||||
#ifndef NP_DEFAULT_INI_FILENAME1
|
||||
# define NP_DEFAULT_INI_FILENAME1 "plugins.ini"
|
||||
#endif /* NP_DEFAULT_INI_FILENAME1 */
|
||||
#ifndef NP_DEFAULT_INI_FILENAME2
|
||||
# define NP_DEFAULT_INI_FILENAME2 "nagios-plugins.ini"
|
||||
#endif /* NP_DEFAULT_INI_FILENAME2 */
|
||||
|
||||
/* Config paths ending in nagios (search for NP_DEFAULT_INI_FILENAME1) */
|
||||
#ifndef NP_DEFAULT_INI_NAGIOS_PATH1
|
||||
# define NP_DEFAULT_INI_NAGIOS_PATH1 "/etc/nagios"
|
||||
#endif /* NP_DEFAULT_INI_NAGIOS_PATH1 */
|
||||
#ifndef NP_DEFAULT_INI_NAGIOS_PATH2
|
||||
# define NP_DEFAULT_INI_NAGIOS_PATH2 "/usr/local/nagios/etc"
|
||||
#endif /* NP_DEFAULT_INI_NAGIOS_PATH2 */
|
||||
#ifndef NP_DEFAULT_INI_NAGIOS_PATH3
|
||||
# define NP_DEFAULT_INI_NAGIOS_PATH3 "/usr/local/etc/nagios"
|
||||
#endif /* NP_DEFAULT_INI_NAGIOS_PATH3 */
|
||||
#ifndef NP_DEFAULT_INI_NAGIOS_PATH4
|
||||
# define NP_DEFAULT_INI_NAGIOS_PATH4 "/etc/opt/nagios"
|
||||
#endif /* NP_DEFAULT_INI_NAGIOS_PATH4 */
|
||||
|
||||
/* Config paths not ending in nagios (search for NP_DEFAULT_INI_FILENAME2) */
|
||||
#ifndef NP_DEFAULT_INI_PATH1
|
||||
# define NP_DEFAULT_INI_PATH1 "/etc"
|
||||
#endif /* NP_DEFAULT_INI_PATH1 */
|
||||
#ifndef NP_DEFAULT_INI_PATH2
|
||||
# define NP_DEFAULT_INI_PATH2 "/usr/local/etc"
|
||||
#endif /* NP_DEFAULT_INI_PATH2 */
|
||||
#ifndef NP_DEFAULT_INI_PATH3
|
||||
# define NP_DEFAULT_INI_PATH3 "/etc/opt"
|
||||
#endif /* NP_DEFAULT_INI_PATH3 */
|
||||
|
||||
/* np_load_defaults: load the default configuration (if present) for
|
||||
* a plugin from the ini file
|
||||
*/
|
||||
np_arg_list* np_get_defaults(const char *locator, const char *default_section);
|
||||
np_arg_list *np_get_defaults(const char *locator, const char *default_section);
|
||||
|
||||
#endif /* _PARSE_INI_H_ */
|
||||
|
||||
|
|
|
@ -5,9 +5,8 @@ noinst_PROGRAMS = @EXTRA_TEST@
|
|||
TESTS = @EXTRA_TEST@
|
||||
check_PROGRAMS = @EXTRA_TEST@
|
||||
|
||||
AM_CPPFLAGS = -DNP_STATE_DIR_PREFIX=\"$(localstatedir)\"
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins
|
||||
AM_CPPFLAGS = -DNP_STATE_DIR_PREFIX=\"$(localstatedir)\" \
|
||||
-I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins
|
||||
|
||||
EXTRA_PROGRAMS = test_utils test_disk test_tcp test_cmd test_base64 test_ini1 test_ini3 test_opts1 test_opts2 test_opts3
|
||||
|
||||
|
@ -28,7 +27,7 @@ endif
|
|||
|
||||
AM_CFLAGS = -g -I$(top_srcdir)/lib -I$(top_srcdir)/gl $(tap_cflags)
|
||||
AM_LDFLAGS = $(tap_ldflags) -ltap
|
||||
LDADD = $(top_srcdir)/lib/libnagiosplug.a $(top_srcdir)/gl/libgnu.a
|
||||
LDADD = $(top_srcdir)/lib/libmonitoringplug.a $(top_srcdir)/gl/libgnu.a
|
||||
|
||||
SOURCES = test_utils.c test_disk.c test_tcp.c test_cmd.c test_base64.c test_ini1.c test_ini3.c test_opts1.c test_opts2.c test_opts3.c
|
||||
|
||||
|
|
|
@ -82,6 +82,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 \
|
||||
|
@ -131,11 +132,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 \
|
||||
|
@ -150,7 +152,7 @@ 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
|
||||
|
@ -161,52 +163,52 @@ PROGRAMS = $(noinst_PROGRAMS)
|
|||
test_base64_SOURCES = test_base64.c
|
||||
test_base64_OBJECTS = test_base64.$(OBJEXT)
|
||||
test_base64_LDADD = $(LDADD)
|
||||
test_base64_DEPENDENCIES = $(top_srcdir)/lib/libnagiosplug.a \
|
||||
test_base64_DEPENDENCIES = $(top_srcdir)/lib/libmonitoringplug.a \
|
||||
$(top_srcdir)/gl/libgnu.a
|
||||
test_cmd_SOURCES = test_cmd.c
|
||||
test_cmd_OBJECTS = test_cmd.$(OBJEXT)
|
||||
test_cmd_LDADD = $(LDADD)
|
||||
test_cmd_DEPENDENCIES = $(top_srcdir)/lib/libnagiosplug.a \
|
||||
test_cmd_DEPENDENCIES = $(top_srcdir)/lib/libmonitoringplug.a \
|
||||
$(top_srcdir)/gl/libgnu.a
|
||||
test_disk_SOURCES = test_disk.c
|
||||
test_disk_OBJECTS = test_disk.$(OBJEXT)
|
||||
test_disk_LDADD = $(LDADD)
|
||||
test_disk_DEPENDENCIES = $(top_srcdir)/lib/libnagiosplug.a \
|
||||
test_disk_DEPENDENCIES = $(top_srcdir)/lib/libmonitoringplug.a \
|
||||
$(top_srcdir)/gl/libgnu.a
|
||||
test_ini1_SOURCES = test_ini1.c
|
||||
test_ini1_OBJECTS = test_ini1.$(OBJEXT)
|
||||
test_ini1_LDADD = $(LDADD)
|
||||
test_ini1_DEPENDENCIES = $(top_srcdir)/lib/libnagiosplug.a \
|
||||
test_ini1_DEPENDENCIES = $(top_srcdir)/lib/libmonitoringplug.a \
|
||||
$(top_srcdir)/gl/libgnu.a
|
||||
test_ini3_SOURCES = test_ini3.c
|
||||
test_ini3_OBJECTS = test_ini3.$(OBJEXT)
|
||||
test_ini3_LDADD = $(LDADD)
|
||||
test_ini3_DEPENDENCIES = $(top_srcdir)/lib/libnagiosplug.a \
|
||||
test_ini3_DEPENDENCIES = $(top_srcdir)/lib/libmonitoringplug.a \
|
||||
$(top_srcdir)/gl/libgnu.a
|
||||
test_opts1_SOURCES = test_opts1.c
|
||||
test_opts1_OBJECTS = test_opts1.$(OBJEXT)
|
||||
test_opts1_LDADD = $(LDADD)
|
||||
test_opts1_DEPENDENCIES = $(top_srcdir)/lib/libnagiosplug.a \
|
||||
test_opts1_DEPENDENCIES = $(top_srcdir)/lib/libmonitoringplug.a \
|
||||
$(top_srcdir)/gl/libgnu.a
|
||||
test_opts2_SOURCES = test_opts2.c
|
||||
test_opts2_OBJECTS = test_opts2.$(OBJEXT)
|
||||
test_opts2_LDADD = $(LDADD)
|
||||
test_opts2_DEPENDENCIES = $(top_srcdir)/lib/libnagiosplug.a \
|
||||
test_opts2_DEPENDENCIES = $(top_srcdir)/lib/libmonitoringplug.a \
|
||||
$(top_srcdir)/gl/libgnu.a
|
||||
test_opts3_SOURCES = test_opts3.c
|
||||
test_opts3_OBJECTS = test_opts3.$(OBJEXT)
|
||||
test_opts3_LDADD = $(LDADD)
|
||||
test_opts3_DEPENDENCIES = $(top_srcdir)/lib/libnagiosplug.a \
|
||||
test_opts3_DEPENDENCIES = $(top_srcdir)/lib/libmonitoringplug.a \
|
||||
$(top_srcdir)/gl/libgnu.a
|
||||
test_tcp_SOURCES = test_tcp.c
|
||||
test_tcp_OBJECTS = test_tcp.$(OBJEXT)
|
||||
test_tcp_LDADD = $(LDADD)
|
||||
test_tcp_DEPENDENCIES = $(top_srcdir)/lib/libnagiosplug.a \
|
||||
test_tcp_DEPENDENCIES = $(top_srcdir)/lib/libmonitoringplug.a \
|
||||
$(top_srcdir)/gl/libgnu.a
|
||||
test_utils_SOURCES = test_utils.c
|
||||
test_utils_OBJECTS = test_utils.$(OBJEXT)
|
||||
test_utils_LDADD = $(LDADD)
|
||||
test_utils_DEPENDENCIES = $(top_srcdir)/lib/libnagiosplug.a \
|
||||
test_utils_DEPENDENCIES = $(top_srcdir)/lib/libmonitoringplug.a \
|
||||
$(top_srcdir)/gl/libgnu.a
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
|
||||
|
@ -346,6 +348,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@
|
||||
|
@ -711,6 +714,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@
|
||||
|
@ -740,6 +744,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@
|
||||
|
@ -851,8 +856,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@
|
||||
|
@ -943,7 +950,6 @@ LD = @LD@
|
|||
LDAPINCLUDE = @LDAPINCLUDE@
|
||||
LDAPLIBS = @LDAPLIBS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
|
||||
LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@
|
||||
LIBGNU_LTLIBDEPS = @LIBGNU_LTLIBDEPS@
|
||||
LIBICONV = @LIBICONV@
|
||||
|
@ -969,6 +975,7 @@ LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
|
|||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LTLIBPTH = @LTLIBPTH@
|
||||
LTLIBTHREAD = @LTLIBTHREAD@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MATHLIBS = @MATHLIBS@
|
||||
|
@ -994,6 +1001,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@
|
||||
|
@ -1014,6 +1022,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@
|
||||
|
@ -1073,7 +1082,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@
|
||||
|
@ -1265,7 +1273,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@
|
||||
|
@ -1289,6 +1296,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@
|
||||
|
@ -1358,8 +1366,9 @@ noinst_PROGRAMS = @EXTRA_TEST@
|
|||
# These two lines support "make check", but we use "make test"
|
||||
TESTS = @EXTRA_TEST@
|
||||
check_PROGRAMS = @EXTRA_TEST@
|
||||
AM_CPPFLAGS = -DNP_STATE_DIR_PREFIX=\"$(localstatedir)\"
|
||||
INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins
|
||||
AM_CPPFLAGS = -DNP_STATE_DIR_PREFIX=\"$(localstatedir)\" \
|
||||
-I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins
|
||||
|
||||
np_test_scripts = test_base64.t test_cmd.t test_disk.t test_ini1.t test_ini3.t test_opts1.t test_opts2.t test_opts3.t test_tcp.t test_utils.t
|
||||
np_test_files = config-dos.ini config-opts.ini config-tiny.ini plugin.ini plugins.ini
|
||||
EXTRA_DIST = $(np_test_scripts) $(np_test_files) var
|
||||
|
@ -1369,13 +1378,13 @@ EXTRA_DIST = $(np_test_scripts) $(np_test_files) var
|
|||
@USE_LIBTAP_LOCAL_TRUE@tap_ldadd = $(top_srcdir)/gl/libgnu.a
|
||||
AM_CFLAGS = -g -I$(top_srcdir)/lib -I$(top_srcdir)/gl $(tap_cflags)
|
||||
AM_LDFLAGS = $(tap_ldflags) -ltap
|
||||
LDADD = $(top_srcdir)/lib/libnagiosplug.a $(top_srcdir)/gl/libgnu.a
|
||||
LDADD = $(top_srcdir)/lib/libmonitoringplug.a $(top_srcdir)/gl/libgnu.a
|
||||
SOURCES = test_utils.c test_disk.c test_tcp.c test_cmd.c test_base64.c test_ini1.c test_ini3.c test_opts1.c test_opts2.c test_opts3.c
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(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*) \
|
||||
|
@ -1400,9 +1409,9 @@ 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):
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/perl
|
||||
use Test::More;
|
||||
if (! -e "./test_base64") {
|
||||
plan skip_all => "./test_base64 not compiled - please install tap library to test";
|
||||
plan skip_all => "./test_base64 not compiled - please enable libtap library to test";
|
||||
}
|
||||
exec "./test_base64";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/perl
|
||||
use Test::More;
|
||||
if (! -e "./test_cmd") {
|
||||
plan skip_all => "./test_cmd not compiled - please install tap library to test";
|
||||
plan skip_all => "./test_cmd not compiled - please enable libtap library to test";
|
||||
}
|
||||
exec "./test_cmd";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/perl
|
||||
use Test::More;
|
||||
if (! -e "./test_disk") {
|
||||
plan skip_all => "./test_disk not compiled - please install tap library to test";
|
||||
plan skip_all => "./test_disk not compiled - please enable libtap library to test";
|
||||
}
|
||||
exec "./test_disk";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/perl
|
||||
use Test::More;
|
||||
if (! -e "./test_ini1") {
|
||||
plan skip_all => "./test_ini not compiled - please install tap library and/or enable parse-ini to test";
|
||||
plan skip_all => "./test_ini not compiled - please enable libtap library and/or extra-opts to test";
|
||||
}
|
||||
exec "./test_ini1";
|
||||
|
|
|
@ -4,7 +4,7 @@ use strict;
|
|||
use warnings;
|
||||
|
||||
if (! -e "./test_ini3") {
|
||||
plan skip_all => "./test_ini not compiled - please install tap library and/or enable parse-ini to test";
|
||||
plan skip_all => "./test_ini not compiled - please enable libtap library and/or extra-opts to test";
|
||||
}
|
||||
|
||||
# array of argument arrays
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/perl
|
||||
use Test::More;
|
||||
if (! -e "./test_opts1") {
|
||||
plan skip_all => "./test_opts1 not compiled - please install tap library and/or enable parse-ini to test";
|
||||
plan skip_all => "./test_opts1 not compiled - please enable libtap library and/or extra-opts to test";
|
||||
}
|
||||
exec "./test_opts1";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/perl
|
||||
use Test::More;
|
||||
if (! -e "./test_opts2") {
|
||||
plan skip_all => "./test_opts2 not compiled - please install tap library and/or enable parse-ini to test";
|
||||
plan skip_all => "./test_opts2 not compiled - please enable libtap library and/or extra-opts to test";
|
||||
}
|
||||
$ENV{"NAGIOS_CONFIG_PATH"} = ".";
|
||||
exec "./test_opts2";
|
||||
|
|
|
@ -4,7 +4,7 @@ use strict;
|
|||
use warnings;
|
||||
|
||||
if (! -e "./test_opts3") {
|
||||
plan skip_all => "./test_opts3 not compiled - please install tap library and/or enable parse-ini to test";
|
||||
plan skip_all => "./test_opts3 not compiled - please enable libtap library and/or extra-opts to test";
|
||||
}
|
||||
|
||||
# array of argument arrays
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/perl
|
||||
use Test::More;
|
||||
if (! -e "./test_tcp") {
|
||||
plan skip_all => "./test_tcp not compiled - please install tap library to test";
|
||||
plan skip_all => "./test_tcp not compiled - please enable libtap library to test";
|
||||
}
|
||||
exec "./test_tcp";
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "tap.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
@ -29,31 +30,32 @@
|
|||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
char state_path[1024];
|
||||
range *range;
|
||||
double temp;
|
||||
thresholds *thresholds = NULL;
|
||||
int rc;
|
||||
int i, rc;
|
||||
char *temp_string;
|
||||
state_key *temp_state_key = NULL;
|
||||
state_data *temp_state_data;
|
||||
time_t current_time;
|
||||
|
||||
plan_tests(150);
|
||||
plan_tests(185);
|
||||
|
||||
ok( this_nagios_plugin==NULL, "nagios_plugin not initialised");
|
||||
ok( this_monitoring_plugin==NULL, "monitoring_plugin not initialised");
|
||||
|
||||
np_init( "check_test", argc, argv );
|
||||
|
||||
ok( this_nagios_plugin!=NULL, "nagios_plugin now initialised");
|
||||
ok( !strcmp(this_nagios_plugin->plugin_name, "check_test"), "plugin name initialised" );
|
||||
ok( this_monitoring_plugin!=NULL, "monitoring_plugin now initialised");
|
||||
ok( !strcmp(this_monitoring_plugin->plugin_name, "check_test"), "plugin name initialised" );
|
||||
|
||||
ok( this_nagios_plugin->argc==argc, "Argc set" );
|
||||
ok( this_nagios_plugin->argv==argv, "Argv set" );
|
||||
ok( this_monitoring_plugin->argc==argc, "Argc set" );
|
||||
ok( this_monitoring_plugin->argv==argv, "Argv set" );
|
||||
|
||||
np_set_args(0,0);
|
||||
|
||||
ok( this_nagios_plugin->argc==0, "argc changed" );
|
||||
ok( this_nagios_plugin->argv==0, "argv changed" );
|
||||
ok( this_monitoring_plugin->argc==0, "argc changed" );
|
||||
ok( this_monitoring_plugin->argv==0, "argv changed" );
|
||||
|
||||
np_set_args(argc, argv);
|
||||
|
||||
|
@ -182,6 +184,21 @@ main (int argc, char **argv)
|
|||
ok( get_status(30.0001, thresholds) == STATE_WARNING, "30.0001 - warning");
|
||||
ok( get_status(69, thresholds) == STATE_CRITICAL, "69 - critical");
|
||||
|
||||
rc = _set_thresholds(&thresholds, "-10:-2", "-30:20");
|
||||
ok( rc == 0, "Thresholds ('-30:20', '-10:-2') set");
|
||||
ok( thresholds->warning->start == -10, "Warning start set correctly");
|
||||
ok( thresholds->warning->end == -2, "Warning end set correctly");
|
||||
ok( thresholds->critical->start == -30, "Critical start set correctly");
|
||||
ok( thresholds->critical->end == 20, "Critical end set correctly");
|
||||
ok( get_status(-31, thresholds) == STATE_CRITICAL, "-31 - critical");
|
||||
ok( get_status(-29, thresholds) == STATE_WARNING, "-29 - warning");
|
||||
ok( get_status(-11, thresholds) == STATE_WARNING, "-11 - warning");
|
||||
ok( get_status(-10, thresholds) == STATE_OK, "-10 - ok");
|
||||
ok( get_status(-2, thresholds) == STATE_OK, "-2 - ok");
|
||||
ok( get_status(-1, thresholds) == STATE_WARNING, "-1 - warning");
|
||||
ok( get_status(19, thresholds) == STATE_WARNING, "19 - warning");
|
||||
ok( get_status(21, thresholds) == STATE_CRITICAL, "21 - critical");
|
||||
|
||||
char *test;
|
||||
test = np_escaped_string("bob\\n");
|
||||
ok( strcmp(test, "bob\n") == 0, "bob\\n ok");
|
||||
|
@ -296,23 +313,23 @@ main (int argc, char **argv)
|
|||
diag( "You are probably running in wrong directory. Must run as ./test_utils" );
|
||||
|
||||
|
||||
this_nagios_plugin->argc=4;
|
||||
this_nagios_plugin->argv[0] = "./test_utils";
|
||||
this_nagios_plugin->argv[1] = "here";
|
||||
this_nagios_plugin->argv[2] = "--and";
|
||||
this_nagios_plugin->argv[3] = "now";
|
||||
this_monitoring_plugin->argc=4;
|
||||
this_monitoring_plugin->argv[0] = "./test_utils";
|
||||
this_monitoring_plugin->argv[1] = "here";
|
||||
this_monitoring_plugin->argv[2] = "--and";
|
||||
this_monitoring_plugin->argv[3] = "now";
|
||||
temp_string = (char *) _np_state_generate_key();
|
||||
ok(!strcmp(temp_string, "94b5e17bf5abf51cb15aff5f69b96f2f8dac5ecd"), "Got based on expected argv" );
|
||||
|
||||
unsetenv("NAGIOS_PLUGIN_STATE_DIRECTORY");
|
||||
unsetenv("MP_STATE_PATH");
|
||||
temp_string = (char *) _np_state_calculate_location_prefix();
|
||||
ok(!strcmp(temp_string, NP_STATE_DIR_PREFIX), "Got default directory" );
|
||||
|
||||
setenv("NAGIOS_PLUGIN_STATE_DIRECTORY", "", 1);
|
||||
setenv("MP_STATE_PATH", "", 1);
|
||||
temp_string = (char *) _np_state_calculate_location_prefix();
|
||||
ok(!strcmp(temp_string, NP_STATE_DIR_PREFIX), "Got default directory even with empty string" );
|
||||
|
||||
setenv("NAGIOS_PLUGIN_STATE_DIRECTORY", "/usr/local/nagios/var", 1);
|
||||
setenv("MP_STATE_PATH", "/usr/local/nagios/var", 1);
|
||||
temp_string = (char *) _np_state_calculate_location_prefix();
|
||||
ok(!strcmp(temp_string, "/usr/local/nagios/var"), "Got default directory" );
|
||||
|
||||
|
@ -320,36 +337,38 @@ main (int argc, char **argv)
|
|||
|
||||
ok(temp_state_key==NULL, "temp_state_key initially empty");
|
||||
|
||||
this_nagios_plugin->argc=1;
|
||||
this_nagios_plugin->argv[0] = "./test_utils";
|
||||
this_monitoring_plugin->argc=1;
|
||||
this_monitoring_plugin->argv[0] = "./test_utils";
|
||||
np_enable_state(NULL, 51);
|
||||
temp_state_key = this_nagios_plugin->state;
|
||||
temp_state_key = this_monitoring_plugin->state;
|
||||
ok( !strcmp(temp_state_key->plugin_name, "check_test"), "Got plugin name" );
|
||||
ok( !strcmp(temp_state_key->name, "83d877b6cdfefb5d6f06101fd6fe76762f21792c"), "Got generated filename" );
|
||||
|
||||
|
||||
np_enable_state("allowedchars_in_keyname", 77);
|
||||
temp_state_key = this_nagios_plugin->state;
|
||||
temp_state_key = this_monitoring_plugin->state;
|
||||
sprintf(state_path, "/usr/local/nagios/var/%lu/check_test/allowedchars_in_keyname", (unsigned long)geteuid());
|
||||
ok( !strcmp(temp_state_key->plugin_name, "check_test"), "Got plugin name" );
|
||||
ok( !strcmp(temp_state_key->name, "allowedchars_in_keyname"), "Got key name with valid chars" );
|
||||
ok( !strcmp(temp_state_key->_filename, "/usr/local/nagios/var/check_test/allowedchars_in_keyname"), "Got internal filename" );
|
||||
ok( !strcmp(temp_state_key->_filename, state_path), "Got internal filename" );
|
||||
|
||||
|
||||
/* Don't do this test just yet. Will die */
|
||||
/*
|
||||
np_enable_state("bad^chars$in@here", 77);
|
||||
temp_state_key = this_nagios_plugin->state;
|
||||
temp_state_key = this_monitoring_plugin->state;
|
||||
ok( !strcmp(temp_state_key->name, "bad_chars_in_here"), "Got key name with bad chars replaced" );
|
||||
*/
|
||||
|
||||
np_enable_state("funnykeyname", 54);
|
||||
temp_state_key = this_nagios_plugin->state;
|
||||
temp_state_key = this_monitoring_plugin->state;
|
||||
sprintf(state_path, "/usr/local/nagios/var/%lu/check_test/funnykeyname", (unsigned long)geteuid());
|
||||
ok( !strcmp(temp_state_key->plugin_name, "check_test"), "Got plugin name" );
|
||||
ok( !strcmp(temp_state_key->name, "funnykeyname"), "Got key name" );
|
||||
|
||||
|
||||
|
||||
ok( !strcmp(temp_state_key->_filename, "/usr/local/nagios/var/check_test/funnykeyname"), "Got internal filename" );
|
||||
ok( !strcmp(temp_state_key->_filename, state_path), "Got internal filename" );
|
||||
ok( temp_state_key->data_version==54, "Version set" );
|
||||
|
||||
temp_state_data = np_state_read();
|
||||
|
@ -367,9 +386,9 @@ main (int argc, char **argv)
|
|||
|
||||
temp_state_key->_filename="var/statefile";
|
||||
temp_state_data = np_state_read();
|
||||
ok( this_nagios_plugin->state->state_data!=NULL, "Got state data now" ) || diag("Are you running in right directory? Will get coredump next if not");
|
||||
ok( this_nagios_plugin->state->state_data->time==1234567890, "Got time" );
|
||||
ok( !strcmp((char *)this_nagios_plugin->state->state_data->data, "String to read"), "Data as expected" );
|
||||
ok( this_monitoring_plugin->state->state_data!=NULL, "Got state data now" ) || diag("Are you running in right directory? Will get coredump next if not");
|
||||
ok( this_monitoring_plugin->state->state_data->time==1234567890, "Got time" );
|
||||
ok( !strcmp((char *)this_monitoring_plugin->state->state_data->data, "String to read"), "Data as expected" );
|
||||
|
||||
temp_state_key->data_version=53;
|
||||
temp_state_data = np_state_read();
|
||||
|
@ -379,7 +398,7 @@ main (int argc, char **argv)
|
|||
temp_state_key->_filename="var/nonexistant";
|
||||
temp_state_data = np_state_read();
|
||||
ok( temp_state_data==NULL, "Missing file gives NULL" );
|
||||
ok( this_nagios_plugin->state->state_data==NULL, "No state information" );
|
||||
ok( this_monitoring_plugin->state->state_data==NULL, "No state information" );
|
||||
|
||||
temp_state_key->_filename="var/oldformat";
|
||||
temp_state_data = np_state_read();
|
||||
|
@ -426,7 +445,7 @@ main (int argc, char **argv)
|
|||
temp_state_data = np_state_read();
|
||||
/* Check time is set to current_time */
|
||||
ok(system("cmp var/generated var/statefile > /dev/null")!=0, "Generated file should be different this time");
|
||||
ok(this_nagios_plugin->state->state_data->time-current_time<=1, "Has time generated from current time");
|
||||
ok(this_monitoring_plugin->state->state_data->time-current_time<=1, "Has time generated from current time");
|
||||
|
||||
|
||||
/* Don't know how to automatically test this. Need to be able to redefine die and catch the error */
|
||||
|
@ -438,7 +457,54 @@ main (int argc, char **argv)
|
|||
|
||||
np_cleanup();
|
||||
|
||||
ok( this_nagios_plugin==NULL, "Free'd this_nagios_plugin" );
|
||||
ok(this_monitoring_plugin==NULL, "Free'd this_monitoring_plugin");
|
||||
|
||||
ok(mp_suid() == FALSE, "Test aren't suid");
|
||||
|
||||
/* base states with random case */
|
||||
char *states[] = {
|
||||
"Ok",
|
||||
"wArnINg",
|
||||
"cRiTIcaL",
|
||||
"UnKNoWN",
|
||||
NULL
|
||||
};
|
||||
|
||||
for (i=0; states[i]!=NULL; i++) {
|
||||
/* out of the random case states, create the lower and upper versions + numeric string one */
|
||||
char *statelower = strdup(states[i]);
|
||||
char *stateupper = strdup(states[i]);
|
||||
char statenum[2];
|
||||
char *temp_ptr;
|
||||
for (temp_ptr = statelower; *temp_ptr; temp_ptr++) {
|
||||
*temp_ptr = tolower(*temp_ptr);
|
||||
}
|
||||
for (temp_ptr = stateupper; *temp_ptr; temp_ptr++) {
|
||||
*temp_ptr = toupper(*temp_ptr);
|
||||
}
|
||||
snprintf(statenum, 2, "%i", i);
|
||||
|
||||
/* Base test names, we'll append the state string */
|
||||
char testname[64] = "Translate state string: ";
|
||||
int tlen = strlen(testname);
|
||||
|
||||
strcpy(testname+tlen, states[i]);
|
||||
ok(i==mp_translate_state(states[i]), testname);
|
||||
|
||||
strcpy(testname+tlen, statelower);
|
||||
ok(i==mp_translate_state(statelower), testname);
|
||||
|
||||
strcpy(testname+tlen, stateupper);
|
||||
ok(i==mp_translate_state(stateupper), testname);
|
||||
|
||||
strcpy(testname+tlen, statenum);
|
||||
ok(i==mp_translate_state(statenum), testname);
|
||||
}
|
||||
ok(ERROR==mp_translate_state("warningfewgw"), "Translate state string with garbage");
|
||||
ok(ERROR==mp_translate_state("00"), "Translate state string: bad numeric string 1");
|
||||
ok(ERROR==mp_translate_state("01"), "Translate state string: bad numeric string 2");
|
||||
ok(ERROR==mp_translate_state("10"), "Translate state string: bad numeric string 3");
|
||||
ok(ERROR==mp_translate_state(""), "Translate state string: empty string");
|
||||
|
||||
return exit_status();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/perl
|
||||
use Test::More;
|
||||
if (! -e "./test_utils") {
|
||||
plan skip_all => "./test_utils not compiled - please install tap library to test";
|
||||
plan skip_all => "./test_utils not compiled - please enable libtap library to test";
|
||||
}
|
||||
exec "./test_utils";
|
||||
|
|
139
lib/utils_base.c
139
lib/utils_base.c
|
@ -3,7 +3,7 @@
|
|||
* utils_base.c
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2006 Nagios Plugins Development Team
|
||||
* Copyright (c) 2006 Monitoring Plugins Development Team
|
||||
*
|
||||
* Library of useful functions for plugins
|
||||
*
|
||||
|
@ -30,56 +30,58 @@
|
|||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define np_free(ptr) { if(ptr) { free(ptr); ptr = NULL; } }
|
||||
|
||||
nagios_plugin *this_nagios_plugin=NULL;
|
||||
monitoring_plugin *this_monitoring_plugin=NULL;
|
||||
|
||||
int _np_state_read_file(FILE *);
|
||||
|
||||
void np_init( char *plugin_name, int argc, char **argv ) {
|
||||
if (this_nagios_plugin==NULL) {
|
||||
this_nagios_plugin = calloc(1, sizeof(nagios_plugin));
|
||||
if (this_nagios_plugin==NULL) {
|
||||
if (this_monitoring_plugin==NULL) {
|
||||
this_monitoring_plugin = calloc(1, sizeof(monitoring_plugin));
|
||||
if (this_monitoring_plugin==NULL) {
|
||||
die(STATE_UNKNOWN, _("Cannot allocate memory: %s"),
|
||||
strerror(errno));
|
||||
}
|
||||
this_nagios_plugin->plugin_name = strdup(plugin_name);
|
||||
if (this_nagios_plugin->plugin_name==NULL)
|
||||
this_monitoring_plugin->plugin_name = strdup(plugin_name);
|
||||
if (this_monitoring_plugin->plugin_name==NULL)
|
||||
die(STATE_UNKNOWN, _("Cannot execute strdup: %s"), strerror(errno));
|
||||
this_nagios_plugin->argc = argc;
|
||||
this_nagios_plugin->argv = argv;
|
||||
this_monitoring_plugin->argc = argc;
|
||||
this_monitoring_plugin->argv = argv;
|
||||
}
|
||||
}
|
||||
|
||||
void np_set_args( int argc, char **argv ) {
|
||||
if (this_nagios_plugin==NULL)
|
||||
if (this_monitoring_plugin==NULL)
|
||||
die(STATE_UNKNOWN, _("This requires np_init to be called"));
|
||||
|
||||
this_nagios_plugin->argc = argc;
|
||||
this_nagios_plugin->argv = argv;
|
||||
this_monitoring_plugin->argc = argc;
|
||||
this_monitoring_plugin->argv = argv;
|
||||
}
|
||||
|
||||
|
||||
void np_cleanup() {
|
||||
if (this_nagios_plugin!=NULL) {
|
||||
if(this_nagios_plugin->state!=NULL) {
|
||||
if(this_nagios_plugin->state->state_data) {
|
||||
np_free(this_nagios_plugin->state->state_data->data);
|
||||
np_free(this_nagios_plugin->state->state_data);
|
||||
if (this_monitoring_plugin!=NULL) {
|
||||
if(this_monitoring_plugin->state!=NULL) {
|
||||
if(this_monitoring_plugin->state->state_data) {
|
||||
np_free(this_monitoring_plugin->state->state_data->data);
|
||||
np_free(this_monitoring_plugin->state->state_data);
|
||||
}
|
||||
np_free(this_nagios_plugin->state->name);
|
||||
np_free(this_nagios_plugin->state);
|
||||
np_free(this_monitoring_plugin->state->name);
|
||||
np_free(this_monitoring_plugin->state);
|
||||
}
|
||||
np_free(this_nagios_plugin->plugin_name);
|
||||
np_free(this_nagios_plugin);
|
||||
np_free(this_monitoring_plugin->plugin_name);
|
||||
np_free(this_monitoring_plugin);
|
||||
}
|
||||
this_nagios_plugin=NULL;
|
||||
this_monitoring_plugin=NULL;
|
||||
}
|
||||
|
||||
/* Hidden function to get a pointer to this_nagios_plugin for testing */
|
||||
void _get_nagios_plugin( nagios_plugin **pointer ){
|
||||
*pointer = this_nagios_plugin;
|
||||
/* Hidden function to get a pointer to this_monitoring_plugin for testing */
|
||||
void _get_monitoring_plugin( monitoring_plugin **pointer ){
|
||||
*pointer = this_monitoring_plugin;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -89,7 +91,7 @@ die (int result, const char *fmt, ...)
|
|||
va_start (ap, fmt);
|
||||
vprintf (fmt, ap);
|
||||
va_end (ap);
|
||||
if(this_nagios_plugin!=NULL) {
|
||||
if(this_monitoring_plugin!=NULL) {
|
||||
np_cleanup();
|
||||
}
|
||||
exit (result);
|
||||
|
@ -298,19 +300,6 @@ char *np_escaped_string (const char *string) {
|
|||
|
||||
int np_check_if_root(void) { return (geteuid() == 0); }
|
||||
|
||||
int np_warn_if_not_root(void) {
|
||||
int status = np_check_if_root();
|
||||
if(!status) {
|
||||
printf(_("Warning: "));
|
||||
printf(_("This plugin must be either run as root or setuid root.\n"));
|
||||
printf(_("To run as root, you can use a tool like sudo.\n"));
|
||||
printf(_("To set the setuid permissions, use the command:\n"));
|
||||
/* XXX could we use something like progname? */
|
||||
printf("\tchmod u+s yourpluginfile\n");
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract the value from key/value pairs, or return NULL. The value returned
|
||||
* can be free()ed.
|
||||
|
@ -367,6 +356,23 @@ char *np_extract_value(const char *varlist, const char *name, char sep) {
|
|||
return value;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Read a string representing a state (ok, warning... or numeric: 0, 1) and
|
||||
* return the corresponding STATE_ value or ERROR)
|
||||
*/
|
||||
int mp_translate_state (char *state_text) {
|
||||
if (!strcasecmp(state_text,"OK") || !strcmp(state_text,"0"))
|
||||
return STATE_OK;
|
||||
if (!strcasecmp(state_text,"WARNING") || !strcmp(state_text,"1"))
|
||||
return STATE_WARNING;
|
||||
if (!strcasecmp(state_text,"CRITICAL") || !strcmp(state_text,"2"))
|
||||
return STATE_CRITICAL;
|
||||
if (!strcasecmp(state_text,"UNKNOWN") || !strcmp(state_text,"3"))
|
||||
return STATE_UNKNOWN;
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a string to use as a keyname, based on an md5 hash of argv, thus
|
||||
* hopefully a unique key per service/plugin invocation. Use the extra-opts
|
||||
|
@ -375,14 +381,14 @@ char *np_extract_value(const char *varlist, const char *name, char sep) {
|
|||
char *_np_state_generate_key() {
|
||||
struct sha1_ctx ctx;
|
||||
int i;
|
||||
char **argv = this_nagios_plugin->argv;
|
||||
char **argv = this_monitoring_plugin->argv;
|
||||
unsigned char result[20];
|
||||
char keyname[41];
|
||||
char *p=NULL;
|
||||
|
||||
sha1_init_ctx(&ctx);
|
||||
|
||||
for(i=0; i<this_nagios_plugin->argc; i++) {
|
||||
for(i=0; i<this_monitoring_plugin->argc; i++) {
|
||||
sha1_process_bytes(argv[i], strlen(argv[i]), &ctx);
|
||||
}
|
||||
|
||||
|
@ -401,9 +407,9 @@ char *_np_state_generate_key() {
|
|||
}
|
||||
|
||||
void _cleanup_state_data() {
|
||||
if (this_nagios_plugin->state->state_data!=NULL) {
|
||||
np_free(this_nagios_plugin->state->state_data->data);
|
||||
np_free(this_nagios_plugin->state->state_data);
|
||||
if (this_monitoring_plugin->state->state_data!=NULL) {
|
||||
np_free(this_monitoring_plugin->state->state_data->data);
|
||||
np_free(this_monitoring_plugin->state->state_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -415,9 +421,18 @@ void _cleanup_state_data() {
|
|||
char* _np_state_calculate_location_prefix(){
|
||||
char *env_dir;
|
||||
|
||||
/* Do not allow passing MP_STATE_PATH in setuid plugins
|
||||
* for security reasons */
|
||||
if (mp_suid() == FALSE) {
|
||||
env_dir = getenv("MP_STATE_PATH");
|
||||
if(env_dir && env_dir[0] != '\0')
|
||||
return env_dir;
|
||||
/* This is the former ENV, for backward-compatibility */
|
||||
env_dir = getenv("NAGIOS_PLUGIN_STATE_DIRECTORY");
|
||||
if(env_dir && env_dir[0] != '\0')
|
||||
return env_dir;
|
||||
}
|
||||
|
||||
return NP_STATE_DIR_PREFIX;
|
||||
}
|
||||
|
||||
|
@ -432,7 +447,7 @@ void np_enable_state(char *keyname, int expected_data_version) {
|
|||
char *temp_keyname = NULL;
|
||||
char *p=NULL;
|
||||
|
||||
if(this_nagios_plugin==NULL)
|
||||
if(this_monitoring_plugin==NULL)
|
||||
die(STATE_UNKNOWN, _("This requires np_init to be called"));
|
||||
|
||||
this_state = (state_key *) calloc(1, sizeof(state_key));
|
||||
|
@ -456,15 +471,17 @@ void np_enable_state(char *keyname, int expected_data_version) {
|
|||
p++;
|
||||
}
|
||||
this_state->name=temp_keyname;
|
||||
this_state->plugin_name=this_nagios_plugin->plugin_name;
|
||||
this_state->plugin_name=this_monitoring_plugin->plugin_name;
|
||||
this_state->data_version=expected_data_version;
|
||||
this_state->state_data=NULL;
|
||||
|
||||
/* Calculate filename */
|
||||
asprintf(&temp_filename, "%s/%s/%s", _np_state_calculate_location_prefix(), this_nagios_plugin->plugin_name, this_state->name);
|
||||
asprintf(&temp_filename, "%s/%lu/%s/%s",
|
||||
_np_state_calculate_location_prefix(), (unsigned long)geteuid(),
|
||||
this_monitoring_plugin->plugin_name, this_state->name);
|
||||
this_state->_filename=temp_filename;
|
||||
|
||||
this_nagios_plugin->state = this_state;
|
||||
this_monitoring_plugin->state = this_state;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -479,11 +496,11 @@ state_data *np_state_read() {
|
|||
FILE *statefile;
|
||||
int rc = FALSE;
|
||||
|
||||
if(this_nagios_plugin==NULL)
|
||||
if(this_monitoring_plugin==NULL)
|
||||
die(STATE_UNKNOWN, _("This requires np_init to be called"));
|
||||
|
||||
/* Open file. If this fails, no previous state found */
|
||||
statefile = fopen( this_nagios_plugin->state->_filename, "r" );
|
||||
statefile = fopen( this_monitoring_plugin->state->_filename, "r" );
|
||||
if(statefile!=NULL) {
|
||||
|
||||
this_state_data = (state_data *) calloc(1, sizeof(state_data));
|
||||
|
@ -492,7 +509,7 @@ state_data *np_state_read() {
|
|||
strerror(errno));
|
||||
|
||||
this_state_data->data=NULL;
|
||||
this_nagios_plugin->state->state_data = this_state_data;
|
||||
this_monitoring_plugin->state->state_data = this_state_data;
|
||||
|
||||
rc = _np_state_read_file(statefile);
|
||||
|
||||
|
@ -503,7 +520,7 @@ state_data *np_state_read() {
|
|||
_cleanup_state_data();
|
||||
}
|
||||
|
||||
return this_nagios_plugin->state->state_data;
|
||||
return this_monitoring_plugin->state->state_data;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -544,7 +561,7 @@ int _np_state_read_file(FILE *f) {
|
|||
break;
|
||||
case STATE_DATA_VERSION:
|
||||
i=atoi(line);
|
||||
if(i != this_nagios_plugin->state->data_version)
|
||||
if(i != this_monitoring_plugin->state->data_version)
|
||||
failure++;
|
||||
else
|
||||
expected=STATE_DATA_TIME;
|
||||
|
@ -555,13 +572,13 @@ int _np_state_read_file(FILE *f) {
|
|||
if(data_time > current_time)
|
||||
failure++;
|
||||
else {
|
||||
this_nagios_plugin->state->state_data->time = data_time;
|
||||
this_monitoring_plugin->state->state_data->time = data_time;
|
||||
expected=STATE_DATA_TEXT;
|
||||
}
|
||||
break;
|
||||
case STATE_DATA_TEXT:
|
||||
this_nagios_plugin->state->state_data->data = strdup(line);
|
||||
if(this_nagios_plugin->state->state_data->data==NULL)
|
||||
this_monitoring_plugin->state->state_data->data = strdup(line);
|
||||
if(this_monitoring_plugin->state->state_data->data==NULL)
|
||||
die(STATE_UNKNOWN, _("Cannot execute strdup: %s"), strerror(errno));
|
||||
expected=STATE_DATA_END;
|
||||
status=TRUE;
|
||||
|
@ -596,8 +613,8 @@ void np_state_write_string(time_t data_time, char *data_string) {
|
|||
current_time=data_time;
|
||||
|
||||
/* If file doesn't currently exist, create directories */
|
||||
if(access(this_nagios_plugin->state->_filename,F_OK)!=0) {
|
||||
asprintf(&directories, "%s", this_nagios_plugin->state->_filename);
|
||||
if(access(this_monitoring_plugin->state->_filename,F_OK)!=0) {
|
||||
asprintf(&directories, "%s", this_monitoring_plugin->state->_filename);
|
||||
if(directories==NULL)
|
||||
die(STATE_UNKNOWN, _("Cannot allocate memory: %s"),
|
||||
strerror(errno));
|
||||
|
@ -616,7 +633,7 @@ void np_state_write_string(time_t data_time, char *data_string) {
|
|||
np_free(directories);
|
||||
}
|
||||
|
||||
asprintf(&temp_file,"%s.XXXXXX",this_nagios_plugin->state->_filename);
|
||||
asprintf(&temp_file,"%s.XXXXXX",this_monitoring_plugin->state->_filename);
|
||||
if(temp_file==NULL)
|
||||
die(STATE_UNKNOWN, _("Cannot allocate memory: %s"),
|
||||
strerror(errno));
|
||||
|
@ -636,7 +653,7 @@ void np_state_write_string(time_t data_time, char *data_string) {
|
|||
|
||||
fprintf(fp,"# NP State file\n");
|
||||
fprintf(fp,"%d\n",NP_STATE_FORMAT_VERSION);
|
||||
fprintf(fp,"%d\n",this_nagios_plugin->state->data_version);
|
||||
fprintf(fp,"%d\n",this_monitoring_plugin->state->data_version);
|
||||
fprintf(fp,"%lu\n",current_time);
|
||||
fprintf(fp,"%s\n",data_string);
|
||||
|
||||
|
@ -654,7 +671,7 @@ void np_state_write_string(time_t data_time, char *data_string) {
|
|||
die(STATE_UNKNOWN, _("Error writing temp file"));
|
||||
}
|
||||
|
||||
if(rename(temp_file, this_nagios_plugin->state->_filename)!=0) {
|
||||
if(rename(temp_file, this_monitoring_plugin->state->_filename)!=0) {
|
||||
unlink(temp_file);
|
||||
np_free(temp_file);
|
||||
die(STATE_UNKNOWN, _("Cannot rename state temp file"));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef _UTILS_BASE_
|
||||
#define _UTILS_BASE_
|
||||
/* Header file for nagios plugins utils_base.c */
|
||||
/* Header file for Monitoring Plugins utils_base.c */
|
||||
|
||||
#include "sha1.h"
|
||||
|
||||
|
@ -52,7 +52,7 @@ typedef struct np_struct {
|
|||
state_key *state;
|
||||
int argc;
|
||||
char **argv;
|
||||
} nagios_plugin;
|
||||
} monitoring_plugin;
|
||||
|
||||
range *parse_range_string (char *);
|
||||
int _set_thresholds(thresholds **, char *, char *);
|
||||
|
@ -62,7 +62,7 @@ int check_range(double, range *);
|
|||
int get_status(double, thresholds *);
|
||||
|
||||
/* All possible characters in a threshold range */
|
||||
#define NP_THRESHOLDS_CHARS "0123456789.:@~"
|
||||
#define NP_THRESHOLDS_CHARS "-0123456789.:@~"
|
||||
|
||||
char *np_escaped_string (const char *);
|
||||
|
||||
|
@ -75,9 +75,10 @@ void die (int, const char *, ...) __attribute__((noreturn,format(printf, 2, 3)))
|
|||
/* a simple check to see if we're running as root.
|
||||
* returns zero on failure, nonzero on success */
|
||||
int np_check_if_root(void);
|
||||
/* and a helpful wrapper around that. it returns the same status
|
||||
* code from the above function, in case it's helpful for testing */
|
||||
int np_warn_if_not_root(void);
|
||||
|
||||
/* mp_suid() returns true if the real and effective uids differs, such as when
|
||||
* running a suid plugin */
|
||||
#define mp_suid() (getuid() != geteuid())
|
||||
|
||||
/*
|
||||
* Extract the value from key/value pairs, or return NULL. The value returned
|
||||
|
@ -93,6 +94,11 @@ char *np_extract_value(const char*, const char*, char);
|
|||
*/
|
||||
#define np_extract_ntpvar(l, n) np_extract_value(l, n, ',')
|
||||
|
||||
/*
|
||||
* Read a string representing a state (ok, warning... or numeric: 0, 1) and
|
||||
* return the corresponding NP_STATE or ERROR)
|
||||
*/
|
||||
int mp_translate_state (char *);
|
||||
|
||||
void np_enable_state(char *, int);
|
||||
state_data *np_state_read();
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios run command utilities
|
||||
* Monitoring run command utilities
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2005-2006 Nagios Plugins Development Team
|
||||
* Copyright (c) 2005-2006 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description :
|
||||
*
|
||||
|
@ -391,5 +391,8 @@ cmd_file_read ( char *filename, output *out, int flags)
|
|||
if(out)
|
||||
out->lines = _cmd_fetch_output (fd, out, flags);
|
||||
|
||||
if (close(fd) == -1)
|
||||
die( STATE_UNKNOWN, _("Error closing %s: %s"), filename, strerror(errno) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define _UTILS_CMD_
|
||||
|
||||
/*
|
||||
* Header file for nagios plugins utils_cmd.c
|
||||
* Header file for Monitoring Plugins utils_cmd.c
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Library for check_disk
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 1999-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 1999-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Library for check_tcp
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 1999-2013 Nagios Plugins Development Team
|
||||
* Copyright (c) 1999-2013 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# np_mysqlclient.m4
|
||||
dnl Copyright (C) 2007 Nagios Plugins Team
|
||||
dnl This file is free software; the Nagios Plugin Team
|
||||
dnl Copyright (C) 2007 Monitoring Plugins Team
|
||||
dnl This file is free software; the Monitoring Plugins Team
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
|
|
|
@ -15,15 +15,15 @@
|
|||
%define nphome /opt/nagios
|
||||
%define npgrp nagios
|
||||
|
||||
Name: nagios-plugins
|
||||
Version: 1.5
|
||||
Name: monitoring-plugins
|
||||
Version: 2.0
|
||||
Release: 1
|
||||
Summary: Host/service/network monitoring program plugins for Nagios
|
||||
Summary: Host/service/network monitoring program plugins for Nagios and compatible
|
||||
|
||||
Group: Applications/System
|
||||
License: GPL
|
||||
URL: http://nagiosplug.sourceforge.net/
|
||||
Source0: http://dl.sf.net/sourceforge/nagiosplug/%{name}-%{version}.tar.gz
|
||||
URL: https://www.monitoring-plugins.org/
|
||||
Source0: https://www.monitoring-plugins.org/download/%{name}-%{version}.tar.gz
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
%define npdir %{_builddir}/%{name}-%{version}
|
||||
|
@ -34,11 +34,11 @@ Prefix: %{_prefix}
|
|||
Prefix: %{_prefix}/lib/nagios/plugins
|
||||
%endif
|
||||
Packager: Karl DeBisschop <kdebisschop@users.sourceforge.net>
|
||||
Vendor: Nagios Plugin Development Group
|
||||
Provides: nagios-plugins
|
||||
Vendor: Monitoring Plugins Development Team
|
||||
Provides: monitoring-plugins
|
||||
|
||||
%{!?custom:%global custom 0}
|
||||
Obsoletes: nagios-plugins-custom nagios-plugins-extras
|
||||
Obsoletes: monitoring-plugins-custom monitoring-plugins-extras
|
||||
|
||||
|
||||
# Requires
|
||||
|
@ -105,8 +105,8 @@ network, and to email or page you when a problem arises or is
|
|||
resolved. Nagios runs on a unix server as a background or daemon
|
||||
process, intermittently running checks on various services that you
|
||||
specify. The actual service checks are performed by separate "plugin"
|
||||
programs which return the status of the checks to Nagios. This package
|
||||
contains those plugins.
|
||||
programs which return the status of the checks to the monitoring
|
||||
system. This package contains those plugins.
|
||||
|
||||
|
||||
%prep
|
||||
|
@ -163,8 +163,6 @@ fi
|
|||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
make AM_INSTALL_PROGRAM_FLAGS="" DESTDIR=${RPM_BUILD_ROOT} install
|
||||
build-aux/install-sh -c -d ${RPM_BUILD_ROOT}%{_sysconfdir}
|
||||
build-aux/install-sh -c -m 664 command.cfg ${RPM_BUILD_ROOT}%{_sysconfdir}
|
||||
%find_lang %{name}
|
||||
echo "%defattr(755,%{npusr},%{npgrp})" >> %{name}.lang
|
||||
comm -13 %{npdir}/ls-plugins-before %{npdir}/ls-plugins-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang
|
||||
|
@ -174,6 +172,10 @@ echo "%defattr(755,%{npusr},%{npgrp})" >> %{name}.lang
|
|||
comm -13 %{npdir}/ls-plugins-scripts-before %{npdir}/ls-plugins-scripts-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang
|
||||
echo "%{_libexecdir}/utils.pm" >> %{name}.lang
|
||||
echo "%{_libexecdir}/utils.sh" >> %{name}.lang
|
||||
echo "%{_libexecdir}/check_ldaps" >> %{name}.lang
|
||||
|
||||
sed -i '/libnpcommon/d' %{name}.lang
|
||||
sed -i '/monitoring-plugins.mo/d' %{name}.lang
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
@ -184,8 +186,8 @@ rm -rf $RPM_BUILD_ROOT
|
|||
%doc CODING COPYING FAQ INSTALL LEGAL README REQUIREMENTS SUPPORT THANKS
|
||||
%doc ChangeLog command.cfg
|
||||
%if ! %{isaix}
|
||||
%{_datadir}/locale/de/LC_MESSAGES/nagios-plugins.mo
|
||||
%{_datadir}/locale/fr/LC_MESSAGES/nagios-plugins.mo
|
||||
%{_datadir}/locale/de/LC_MESSAGES/monitoring-plugins.mo
|
||||
%{_datadir}/locale/fr/LC_MESSAGES/monitoring-plugins.mo
|
||||
%endif
|
||||
|
||||
%changelog
|
|
@ -15,15 +15,15 @@
|
|||
%define nphome /opt/nagios
|
||||
%define npgrp nagios
|
||||
|
||||
Name: nagios-plugins
|
||||
Name: monitoring-plugins
|
||||
Version: @PACKAGE_VERSION@
|
||||
Release: @RELEASE@
|
||||
Summary: Host/service/network monitoring program plugins for Nagios
|
||||
Summary: Host/service/network monitoring program plugins for Nagios and compatible
|
||||
|
||||
Group: Applications/System
|
||||
License: GPL
|
||||
URL: http://nagiosplug.sourceforge.net/
|
||||
Source0: http://dl.sf.net/sourceforge/nagiosplug/%{name}-%{version}.tar.gz
|
||||
URL: https://www.monitoring-plugins.org/
|
||||
Source0: https://www.monitoring-plugins.org/download/%{name}-%{version}.tar.gz
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
%define npdir %{_builddir}/%{name}-%{version}
|
||||
|
@ -34,11 +34,11 @@ Prefix: %{_prefix}
|
|||
Prefix: %{_prefix}/lib/nagios/plugins
|
||||
%endif
|
||||
Packager: Karl DeBisschop <kdebisschop@users.sourceforge.net>
|
||||
Vendor: Nagios Plugin Development Group
|
||||
Provides: nagios-plugins
|
||||
Vendor: Monitoring Plugins Development Team
|
||||
Provides: monitoring-plugins
|
||||
|
||||
%{!?custom:%global custom 0}
|
||||
Obsoletes: nagios-plugins-custom nagios-plugins-extras
|
||||
Obsoletes: monitoring-plugins-custom monitoring-plugins-extras
|
||||
|
||||
|
||||
# Requires
|
||||
|
@ -105,8 +105,8 @@ network, and to email or page you when a problem arises or is
|
|||
resolved. Nagios runs on a unix server as a background or daemon
|
||||
process, intermittently running checks on various services that you
|
||||
specify. The actual service checks are performed by separate "plugin"
|
||||
programs which return the status of the checks to Nagios. This package
|
||||
contains those plugins.
|
||||
programs which return the status of the checks to the monitoring
|
||||
system. This package contains those plugins.
|
||||
|
||||
|
||||
%prep
|
||||
|
@ -163,8 +163,6 @@ fi
|
|||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
make AM_INSTALL_PROGRAM_FLAGS="" DESTDIR=${RPM_BUILD_ROOT} install
|
||||
build-aux/install-sh -c -d ${RPM_BUILD_ROOT}%{_sysconfdir}
|
||||
build-aux/install-sh -c -m 664 command.cfg ${RPM_BUILD_ROOT}%{_sysconfdir}
|
||||
%find_lang %{name}
|
||||
echo "%defattr(755,%{npusr},%{npgrp})" >> %{name}.lang
|
||||
comm -13 %{npdir}/ls-plugins-before %{npdir}/ls-plugins-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang
|
||||
|
@ -174,6 +172,10 @@ echo "%defattr(755,%{npusr},%{npgrp})" >> %{name}.lang
|
|||
comm -13 %{npdir}/ls-plugins-scripts-before %{npdir}/ls-plugins-scripts-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang
|
||||
echo "%{_libexecdir}/utils.pm" >> %{name}.lang
|
||||
echo "%{_libexecdir}/utils.sh" >> %{name}.lang
|
||||
echo "%{_libexecdir}/check_ldaps" >> %{name}.lang
|
||||
|
||||
sed -i '/libnpcommon/d' %{name}.lang
|
||||
sed -i '/monitoring-plugins.mo/d' %{name}.lang
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
@ -184,8 +186,8 @@ rm -rf $RPM_BUILD_ROOT
|
|||
%doc CODING COPYING FAQ INSTALL LEGAL README REQUIREMENTS SUPPORT THANKS
|
||||
%doc ChangeLog command.cfg
|
||||
%if ! %{isaix}
|
||||
%{_datadir}/locale/de/LC_MESSAGES/nagios-plugins.mo
|
||||
%{_datadir}/locale/fr/LC_MESSAGES/nagios-plugins.mo
|
||||
%{_datadir}/locale/de/LC_MESSAGES/monitoring-plugins.mo
|
||||
%{_datadir}/locale/fr/LC_MESSAGES/monitoring-plugins.mo
|
||||
%endif
|
||||
|
||||
%changelog
|
|
@ -1,12 +1,12 @@
|
|||
PKG="NGOSplugin"
|
||||
NAME="nagios-plugins"
|
||||
DESC="Nagios network monitoring plugins"
|
||||
NAME="monitoring-plugins"
|
||||
DESC="Network Monitoring Plugins for Nagios and compatible"
|
||||
ARCH="unknown"
|
||||
VERSION="1.5,REV=2013.10.02.17.25"
|
||||
VERSION="2.0,REV=2014.07.11.17.16"
|
||||
CATEGORY="application"
|
||||
VENDOR="Nagios Plugin Development Team"
|
||||
EMAIL="nagiosplug-devel@lists.sourceforge.net"
|
||||
PSTAMP="nag20131002172555"
|
||||
VENDOR="Monitoring Plugins Development Team"
|
||||
EMAIL="devel@monitoring-plugins.org"
|
||||
PSTAMP="nag20140711171632"
|
||||
BASEDIR="/"
|
||||
CLASSES="none"
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
PKG="NGOSplugin"
|
||||
NAME="nagios-plugins"
|
||||
DESC="Nagios network monitoring plugins"
|
||||
NAME="monitoring-plugins"
|
||||
DESC="Network Monitoring Plugins for Nagios and compatible"
|
||||
ARCH="@PKG_ARCH@"
|
||||
VERSION="@PACKAGE_VERSION@,REV=@REV_DATESTAMP@"
|
||||
CATEGORY="application"
|
||||
VENDOR="Nagios Plugin Development Team"
|
||||
EMAIL="nagiosplug-devel@lists.sourceforge.net"
|
||||
VENDOR="Monitoring Plugins Development Team"
|
||||
EMAIL="devel@monitoring-plugins.org"
|
||||
PSTAMP="nag@REV_TIMESTAMP@"
|
||||
BASEDIR="/"
|
||||
CLASSES="none"
|
||||
|
|
|
@ -26,7 +26,7 @@ EXTRA_PROGRAMS = pst3
|
|||
|
||||
EXTRA_DIST = t pst3.c
|
||||
|
||||
BASEOBJS = ../plugins/utils.o ../lib/libnagiosplug.a ../gl/libgnu.a
|
||||
BASEOBJS = ../plugins/utils.o ../lib/libmonitoringplug.a ../gl/libgnu.a
|
||||
NETOBJS = ../plugins/netutils.o $(BASEOBJS) $(EXTRA_NETOBJS)
|
||||
NETLIBS = $(NETOBJS) $(SOCKETLIBS)
|
||||
|
||||
|
@ -83,7 +83,7 @@ check_icmp_LDADD = @LTLIBINTL@ $(NETLIBS) $(SOCKETLIBS)
|
|||
# -m64 needed at compiler and linker phase
|
||||
pst3_CFLAGS = @PST3CFLAGS@
|
||||
pst3_LDFLAGS = @PST3CFLAGS@
|
||||
# pst3 must not use nagiosplug/gnulib includes!
|
||||
# pst3 must not use monitoringplug/gnulib includes!
|
||||
pst3_CPPFLAGS =
|
||||
|
||||
check_dhcp_DEPENDENCIES = check_dhcp.c $(NETOBJS) $(DEPLIBS)
|
||||
|
|
|
@ -80,6 +80,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 \
|
||||
|
@ -129,11 +130,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 \
|
||||
|
@ -148,7 +150,7 @@ 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
|
||||
|
@ -308,6 +310,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@
|
||||
|
@ -673,6 +676,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@
|
||||
|
@ -702,6 +706,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@
|
||||
|
@ -813,8 +818,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@
|
||||
|
@ -905,7 +912,6 @@ LD = @LD@
|
|||
LDAPINCLUDE = @LDAPINCLUDE@
|
||||
LDAPLIBS = @LDAPLIBS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
|
||||
LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@
|
||||
LIBGNU_LTLIBDEPS = @LIBGNU_LTLIBDEPS@
|
||||
LIBICONV = @LIBICONV@
|
||||
|
@ -931,6 +937,7 @@ LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
|
|||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LTLIBPTH = @LTLIBPTH@
|
||||
LTLIBTHREAD = @LTLIBTHREAD@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MATHLIBS = @MATHLIBS@
|
||||
|
@ -956,6 +963,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@
|
||||
|
@ -976,6 +984,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@
|
||||
|
@ -1035,7 +1044,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@
|
||||
|
@ -1227,7 +1235,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@
|
||||
|
@ -1251,6 +1258,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@
|
||||
|
@ -1319,7 +1327,7 @@ with_trusted_path = @with_trusted_path@
|
|||
AM_CFLAGS = -DNP_VERSION='"$(NP_VERSION)"'
|
||||
AM_CPPFLAGS = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/plugins @SSLINCLUDE@
|
||||
EXTRA_DIST = t pst3.c
|
||||
BASEOBJS = ../plugins/utils.o ../lib/libnagiosplug.a ../gl/libgnu.a
|
||||
BASEOBJS = ../plugins/utils.o ../lib/libmonitoringplug.a ../gl/libgnu.a
|
||||
NETOBJS = ../plugins/netutils.o $(BASEOBJS) $(EXTRA_NETOBJS)
|
||||
NETLIBS = $(NETOBJS) $(SOCKETLIBS)
|
||||
TESTS_ENVIRONMENT = perl -I $(top_builddir) -I $(top_srcdir)
|
||||
|
@ -1349,7 +1357,7 @@ check_icmp_LDADD = @LTLIBINTL@ $(NETLIBS) $(SOCKETLIBS)
|
|||
# -m64 needed at compiler and linker phase
|
||||
pst3_CFLAGS = @PST3CFLAGS@
|
||||
pst3_LDFLAGS = @PST3CFLAGS@
|
||||
# pst3 must not use nagiosplug/gnulib includes!
|
||||
# pst3 must not use monitoringplug/gnulib includes!
|
||||
pst3_CPPFLAGS =
|
||||
check_dhcp_DEPENDENCIES = check_dhcp.c $(NETOBJS) $(DEPLIBS)
|
||||
check_icmp_DEPENDENCIES = check_icmp.c $(NETOBJS)
|
||||
|
@ -1357,7 +1365,7 @@ all: all-am
|
|||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(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*) \
|
||||
|
@ -1382,9 +1390,9 @@ 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):
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_dhcp plugin
|
||||
* Monitoring check_dhcp plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2001-2004 Ethan Galstad (nagios@nagios.org)
|
||||
* Copyright (c) 2001-2007 Nagios Plugin Development Team
|
||||
* Copyright (c) 2001-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -35,7 +35,7 @@
|
|||
|
||||
const char *progname = "check_dhcp";
|
||||
const char *copyright = "2001-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
|
@ -270,9 +270,6 @@ int main(int argc, char **argv){
|
|||
usage4 (_("Could not parse arguments"));
|
||||
}
|
||||
|
||||
/* this plugin almost certainly needs root permissions. */
|
||||
np_warn_if_not_root();
|
||||
|
||||
/* create socket for DHCP communications */
|
||||
dhcp_socket=create_dhcp_socket();
|
||||
|
||||
|
@ -837,7 +834,7 @@ int add_dhcp_offer(struct in_addr source,dhcp_packet *offer_packet){
|
|||
return ERROR;
|
||||
|
||||
/* process all DHCP options present in the packet */
|
||||
for(x=4;x<MAX_DHCP_OPTIONS_LENGTH;){
|
||||
for(x=4;x<MAX_DHCP_OPTIONS_LENGTH-1;){
|
||||
|
||||
if((int)offer_packet->options[x]==-1)
|
||||
break;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_icmp plugin
|
||||
* Monitoring check_icmp plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2005-2008 Nagios Plugins Development Team
|
||||
* Copyright (c) 2005-2008 Monitoring Plugins Development Team
|
||||
* Original Author : Andreas Ericsson <ae@op5.se>
|
||||
*
|
||||
* Description:
|
||||
|
@ -40,9 +40,9 @@
|
|||
/* char *progname = "check_icmp"; */
|
||||
char *progname;
|
||||
const char *copyright = "2005-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
/** nagios plugins basic includes */
|
||||
/** Monitoring Plugins basic includes */
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
#include "utils.h"
|
||||
|
@ -383,9 +383,6 @@ main(int argc, char **argv)
|
|||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
/* print a helpful error message if geteuid != 0 */
|
||||
np_warn_if_not_root();
|
||||
|
||||
/* we only need to be setsuid when we get the sockets, so do
|
||||
* that before pointer magic (esp. on network data) */
|
||||
icmp_sockerrno = udp_sockerrno = tcp_sockerrno = sockets = 0;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* pst3
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2008 Nagios Plugin Development Team
|
||||
* Copyright (c) 2008 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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'}='';
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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) {
|
||||
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";
|
||||
|
|
|
@ -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'};
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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"};
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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();
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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{'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"};
|
||||
|
|
|
@ -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]
|
||||
}
|
||||
|
|
|
@ -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'}='';
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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"
|
||||
);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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@"
|
||||
}
|
||||
|
||||
#
|
||||
|
|
|
@ -13,7 +13,8 @@ AM_CFLAGS = -DNP_VERSION='"$(NP_VERSION)"'
|
|||
|
||||
VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plugins/t
|
||||
|
||||
INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl @LDAPINCLUDE@ @PGINCLUDE@ @SSLINCLUDE@
|
||||
AM_CPPFLAGS = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl \
|
||||
@LDAPINCLUDE@ @PGINCLUDE@ @SSLINCLUDE@
|
||||
|
||||
localedir = $(datadir)/locale
|
||||
# gettext docs say to use AM_CPPFLAGS, but per module_CPPFLAGS override this
|
||||
|
@ -48,7 +49,7 @@ noinst_LIBRARIES = libnpcommon.a
|
|||
libnpcommon_a_SOURCES = utils.c netutils.c sslutils.c runcmd.c \
|
||||
popen.c utils.h netutils.h popen.h common.h runcmd.c runcmd.h
|
||||
|
||||
BASEOBJS = libnpcommon.a ../lib/libnagiosplug.a ../gl/libgnu.a
|
||||
BASEOBJS = libnpcommon.a ../lib/libmonitoringplug.a ../gl/libgnu.a
|
||||
NETOBJS = $(BASEOBJS) $(EXTRA_NETOBLS)
|
||||
NETLIBS = $(NETOBJS) $(SOCKETLIBS)
|
||||
SSLOBJS = $(BASEOBJS) $(NETLIBS) $(SSLLIBS)
|
||||
|
@ -81,11 +82,11 @@ check_ldap_LDADD = $(NETLIBS) $(LDAPLIBS)
|
|||
check_load_LDADD = $(BASEOBJS)
|
||||
check_mrtg_LDADD = $(BASEOBJS)
|
||||
check_mrtgtraf_LDADD = $(BASEOBJS)
|
||||
check_mysql_CFLAGS = $(MYSQLCFLAGS) -DNP_VERSION='"$(NP_VERSION)"'
|
||||
check_mysql_CPPFLAGS = $(MYSQLINCLUDE)
|
||||
check_mysql_CFLAGS = $(AM_CFLAGS) $(MYSQLCFLAGS)
|
||||
check_mysql_CPPFLAGS = $(AM_CPPFLAGS) $(MYSQLINCLUDE)
|
||||
check_mysql_LDADD = $(NETLIBS) $(MYSQLLIBS)
|
||||
check_mysql_query_CFLAGS = $(MYSQLCFLAGS) -DNP_VERSION='"$(NP_VERSION)"'
|
||||
check_mysql_query_CPPFLAGS = $(MYSQLINCLUDE)
|
||||
check_mysql_query_CFLAGS = $(AM_CFLAGS) $(MYSQLCFLAGS)
|
||||
check_mysql_query_CPPFLAGS = $(AM_CPPFLAGS) $(MYSQLINCLUDE)
|
||||
check_mysql_query_LDADD = $(NETLIBS) $(MYSQLLIBS)
|
||||
check_nagios_LDADD = $(BASEOBJS)
|
||||
check_nt_LDADD = $(NETLIBS)
|
||||
|
@ -106,7 +107,7 @@ check_tcp_LDADD = $(SSLOBJS)
|
|||
check_time_LDADD = $(NETLIBS)
|
||||
check_ntp_time_LDADD = $(NETLIBS) $(MATHLIBS)
|
||||
check_ups_LDADD = $(NETLIBS)
|
||||
check_users_LDADD = $(BASEOBJS)
|
||||
check_users_LDADD = $(BASEOBJS) $(WTSAPI32LIBS)
|
||||
check_by_ssh_LDADD = $(NETLIBS)
|
||||
check_ide_smart_LDADD = $(BASEOBJS)
|
||||
negate_LDADD = $(BASEOBJS)
|
||||
|
@ -136,4 +137,3 @@ clean-local:
|
|||
|
||||
uninstall-local:
|
||||
cd $(DESTDIR)$(libexecdir) && rm -f $(check_tcp_programs)
|
||||
|
||||
|
|
|
@ -96,6 +96,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 \
|
||||
|
@ -145,11 +146,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 \
|
||||
|
@ -164,7 +166,7 @@ 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
|
||||
|
@ -326,7 +328,8 @@ check_ups_OBJECTS = check_ups.$(OBJEXT)
|
|||
check_ups_DEPENDENCIES = $(am__DEPENDENCIES_13)
|
||||
check_users_SOURCES = check_users.c
|
||||
check_users_OBJECTS = check_users.$(OBJEXT)
|
||||
check_users_DEPENDENCIES = $(BASEOBJS) $(am__append_1)
|
||||
check_users_DEPENDENCIES = $(BASEOBJS) $(am__DEPENDENCIES_1) \
|
||||
$(am__append_1)
|
||||
negate_SOURCES = negate.c
|
||||
negate_OBJECTS = negate.$(OBJEXT)
|
||||
negate_DEPENDENCIES = $(BASEOBJS)
|
||||
|
@ -492,6 +495,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@
|
||||
|
@ -857,6 +861,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@
|
||||
|
@ -886,6 +891,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@
|
||||
|
@ -997,8 +1003,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@
|
||||
|
@ -1089,7 +1097,6 @@ LD = @LD@
|
|||
LDAPINCLUDE = @LDAPINCLUDE@
|
||||
LDAPLIBS = @LDAPLIBS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
|
||||
LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@
|
||||
LIBGNU_LTLIBDEPS = @LIBGNU_LTLIBDEPS@
|
||||
LIBICONV = @LIBICONV@
|
||||
|
@ -1116,6 +1123,7 @@ LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
|
|||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LTLIBPTH = @LTLIBPTH@
|
||||
LTLIBTHREAD = @LTLIBTHREAD@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MATHLIBS = @MATHLIBS@
|
||||
|
@ -1141,6 +1149,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@
|
||||
|
@ -1161,6 +1170,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@
|
||||
|
@ -1220,7 +1230,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@
|
||||
|
@ -1412,7 +1421,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@
|
||||
|
@ -1436,6 +1444,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@
|
||||
|
@ -1502,7 +1511,9 @@ top_srcdir = @top_srcdir@
|
|||
with_trusted_path = @with_trusted_path@
|
||||
@RELEASE_PRESENT_TRUE@NP_VERSION = @NP_RELEASE@
|
||||
AM_CFLAGS = -DNP_VERSION='"$(NP_VERSION)"'
|
||||
INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl @LDAPINCLUDE@ @PGINCLUDE@ @SSLINCLUDE@
|
||||
AM_CPPFLAGS = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl \
|
||||
@LDAPINCLUDE@ @PGINCLUDE@ @SSLINCLUDE@
|
||||
|
||||
check_tcp_programs = check_ftp check_imap check_nntp check_pop \
|
||||
check_udp check_clamd @check_tcp_ssl@
|
||||
|
||||
|
@ -1512,7 +1523,7 @@ noinst_LIBRARIES = libnpcommon.a
|
|||
libnpcommon_a_SOURCES = utils.c netutils.c sslutils.c runcmd.c \
|
||||
popen.c utils.h netutils.h popen.h common.h runcmd.c runcmd.h
|
||||
|
||||
BASEOBJS = libnpcommon.a ../lib/libnagiosplug.a ../gl/libgnu.a
|
||||
BASEOBJS = libnpcommon.a ../lib/libmonitoringplug.a ../gl/libgnu.a
|
||||
NETOBJS = $(BASEOBJS) $(EXTRA_NETOBLS)
|
||||
NETLIBS = $(NETOBJS) $(SOCKETLIBS)
|
||||
SSLOBJS = $(BASEOBJS) $(NETLIBS) $(SSLLIBS)
|
||||
|
@ -1536,11 +1547,11 @@ check_ldap_LDADD = $(NETLIBS) $(LDAPLIBS)
|
|||
check_load_LDADD = $(BASEOBJS)
|
||||
check_mrtg_LDADD = $(BASEOBJS)
|
||||
check_mrtgtraf_LDADD = $(BASEOBJS)
|
||||
check_mysql_CFLAGS = $(MYSQLCFLAGS) -DNP_VERSION='"$(NP_VERSION)"'
|
||||
check_mysql_CPPFLAGS = $(MYSQLINCLUDE)
|
||||
check_mysql_CFLAGS = $(AM_CFLAGS) $(MYSQLCFLAGS)
|
||||
check_mysql_CPPFLAGS = $(AM_CPPFLAGS) $(MYSQLINCLUDE)
|
||||
check_mysql_LDADD = $(NETLIBS) $(MYSQLLIBS)
|
||||
check_mysql_query_CFLAGS = $(MYSQLCFLAGS) -DNP_VERSION='"$(NP_VERSION)"'
|
||||
check_mysql_query_CPPFLAGS = $(MYSQLINCLUDE)
|
||||
check_mysql_query_CFLAGS = $(AM_CFLAGS) $(MYSQLCFLAGS)
|
||||
check_mysql_query_CPPFLAGS = $(AM_CPPFLAGS) $(MYSQLINCLUDE)
|
||||
check_mysql_query_LDADD = $(NETLIBS) $(MYSQLLIBS)
|
||||
check_nagios_LDADD = $(BASEOBJS)
|
||||
check_nt_LDADD = $(NETLIBS)
|
||||
|
@ -1561,7 +1572,7 @@ check_tcp_LDADD = $(SSLOBJS)
|
|||
check_time_LDADD = $(NETLIBS)
|
||||
check_ntp_time_LDADD = $(NETLIBS) $(MATHLIBS)
|
||||
check_ups_LDADD = $(NETLIBS)
|
||||
check_users_LDADD = $(BASEOBJS) $(am__append_1)
|
||||
check_users_LDADD = $(BASEOBJS) $(WTSAPI32LIBS) $(am__append_1)
|
||||
check_by_ssh_LDADD = $(NETLIBS)
|
||||
check_ide_smart_LDADD = $(BASEOBJS)
|
||||
negate_LDADD = $(BASEOBJS)
|
||||
|
@ -1570,7 +1581,7 @@ all: all-am
|
|||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(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*) \
|
||||
|
@ -1595,9 +1606,9 @@ 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):
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_apt plugin
|
||||
* Monitoring check_apt plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2006-2008 Nagios Plugins Development Team
|
||||
* Copyright (c) 2006-2008 Monitoring Plugins Development Team
|
||||
*
|
||||
* Original author: Sean Finney
|
||||
*
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
const char *progname = "check_apt";
|
||||
const char *copyright = "2006-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "runcmd.h"
|
||||
|
@ -124,7 +124,7 @@ int main (int argc, char **argv) {
|
|||
(stderr_warning)?" warnings detected":"",
|
||||
(stderr_warning && exec_warning)?",":"",
|
||||
(exec_warning)?" errors detected":"",
|
||||
(stderr_warning||exec_warning)?". run with -v for information.":"",
|
||||
(stderr_warning||exec_warning)?".":"",
|
||||
packages_available,
|
||||
sec_count
|
||||
);
|
||||
|
@ -223,6 +223,9 @@ int run_upgrade(int *pkgcount, int *secpkgcount){
|
|||
regex_t ireg, ereg, sreg;
|
||||
char *cmdline=NULL, rerrbuf[64];
|
||||
|
||||
/* initialize ereg as it is possible it is printed while uninitialized */
|
||||
memset(&ereg, "\0", sizeof(ereg.buffer));
|
||||
|
||||
if(upgrade==NO_UPGRADE) return STATE_OK;
|
||||
|
||||
/* compile the regexps */
|
||||
|
@ -430,7 +433,7 @@ print_help (void)
|
|||
printf(UT_HELP_VRSN);
|
||||
printf(UT_EXTRA_OPTS);
|
||||
|
||||
printf(UT_TIMEOUT, timeout_interval);
|
||||
printf(UT_PLUG_TIMEOUT, timeout_interval);
|
||||
|
||||
printf (" %s\n", "-U, --upgrade=OPTS");
|
||||
printf (" %s\n", _("[Default] Perform an upgrade. If an optional OPTS argument is provided,"));
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_by_ssh plugin
|
||||
* Monitoring check_by_ssh plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2000-2008 Nagios Plugins Development Team
|
||||
* Copyright (c) 2000-2008 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -28,7 +28,7 @@
|
|||
|
||||
const char *progname = "check_by_ssh";
|
||||
const char *copyright = "2000-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "utils.h"
|
||||
|
@ -246,7 +246,7 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
service[services - 1] = p1;
|
||||
break;
|
||||
case 'n': /* short name of host in nagios configuration */
|
||||
case 'n': /* short name of host in the monitoring configuration */
|
||||
host_shortname = optarg;
|
||||
break;
|
||||
|
||||
|
@ -371,7 +371,7 @@ validate_arguments (void)
|
|||
die (STATE_UNKNOWN, _("%s: In passive mode, you must provide a service name for each command.\n"), progname);
|
||||
|
||||
if (passive && host_shortname == NULL)
|
||||
die (STATE_UNKNOWN, _("%s: In passive mode, you must provide the host short name from the nagios configs.\n"), progname);
|
||||
die (STATE_UNKNOWN, _("%s: In passive mode, you must provide the host short name from the monitoring configs.\n"), progname);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
@ -416,11 +416,11 @@ print_help (void)
|
|||
printf (" %s\n","-i, --identity=KEYFILE");
|
||||
printf (" %s\n", _("identity of an authorized key [optional]"));
|
||||
printf (" %s\n","-O, --output=FILE");
|
||||
printf (" %s\n", _("external command file for nagios [optional]"));
|
||||
printf (" %s\n", _("external command file for monitoring [optional]"));
|
||||
printf (" %s\n","-s, --services=LIST");
|
||||
printf (" %s\n", _("list of nagios service names, separated by ':' [optional]"));
|
||||
printf (" %s\n", _("list of monitoring service names, separated by ':' [optional]"));
|
||||
printf (" %s\n","-n, --name=NAME");
|
||||
printf (" %s\n", _("short name of host in nagios configuration [optional]"));
|
||||
printf (" %s\n", _("short name of host in the monitoring configuration [optional]"));
|
||||
printf (" %s\n","-o, --ssh-option=OPTION");
|
||||
printf (" %s\n", _("Call ssh with '-o OPTION' (may be used multiple times) [optional]"));
|
||||
printf (" %s\n","-F, --configfile");
|
||||
|
@ -428,7 +428,7 @@ print_help (void)
|
|||
printf (" %s\n","-q, --quiet");
|
||||
printf (" %s\n", _("Tell ssh to suppress warning and diagnostic messages [optional]"));
|
||||
printf (UT_WARN_CRIT);
|
||||
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_VERBOSE);
|
||||
printf("\n");
|
||||
printf (" %s\n", _("The most common mode of use is to refer to a local identity file with"));
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* check_cluster.c - Host and Service Cluster Plugin for Nagios 2.x
|
||||
* check_cluster.c - Host and Service Cluster Plugin for Monitoring
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2000-2004 Ethan Galstad (nagios@nagios.org)
|
||||
* Copyright (c) 2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
const char *progname = "check_cluster";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "utils.h"
|
||||
|
@ -227,7 +227,7 @@ print_help(void)
|
|||
printf ("Copyright (c) 2000-2004 Ethan Galstad (nagios@nagios.org)\n");
|
||||
printf(COPYRIGHT, copyright, email);
|
||||
|
||||
printf(_("Host/Service Cluster Plugin for Nagios 2"));
|
||||
printf(_("Host/Service Cluster Plugin for Monitoring"));
|
||||
printf("\n\n");
|
||||
|
||||
print_usage();
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_dbi plugin
|
||||
* Monitoring check_dbi plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2011 Nagios Plugins Development Team
|
||||
* Copyright (c) 2011 Monitoring Plugins Development Team
|
||||
* Author: Sebastian 'tokkee' Harl <sh@teamix.net>
|
||||
*
|
||||
* Description:
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
const char *progname = "check_dbi";
|
||||
const char *copyright = "2011";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "utils.h"
|
||||
|
@ -215,7 +215,7 @@ main (int argc, char **argv)
|
|||
}
|
||||
|
||||
if (dbi_conn_connect (conn) < 0) {
|
||||
np_dbi_print_error (conn, "UNKOWN - failed to connect to database");
|
||||
np_dbi_print_error (conn, "UNKNOWN - failed to connect to database");
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@ main (int argc, char **argv)
|
|||
printf ("Selecting database '%s'\n", np_dbi_database);
|
||||
|
||||
if (dbi_conn_select_db (conn, np_dbi_database)) {
|
||||
np_dbi_print_error (conn, "UNKOWN - failed to select database '%s'",
|
||||
np_dbi_print_error (conn, "UNKNOWN - failed to select database '%s'",
|
||||
np_dbi_database);
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ process_arguments (int argc, char **argv)
|
|||
new = realloc (np_dbi_options,
|
||||
(np_dbi_options_num + 1) * sizeof (*new));
|
||||
if (! new) {
|
||||
printf ("UNKOWN - failed to reallocate memory\n");
|
||||
printf ("UNKNOWN - failed to reallocate memory\n");
|
||||
exit (STATE_UNKNOWN);
|
||||
}
|
||||
|
||||
|
@ -562,7 +562,7 @@ print_help (void)
|
|||
printf (" %s\n", _("(ignore the query result)"));
|
||||
printf ("\n");
|
||||
|
||||
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
|
||||
printf (UT_VERBOSE);
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_dig plugin
|
||||
* Monitoring check_dig plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2002-2008 Nagios Plugins Development Team
|
||||
* Copyright (c) 2002-2008 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -34,7 +34,7 @@
|
|||
|
||||
const char *progname = "check_dig";
|
||||
const char *copyright = "2002-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
|
@ -48,6 +48,7 @@ void print_usage (void);
|
|||
|
||||
#define UNDEFINED 0
|
||||
#define DEFAULT_PORT 53
|
||||
#define DEFAULT_TRIES 3
|
||||
|
||||
char *query_address = NULL;
|
||||
char *record_type = "A";
|
||||
|
@ -57,6 +58,7 @@ char *dig_args = "";
|
|||
char *query_transport = "";
|
||||
int verbose = FALSE;
|
||||
int server_port = DEFAULT_PORT;
|
||||
int number_tries = DEFAULT_TRIES;
|
||||
double warning_interval = UNDEFINED;
|
||||
double critical_interval = UNDEFINED;
|
||||
struct timeval tv;
|
||||
|
@ -72,6 +74,7 @@ main (int argc, char **argv)
|
|||
long microsec;
|
||||
double elapsed_time;
|
||||
int result = STATE_UNKNOWN;
|
||||
int timeout_interval_dig;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
|
@ -87,9 +90,12 @@ main (int argc, char **argv)
|
|||
if (process_arguments (argc, argv) == ERROR)
|
||||
usage_va(_("Could not parse arguments"));
|
||||
|
||||
/* dig applies the timeout to each try, so we need to work around this */
|
||||
timeout_interval_dig = timeout_interval / number_tries + number_tries;
|
||||
|
||||
/* get the command to run */
|
||||
xasprintf (&command_line, "%s @%s -p %d %s -t %s %s %s",
|
||||
PATH_TO_DIG, dns_server, server_port, query_address, record_type, dig_args, query_transport);
|
||||
xasprintf (&command_line, "%s @%s -p %d %s -t %s %s %s +tries=%d +time=%d",
|
||||
PATH_TO_DIG, dns_server, server_port, query_address, record_type, dig_args, query_transport, number_tries, timeout_interval_dig);
|
||||
|
||||
alarm (timeout_interval);
|
||||
gettimeofday (&tv, NULL);
|
||||
|
@ -348,7 +354,7 @@ print_help (void)
|
|||
printf (" %s\n","-A, --dig-arguments=STRING");
|
||||
printf (" %s\n",_("Pass STRING as argument(s) to dig"));
|
||||
printf (UT_WARN_CRIT);
|
||||
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_VERBOSE);
|
||||
|
||||
printf ("\n");
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_disk plugin
|
||||
* Monitoring check_disk plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 1999-2008 Nagios Plugins Development Team
|
||||
* Copyright (c) 1999-2008 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -29,7 +29,7 @@
|
|||
const char *progname = "check_disk";
|
||||
const char *program_name = "check_disk"; /* Required for coreutils libs */
|
||||
const char *copyright = "1999-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
|
||||
#include "common.h"
|
||||
|
@ -52,6 +52,11 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
|||
#endif
|
||||
#include "regex.h"
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# include <windows.h>
|
||||
# undef ERROR
|
||||
# define ERROR -1
|
||||
#endif
|
||||
|
||||
/* If nonzero, show inode information. */
|
||||
static int inode_format = 1;
|
||||
|
@ -175,6 +180,10 @@ main (int argc, char **argv)
|
|||
struct fs_usage fsp, tmpfsp;
|
||||
struct parameter_list *temp_list, *path;
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
char mountdir[32];
|
||||
#endif
|
||||
|
||||
preamble = strdup (" - free space:");
|
||||
output = strdup ("");
|
||||
details = strdup ("");
|
||||
|
@ -221,7 +230,6 @@ main (int argc, char **argv)
|
|||
|
||||
/* Process for every path in list */
|
||||
for (path = path_select_list; path; path=path->name_next) {
|
||||
|
||||
if (verbose >= 3 && path->freespace_percent->warning != NULL && path->freespace_percent->critical != NULL)
|
||||
printf("Thresholds(pct) for %s warn: %f crit %f\n",path->name, path->freespace_percent->warning->end,
|
||||
path->freespace_percent->critical->end);
|
||||
|
@ -234,6 +242,13 @@ main (int argc, char **argv)
|
|||
|
||||
me = path->best_match;
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
if (strncmp(path->name, "/cygdrive/", 10) != 0 || strlen(path->name) > 11)
|
||||
continue;
|
||||
snprintf(mountdir, sizeof(mountdir), "%s:\\", me->me_mountdir + 10);
|
||||
if (GetDriveType(mountdir) != DRIVE_FIXED)
|
||||
me->me_remote = 1;
|
||||
#endif
|
||||
/* Filters */
|
||||
|
||||
/* Remove filesystems already seen */
|
||||
|
@ -877,7 +892,7 @@ print_help (void)
|
|||
printf (" %s\n", "-K, --icritical=PERCENT%");
|
||||
printf (" %s\n", _("Exit with CRITICAL status if less than PERCENT of inode space is free"));
|
||||
printf (" %s\n", "-p, --path=PATH, --partition=PARTITION");
|
||||
printf (" %s\n", _("Path or partition (may be repeated)"));
|
||||
printf (" %s\n", _("Mount point or block device as emitted by the mount(8) command (may be repeated)"));
|
||||
printf (" %s\n", "-x, --exclude_device=PATH <STRING>");
|
||||
printf (" %s\n", _("Ignore device (only works if -p unspecified)"));
|
||||
printf (" %s\n", "-C, --clear");
|
||||
|
@ -911,7 +926,7 @@ print_help (void)
|
|||
printf (" %s\n", _("Regular expression to ignore selected path/partition (case insensitive) (may be repeated)"));
|
||||
printf (" %s\n", "-i, --ignore-ereg-path=PATH, --ignore-ereg-partition=PARTITION");
|
||||
printf (" %s\n", _("Regular expression to ignore selected path or partition (may be repeated)"));
|
||||
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_PLUG_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (" %s\n", "-u, --units=STRING");
|
||||
printf (" %s\n", _("Choose bytes, kB, MB, GB, TB (default: MB)"));
|
||||
printf (UT_VERBOSE);
|
||||
|
@ -970,6 +985,10 @@ get_stats (struct parameter_list *p, struct fs_usage *fsp) {
|
|||
} else {
|
||||
/* find all group members */
|
||||
for (p_list = path_select_list; p_list; p_list=p_list->name_next) {
|
||||
#ifdef __CYGWIN__
|
||||
if (strncmp(p_list->name, "/cygdrive/", 10) != 0)
|
||||
continue;
|
||||
#endif
|
||||
if (p_list->group && ! (strcmp(p_list->group, p->group))) {
|
||||
stat_path(p_list);
|
||||
get_fs_usage (p_list->best_match->me_mountdir, p_list->best_match->me_devname, &tmpfsp);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_dns plugin
|
||||
* Monitoring check_dns plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2000-2008 Nagios Plugins Development Team
|
||||
* Copyright (c) 2000-2008 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
const char *progname = "check_dns";
|
||||
const char *copyright = "2000-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "utils.h"
|
||||
|
@ -242,6 +242,22 @@ main (int argc, char **argv)
|
|||
}
|
||||
printf (ngettext("%.3f second response time", "%.3f seconds response time", elapsed_time), elapsed_time);
|
||||
printf (_(". %s returns %s"), query_address, address);
|
||||
if ((time_thresholds->warning != NULL) && (time_thresholds->critical != NULL)) {
|
||||
printf ("|%s\n", fperfdata ("time", elapsed_time, "s",
|
||||
TRUE, time_thresholds->warning->end,
|
||||
TRUE, time_thresholds->critical->end,
|
||||
TRUE, 0, FALSE, 0));
|
||||
} else if ((time_thresholds->warning == NULL) && (time_thresholds->critical != NULL)) {
|
||||
printf ("|%s\n", fperfdata ("time", elapsed_time, "s",
|
||||
FALSE, 0,
|
||||
TRUE, time_thresholds->critical->end,
|
||||
TRUE, 0, FALSE, 0));
|
||||
} else if ((time_thresholds->warning != NULL) && (time_thresholds->critical == NULL)) {
|
||||
printf ("|%s\n", fperfdata ("time", elapsed_time, "s",
|
||||
TRUE, time_thresholds->warning->end,
|
||||
FALSE, 0,
|
||||
TRUE, 0, FALSE, 0));
|
||||
} else
|
||||
printf ("|%s\n", fperfdata ("time", elapsed_time, "s", FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0));
|
||||
}
|
||||
else if (result == STATE_WARNING)
|
||||
|
@ -474,7 +490,7 @@ print_help (void)
|
|||
printf (" -c, --critical=seconds\n");
|
||||
printf (" %s\n", _("Return critical if elapsed time exceeds value. Default off"));
|
||||
|
||||
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
|
||||
printf (UT_SUPPORT);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_dummy plugin
|
||||
* Monitoring check_dummy plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 1999-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 1999-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
const char *progname = "check_dummy";
|
||||
const char *copyright = "1999-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "utils.h"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_fping plugin
|
||||
* Monitoring check_fping plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2000-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 2000-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
const char *progname = "check_fping";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "popen.h"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_game plugin
|
||||
* Monitoring check_game plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2002-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 2002-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
const char *progname = "check_game";
|
||||
const char *copyright = "2002-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "utils.h"
|
||||
|
@ -312,7 +312,7 @@ print_help (void)
|
|||
printf (" %s\n", "-pf");
|
||||
printf (" %s\n", _("Field number in raw qstat output that contains ping time"));
|
||||
|
||||
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
|
||||
printf ("\n");
|
||||
printf ("%s\n", _("Notes:"));
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_hpjd plugin
|
||||
* Monitoring check_hpjd plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2000-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 2000-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
const char *progname = "check_hpjd";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "popen.h"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_http plugin
|
||||
* Monitoring check_http plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 1999-2013 Nagios Plugins Development Team
|
||||
* Copyright (c) 1999-2013 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -35,7 +35,7 @@
|
|||
|
||||
const char *progname = "check_http";
|
||||
const char *copyright = "1999-2013";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
|
@ -57,7 +57,7 @@ enum {
|
|||
|
||||
#ifdef HAVE_SSL
|
||||
int check_cert = FALSE;
|
||||
int ssl_version;
|
||||
int ssl_version = 0;
|
||||
int days_till_exp_warn, days_till_exp_crit;
|
||||
char *randbuff;
|
||||
X509 *server_cert;
|
||||
|
@ -157,7 +157,7 @@ main (int argc, char **argv)
|
|||
/* Set default URL. Must be malloced for subsequent realloc if --onredirect=follow */
|
||||
server_url = strdup(HTTP_URL);
|
||||
server_url_length = strlen(server_url);
|
||||
xasprintf (&user_agent, "User-Agent: check_http/v%s (nagios-plugins %s)",
|
||||
xasprintf (&user_agent, "User-Agent: check_http/v%s (monitoring-plugins %s)",
|
||||
NP_VERSION, VERSION);
|
||||
|
||||
/* Parse extra opts if any */
|
||||
|
@ -257,7 +257,7 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:d:e:p:s:R:r:u:f:C:J:K:nlLS::m:M:N:E", longopts, &option);
|
||||
c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:b:d:e:p:s:R:r:u:f:C:J:K:nlLS::m:M:NE", longopts, &option);
|
||||
if (c == -1 || c == EOF)
|
||||
break;
|
||||
|
||||
|
@ -339,10 +339,10 @@ process_arguments (int argc, char **argv)
|
|||
case 'S': /* use SSL */
|
||||
#ifdef HAVE_SSL
|
||||
enable_ssl:
|
||||
/* ssl_version initialized to 0 as a default. Only set if it's non-zero. This helps when we include multiple
|
||||
parameters, like -S and -C combinations */
|
||||
use_ssl = TRUE;
|
||||
if (optarg == NULL || c != 'S')
|
||||
ssl_version = 0;
|
||||
else {
|
||||
if (c=='S' && optarg != NULL) {
|
||||
ssl_version = atoi(optarg);
|
||||
if (ssl_version < 1 || ssl_version > 3)
|
||||
usage4 (_("Invalid option - Valid values for SSL Version are 1 (TLSv1), 2 (SSLv2) or 3 (SSLv3)"));
|
||||
|
@ -1243,6 +1243,7 @@ redir (char *pos, char *status_line)
|
|||
if (addr == NULL)
|
||||
die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate addr\n"));
|
||||
|
||||
memset(addr, 0, MAX_IPV4_HOSTLENGTH);
|
||||
url = malloc (strcspn (pos, "\r\n"));
|
||||
if (url == NULL)
|
||||
die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate URL\n"));
|
||||
|
@ -1333,8 +1334,8 @@ redir (char *pos, char *status_line)
|
|||
max_depth, type, addr, i, url, (display_html ? "</A>" : ""));
|
||||
|
||||
if (server_port==i &&
|
||||
!strcmp(server_address, addr) &&
|
||||
(host_name && !strcmp(host_name, addr)) &&
|
||||
!strncmp(server_address, addr, MAX_IPV4_HOSTLENGTH) &&
|
||||
(host_name && !strncmp(host_name, addr, MAX_IPV4_HOSTLENGTH)) &&
|
||||
!strcmp(server_url, url))
|
||||
die (STATE_WARNING,
|
||||
_("HTTP WARNING - redirection creates an infinite loop - %s://%s:%d%s%s\n"),
|
||||
|
@ -1343,11 +1344,11 @@ redir (char *pos, char *status_line)
|
|||
strcpy (server_type, type);
|
||||
|
||||
free (host_name);
|
||||
host_name = strdup (addr);
|
||||
host_name = strndup (addr, MAX_IPV4_HOSTLENGTH);
|
||||
|
||||
if (!(followsticky & STICKY_HOST)) {
|
||||
free (server_address);
|
||||
server_address = strdup (addr);
|
||||
server_address = strndup (addr, MAX_IPV4_HOSTLENGTH);
|
||||
}
|
||||
if (!(followsticky & STICKY_PORT)) {
|
||||
server_port = i;
|
||||
|
@ -1366,6 +1367,7 @@ redir (char *pos, char *status_line)
|
|||
printf (_("Redirection to %s://%s:%d%s\n"), server_type,
|
||||
host_name ? host_name : server_address, server_port, server_url);
|
||||
|
||||
free(addr);
|
||||
check_http ();
|
||||
}
|
||||
|
||||
|
@ -1534,7 +1536,7 @@ print_help (void)
|
|||
|
||||
printf (UT_WARN_CRIT);
|
||||
|
||||
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
|
||||
printf (UT_VERBOSE);
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_ide_smart plugin
|
||||
* Monitoring check_ide_smart plugin
|
||||
* ide-smart 1.3 - IDE S.M.A.R.T. checking tool
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (C) 1998-1999 Ragnar Hojland Espinosa <ragnar@lightside.dhis.org>
|
||||
* 1998 Gadi Oxman <gadio@netvision.net.il>
|
||||
* Copyright (c) 2000 Robert Dale <rdale@digital-mission.com>
|
||||
* Copyright (c) 2000-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 2000-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -35,7 +35,7 @@
|
|||
|
||||
const char *progname = "check_ide_smart";
|
||||
const char *copyright = "1998-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "utils.h"
|
||||
|
@ -172,12 +172,12 @@ void print_value (value_t *, threshold_t *);
|
|||
void print_values (values_t *, thresholds_t *);
|
||||
int smart_cmd_simple (int, enum SmartCommand, __u8, char);
|
||||
int smart_read_thresholds (int, thresholds_t *);
|
||||
int verbose = FALSE;
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
char *device = NULL;
|
||||
int command = -1;
|
||||
int o, longindex;
|
||||
int retval = 0;
|
||||
|
||||
|
@ -191,7 +191,7 @@ main (int argc, char *argv[])
|
|||
{"quiet-check", no_argument, 0, 'q'},
|
||||
{"auto-on", no_argument, 0, '1'},
|
||||
{"auto-off", no_argument, 0, '0'},
|
||||
{"nagios", no_argument, 0, 'n'},
|
||||
{"nagios", no_argument, 0, 'n'}, /* DEPRECATED, but we still accept it */
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{0, 0, 0, 0}
|
||||
|
@ -206,7 +206,7 @@ main (int argc, char *argv[])
|
|||
|
||||
while (1) {
|
||||
|
||||
o = getopt_long (argc, argv, "+d:iq10nhV", longopts, &longindex);
|
||||
o = getopt_long (argc, argv, "+d:iq10nhVv", longopts, &longindex);
|
||||
|
||||
if (o == -1 || o == EOF || o == 1)
|
||||
break;
|
||||
|
@ -216,19 +216,21 @@ main (int argc, char *argv[])
|
|||
device = optarg;
|
||||
break;
|
||||
case 'q':
|
||||
command = 3;
|
||||
fprintf (stderr, "%s\n", _("DEPRECATION WARNING: the -q switch (quiet output) is no longer \"quiet\"."));
|
||||
fprintf (stderr, "%s\n", _("Nagios-compatible output is now always returned."));
|
||||
break;
|
||||
case 'i':
|
||||
command = 2;
|
||||
break;
|
||||
case '1':
|
||||
command = 1;
|
||||
break;
|
||||
case '0':
|
||||
command = 0;
|
||||
printf ("%s\n", _("SMART commands are broken and have been disabled (See Notes in --help)."));
|
||||
return STATE_CRITICAL;
|
||||
break;
|
||||
case 'n':
|
||||
command = 4;
|
||||
fprintf (stderr, "%s\n", _("DEPRECATION WARNING: the -n switch (Nagios-compatible output) is now the"));
|
||||
fprintf (stderr, "%s\n", _("default and will be removed from future releases."));
|
||||
break;
|
||||
case 'v': /* verbose */
|
||||
verbose = TRUE;
|
||||
break;
|
||||
case 'h':
|
||||
print_help ();
|
||||
|
@ -257,37 +259,16 @@ main (int argc, char *argv[])
|
|||
return STATE_CRITICAL;
|
||||
}
|
||||
|
||||
if (smart_cmd_simple (fd, SMART_CMD_ENABLE, 0, TRUE)) {
|
||||
if (smart_cmd_simple (fd, SMART_CMD_ENABLE, 0, FALSE)) {
|
||||
printf (_("CRITICAL - SMART_CMD_ENABLE\n"));
|
||||
return STATE_CRITICAL;
|
||||
}
|
||||
|
||||
switch (command) {
|
||||
case 0:
|
||||
retval = smart_cmd_simple (fd, SMART_CMD_AUTO_OFFLINE, 0, TRUE);
|
||||
break;
|
||||
case 1:
|
||||
retval = smart_cmd_simple (fd, SMART_CMD_AUTO_OFFLINE, 0xF8, TRUE);
|
||||
break;
|
||||
case 2:
|
||||
retval = smart_cmd_simple (fd, SMART_CMD_IMMEDIATE_OFFLINE, 0, TRUE);
|
||||
break;
|
||||
case 3:
|
||||
smart_read_values (fd, &values);
|
||||
smart_read_thresholds (fd, &thresholds);
|
||||
retval = values_not_passed (&values, &thresholds);
|
||||
break;
|
||||
case 4:
|
||||
smart_read_values (fd, &values);
|
||||
smart_read_thresholds (fd, &thresholds);
|
||||
retval = nagios (&values, &thresholds);
|
||||
break;
|
||||
default:
|
||||
smart_read_values (fd, &values);
|
||||
smart_read_thresholds (fd, &thresholds);
|
||||
print_values (&values, &thresholds);
|
||||
break;
|
||||
}
|
||||
if (verbose) print_values (&values, &thresholds);
|
||||
|
||||
close (fd);
|
||||
return retval;
|
||||
}
|
||||
|
@ -368,7 +349,7 @@ values_not_passed (values_t * p, thresholds_t * t)
|
|||
int i;
|
||||
for (i = 0; i < NR_ATTRIBUTES; i++) {
|
||||
if (value->id && threshold->id && value->id == threshold->id) {
|
||||
if (value->value <= threshold->threshold) {
|
||||
if (value->value < threshold->threshold) {
|
||||
++failed;
|
||||
}
|
||||
else {
|
||||
|
@ -397,7 +378,7 @@ nagios (values_t * p, thresholds_t * t)
|
|||
int i;
|
||||
for (i = 0; i < NR_ATTRIBUTES; i++) {
|
||||
if (value->id && threshold->id && value->id == threshold->id) {
|
||||
if (value->value <= threshold->threshold) {
|
||||
if (value->value < threshold->threshold) {
|
||||
++failed;
|
||||
if (value->status & 1) {
|
||||
status = PREFAILURE;
|
||||
|
@ -438,7 +419,7 @@ nagios (values_t * p, thresholds_t * t)
|
|||
status=STATE_OK;
|
||||
break;
|
||||
default:
|
||||
printf (_("ERROR - Status '%d' unkown. %d/%d tests passed\n"), status,
|
||||
printf (_("ERROR - Status '%d' unknown. %d/%d tests passed\n"), status,
|
||||
passed, total);
|
||||
status = STATE_UNKNOWN;
|
||||
break;
|
||||
|
@ -454,7 +435,7 @@ print_value (value_t * p, threshold_t * t)
|
|||
printf ("Id=%3d, Status=%2d {%s , %s}, Value=%3d, Threshold=%3d, %s\n",
|
||||
p->id, p->status, p->status & 1 ? "PreFailure" : "Advisory ",
|
||||
p->status & 2 ? "OnLine " : "OffLine", p->value, t->threshold,
|
||||
p->value > t->threshold ? "Passed" : "Failed");
|
||||
p->value >= t->threshold ? "Passed" : "Failed");
|
||||
}
|
||||
|
||||
|
||||
|
@ -495,7 +476,7 @@ print_values (values_t * p, thresholds_t * t)
|
|||
int
|
||||
smart_cmd_simple (int fd, enum SmartCommand command, __u8 val0, char show_error)
|
||||
{
|
||||
int e = 0;
|
||||
int e = STATE_UNKNOWN;
|
||||
#ifdef __linux__
|
||||
__u8 args[4];
|
||||
args[0] = WIN_SMART;
|
||||
|
@ -503,11 +484,15 @@ smart_cmd_simple (int fd, enum SmartCommand command, __u8 val0, char show_error)
|
|||
args[2] = smart_command[command].value;
|
||||
args[3] = 0;
|
||||
if (ioctl (fd, HDIO_DRIVE_CMD, &args)) {
|
||||
e = errno;
|
||||
if (show_error) {
|
||||
e = STATE_CRITICAL;
|
||||
if (show_error)
|
||||
printf (_("CRITICAL - %s: %s\n"), smart_command[command].text, strerror (errno));
|
||||
} else {
|
||||
e = STATE_OK;
|
||||
if (show_error)
|
||||
printf (_("OK - Command sent (%s)\n"), smart_command[command].text);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* __linux__ */
|
||||
#ifdef __NetBSD__
|
||||
struct atareq req;
|
||||
|
@ -528,10 +513,15 @@ smart_cmd_simple (int fd, enum SmartCommand command, __u8 val0, char show_error)
|
|||
}
|
||||
|
||||
if (errno != 0) {
|
||||
e = errno;
|
||||
e = STATE_CRITICAL;
|
||||
if (show_error)
|
||||
printf (_("CRITICAL - %s: %s\n"), smart_command[command].text, strerror (errno));
|
||||
return e;
|
||||
} else {
|
||||
e = STATE_OK;
|
||||
if (show_error)
|
||||
printf (_("OK - Command sent (%s)\n"), smart_command[command].text);
|
||||
}
|
||||
|
||||
#endif /* __NetBSD__ */
|
||||
return e;
|
||||
}
|
||||
|
@ -592,8 +582,8 @@ print_help (void)
|
|||
{
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Nagios feature - 1999 Robert Dale <rdale@digital-mission.com>\n");
|
||||
printf ("(C) 1999 Ragnar Hojland Espinosa <ragnar@lightside.dhis.org>\n");
|
||||
printf ("Plugin implementation - 1999 Robert Dale <rdale@digital-mission.com>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
||||
printf (_("This plugin checks a local hard drive with the (Linux specific) SMART interface [http://smartlinux.sourceforge.net/smart/index.php]."));
|
||||
|
@ -607,17 +597,19 @@ print_help (void)
|
|||
|
||||
printf (" %s\n", "-d, --device=DEVICE");
|
||||
printf (" %s\n", _("Select device DEVICE"));
|
||||
printf (" %s\n", _("Note: if the device is selected with this option, _no_ other options are accepted"));
|
||||
printf (" %s\n", "-i, --immediate");
|
||||
printf (" %s\n", _("Perform immediately offline tests"));
|
||||
printf (" %s\n", "-q, --quiet-check");
|
||||
printf (" %s\n", _("Returns the number of failed tests"));
|
||||
printf (" %s\n", "-1, --auto-on");
|
||||
printf (" %s\n", _("Turn on automatic offline tests"));
|
||||
printf (" %s\n", "-0, --auto-off");
|
||||
printf (" %s\n", _("Turn off automatic offline tests"));
|
||||
printf (" %s\n", "-n, --nagios");
|
||||
printf (" %s\n", _("Output suitable for Nagios"));
|
||||
printf (" %s\n", _("Note: if the device is specified without this option, any further option will"));
|
||||
printf (" %s\n", _("be ignored."));
|
||||
|
||||
printf (UT_VERBOSE);
|
||||
|
||||
printf ("\n");
|
||||
printf ("%s\n", _("Notes:"));
|
||||
printf (" %s\n", _("The SMART command modes (-i/--immediate, -0/--auto-off and -1/--auto-on) were"));
|
||||
printf (" %s\n", _("broken in an underhand manner and have been disabled. You can use smartctl"));
|
||||
printf (" %s\n", _("instead:"));
|
||||
printf (" %s\n", _("-0/--auto-off: use \"smartctl --offlineauto=off\""));
|
||||
printf (" %s\n", _("-1/--auto-on: use \"smartctl --offlineauto=on\""));
|
||||
printf (" %s\n", _("-i/--immediate: use \"smartctl --test=offline\""));
|
||||
|
||||
printf (UT_SUPPORT);
|
||||
}
|
||||
|
@ -638,6 +630,5 @@ void
|
|||
print_usage (void)
|
||||
{
|
||||
printf ("%s\n", _("Usage:"));
|
||||
printf ("%s [-d <device>] [-i <immediate>] [-q quiet] [-1 <auto-on>]",progname);
|
||||
printf (" [-O <auto-off>] [-n <nagios>]\n");
|
||||
printf ("%s [-d <device>] [-v]", progname);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue