Imported Upstream version 2.0
This commit is contained in:
parent
c89ccc3c74
commit
0841b5c7c7
165 changed files with 25440 additions and 4442 deletions
|
@ -11,9 +11,10 @@ endif
|
|||
|
||||
AM_CFLAGS = -DNP_VERSION='"$(NP_VERSION)"'
|
||||
|
||||
VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plugins/t
|
||||
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)
|
||||
|
@ -129,11 +130,10 @@ install-exec-hook:
|
|||
cd $(DESTDIR)$(libexecdir) && \
|
||||
for i in $(check_tcp_programs) ; do rm -f $$i; ln -s check_tcp $$i ; done ;\
|
||||
if [ -x check_ldap ] ; then rm -f check_ldaps ; ln -s check_ldap check_ldaps ; fi
|
||||
|
||||
|
||||
clean-local:
|
||||
rm -f $(check_tcp_programs)
|
||||
rm -f NP-VERSION-FILE
|
||||
|
||||
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)
|
||||
|
@ -378,7 +381,7 @@ CTAGS = ctags
|
|||
am__tty_colors = \
|
||||
red=; grn=; lgn=; blu=; std=
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plugins/t
|
||||
VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plugins/t
|
||||
pkglibexecdir = @pkglibexecdir@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALLOCA = @ALLOCA@
|
||||
|
@ -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,7 +242,23 @@ 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);
|
||||
printf ("|%s\n", fperfdata ("time", elapsed_time, "s", FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0));
|
||||
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)
|
||||
printf (_("DNS WARNING - %s\n"),
|
||||
|
@ -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;
|
||||
}
|
||||
smart_read_values (fd, &values);
|
||||
smart_read_thresholds (fd, &thresholds);
|
||||
retval = nagios (&values, &thresholds);
|
||||
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;
|
||||
printf (_("CRITICAL - %s: %s\n"), smart_command[command].text, strerror (errno));
|
||||
return e;
|
||||
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 /* __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);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_ldap plugin
|
||||
* Monitoring check_ldap plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2000-2008 Nagios Plugins Development Team
|
||||
* Copyright (c) 2000-2008 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -29,7 +29,7 @@
|
|||
/* progname may be check_ldaps */
|
||||
char *progname = "check_ldap";
|
||||
const char *copyright = "2000-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
|
@ -430,7 +430,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,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_load plugin
|
||||
* Monitoring check_load 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_load";
|
||||
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_mrtg plugin
|
||||
* Monitoring check_mrtg plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 1999-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 1999-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
const char *progname = "check_mrtg";
|
||||
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"
|
||||
|
@ -356,7 +356,7 @@ print_help (void)
|
|||
printf (" %s\n", _("This plugin is useful for monitoring MRTG data that does not correspond to"));
|
||||
printf (" %s\n", _("bandwidth usage. (Use the check_mrtgtraf plugin for monitoring bandwidth)."));
|
||||
printf (" %s\n", _("It can be used to monitor any kind of data that MRTG is monitoring - errors,"));
|
||||
printf (" %s\n", _("packets/sec, etc. I use MRTG in conjuction with the Novell NLM that allows"));
|
||||
printf (" %s\n", _("packets/sec, etc. I use MRTG in conjunction with the Novell NLM that allows"));
|
||||
printf (" %s\n", _("me to track processor utilization, user connections, drive space, etc and"));
|
||||
printf (" %s\n\n", _("this plugin works well for monitoring that kind of data as well."));
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_mrtgtraf plugin
|
||||
* Monitoring check_mrtgtraf plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 1999-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 1999-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -34,7 +34,7 @@
|
|||
|
||||
const char *progname = "check_mrtgtraf";
|
||||
const char *copyright = "1999-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
int process_arguments (int, char **);
|
||||
int validate_arguments (void);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_mysql plugin
|
||||
* Monitoring check_mysql plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)
|
||||
* Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net)
|
||||
* Copyright (c) 1999-2011 Nagios Plugins Development Team
|
||||
* Copyright (c) 1999-2011 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -32,7 +32,7 @@
|
|||
|
||||
const char *progname = "check_mysql";
|
||||
const char *copyright = "1999-2011";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#define SLAVERESULTSIZE 70
|
||||
|
||||
|
@ -476,12 +476,6 @@ validate_arguments (void)
|
|||
if (db_user == NULL)
|
||||
db_user = strdup("");
|
||||
|
||||
if (opt_file == NULL)
|
||||
opt_file = strdup("");
|
||||
|
||||
if (opt_group == NULL)
|
||||
opt_group = strdup("");
|
||||
|
||||
if (db_host == NULL)
|
||||
db_host = strdup("");
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_mysql_query plugin
|
||||
* Monitoring check_mysql_query plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2006-2009 Nagios Plugins Development Team
|
||||
* Copyright (c) 2006-2009 Monitoring Plugins Development Team
|
||||
* Original code from check_mysql, copyright 1999 Didi Rieder
|
||||
*
|
||||
* Description:
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
const char *progname = "check_mysql_query";
|
||||
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"
|
||||
|
@ -46,6 +46,8 @@ char *db_host = NULL;
|
|||
char *db_socket = NULL;
|
||||
char *db_pass = NULL;
|
||||
char *db = NULL;
|
||||
char *opt_file = NULL;
|
||||
char *opt_group = NULL;
|
||||
unsigned int db_port = MYSQL_PORT;
|
||||
|
||||
int process_arguments (int, char **);
|
||||
|
@ -83,7 +85,13 @@ main (int argc, char **argv)
|
|||
/* initialize mysql */
|
||||
mysql_init (&mysql);
|
||||
|
||||
mysql_options(&mysql,MYSQL_READ_DEFAULT_GROUP,"client");
|
||||
if (opt_file != NULL)
|
||||
mysql_options(&mysql,MYSQL_READ_DEFAULT_FILE,opt_file);
|
||||
|
||||
if (opt_group != NULL)
|
||||
mysql_options(&mysql,MYSQL_READ_DEFAULT_GROUP,opt_group);
|
||||
else
|
||||
mysql_options(&mysql,MYSQL_READ_DEFAULT_GROUP,"client");
|
||||
|
||||
/* establish a connection to the server and error checking */
|
||||
if (!mysql_real_connect(&mysql,db_host,db_user,db_pass,db,db_port,db_socket,0)) {
|
||||
|
@ -152,7 +160,13 @@ main (int argc, char **argv)
|
|||
} else if (status == STATE_CRITICAL) {
|
||||
printf("QUERY %s: ", _("CRITICAL"));
|
||||
}
|
||||
printf(_("'%s' returned %f"), sql_query, value);
|
||||
printf(_("'%s' returned %f | %s"), sql_query, value,
|
||||
fperfdata("result", value, "",
|
||||
my_thresholds->warning?TRUE:FALSE, my_thresholds->warning?my_thresholds->warning->end:0,
|
||||
my_thresholds->critical?TRUE:FALSE, my_thresholds->critical?my_thresholds->critical->end:0,
|
||||
FALSE, 0,
|
||||
FALSE, 0)
|
||||
);
|
||||
printf("\n");
|
||||
|
||||
return status;
|
||||
|
@ -174,6 +188,8 @@ process_arguments (int argc, char **argv)
|
|||
{"database", required_argument, 0, 'd'},
|
||||
{"username", required_argument, 0, 'u'},
|
||||
{"password", required_argument, 0, 'p'},
|
||||
{"file", required_argument, 0, 'f'},
|
||||
{"group", required_argument, 0, 'g'},
|
||||
{"port", required_argument, 0, 'P'},
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
|
@ -188,7 +204,7 @@ process_arguments (int argc, char **argv)
|
|||
return ERROR;
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "hvVP:p:u:d:H:s:q:w:c:", longopts, &option);
|
||||
c = getopt_long (argc, argv, "hvVP:p:u:d:H:s:q:w:c:f:g:", longopts, &option);
|
||||
|
||||
if (c == -1 || c == EOF)
|
||||
break;
|
||||
|
@ -220,6 +236,12 @@ process_arguments (int argc, char **argv)
|
|||
optarg++;
|
||||
}
|
||||
break;
|
||||
case 'f': /* client options file */
|
||||
opt_file = optarg;
|
||||
break;
|
||||
case 'g': /* client options group */
|
||||
opt_group = optarg;
|
||||
break;
|
||||
case 'P': /* critical time threshold */
|
||||
db_port = atoi (optarg);
|
||||
break;
|
||||
|
@ -299,6 +321,10 @@ print_help (void)
|
|||
printf (" %s\n", _("Use the specified socket (has no effect if -H is used)"));
|
||||
printf (" -d, --database=STRING\n");
|
||||
printf (" %s\n", _("Database to check"));
|
||||
printf (" %s\n", "-f, --file=STRING");
|
||||
printf (" %s\n", _("Read from the specified client options file"));
|
||||
printf (" %s\n", "-g, --group=STRING");
|
||||
printf (" %s\n", _("Use a client options group"));
|
||||
printf (" -u, --username=STRING\n");
|
||||
printf (" %s\n", _("Username to login with"));
|
||||
printf (" -p, --password=STRING\n");
|
||||
|
@ -324,5 +350,5 @@ print_usage (void)
|
|||
{
|
||||
printf ("%s\n", _("Usage:"));
|
||||
printf (" %s -q SQL_query [-w warn] [-c crit] [-H host] [-P port] [-s socket]\n",progname);
|
||||
printf (" [-d database] [-u user] [-p password]\n");
|
||||
printf (" [-d database] [-u user] [-p password] [-f optfile] [-g group]\n");
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_nagios plugin
|
||||
* Monitoring check_nagios plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 1999-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 1999-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -34,7 +34,7 @@
|
|||
|
||||
const char *progname = "check_nagios";
|
||||
const char *copyright = "1999-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "runcmd.h"
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_nt plugin
|
||||
* Monitoring check_nt plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2000-2002 Yves Rubin (rubiyz@yahoo.com)
|
||||
* Copyright (c) 2003-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 2003-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -34,7 +34,7 @@
|
|||
|
||||
const char *progname = "check_nt";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
|
@ -203,7 +203,7 @@ int main(int argc, char **argv){
|
|||
updays = uptime / 86400;
|
||||
uphours = (uptime % 86400) / 3600;
|
||||
upminutes = ((uptime % 86400) % 3600) / 60;
|
||||
xasprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes);
|
||||
xasprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s)|uptime=%lu"), updays, uphours, upminutes, uptime);
|
||||
if (check_critical_value==TRUE && uptime <= critical_value)
|
||||
return_code=STATE_CRITICAL;
|
||||
else if (check_warning_value==TRUE && uptime <= warning_value)
|
||||
|
@ -293,10 +293,10 @@ int main(int argc, char **argv){
|
|||
|
||||
/* Divisor should be 1048567, not 3044515, as we are measuring "Commit Charge" here,
|
||||
which equals RAM + Pagefiles. */
|
||||
xasprintf(&output_message,_("Memory usage: total:%.2f Mb - used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)"),
|
||||
xasprintf(&output_message,_("Memory usage: total:%.2f MB - used: %.2f MB (%.0f%%) - free: %.2f MB (%.0f%%)"),
|
||||
mem_commitLimit / 1048567, mem_commitByte / 1048567, percent_used_space,
|
||||
(mem_commitLimit - mem_commitByte) / 1048567, (mem_commitLimit - mem_commitByte) / mem_commitLimit * 100);
|
||||
xasprintf(&perfdata,_("'Memory usage'=%.2fMb;%.2f;%.2f;0.00;%.2f"), mem_commitByte / 1048567,
|
||||
xasprintf(&perfdata,_("'Memory usage'=%.2fMB;%.2f;%.2f;0.00;%.2f"), mem_commitByte / 1048567,
|
||||
warning_used_space / 1048567, critical_used_space / 1048567, mem_commitLimit / 1048567);
|
||||
|
||||
return_code=STATE_OK;
|
||||
|
@ -750,7 +750,7 @@ void print_help(void)
|
|||
printf (" %s\n", _("The purpose of this is to be run from command line to determine what instances"));
|
||||
printf (" %s\n", _(" are available for monitoring without having to log onto the Windows server"));
|
||||
printf (" %s\n", _(" to run Perfmon directly."));
|
||||
printf (" %s\n", _("It can also be used in scripts that automatically create Nagios service"));
|
||||
printf (" %s\n", _("It can also be used in scripts that automatically create the monitoring service"));
|
||||
printf (" %s\n", _(" configuration files."));
|
||||
printf (" %s\n", _("Some examples:"));
|
||||
printf (" %s\n\n", _("check_nt -H 192.168.1.1 -p 1248 -v INSTANCES -l Process"));
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_ntp plugin
|
||||
* Monitoring check_ntp plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2006 Sean Finney <seanius@seanius.net>
|
||||
* Copyright (c) 2006-2008 Nagios Plugins Development Team
|
||||
* Copyright (c) 2006-2008 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -32,7 +32,7 @@
|
|||
|
||||
const char *progname = "check_ntp";
|
||||
const char *copyright = "2006-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
|
@ -54,7 +54,9 @@ void print_help (void);
|
|||
void print_usage (void);
|
||||
|
||||
/* number of times to perform each request to get a good average. */
|
||||
#ifndef AVG_NUM
|
||||
#define AVG_NUM 4
|
||||
#endif
|
||||
|
||||
/* max size of control message data */
|
||||
#define MAX_CM_SIZE 468
|
||||
|
@ -480,7 +482,7 @@ double offset_request(const char *host, int *status){
|
|||
} else {
|
||||
/* finally, calculate the average offset */
|
||||
for(i=0; i<servers[best_index].num_responses;i++){
|
||||
avg_offset+=servers[best_index].offset[j];
|
||||
avg_offset+=servers[best_index].offset[i];
|
||||
}
|
||||
avg_offset/=servers[best_index].num_responses;
|
||||
}
|
||||
|
@ -515,13 +517,14 @@ setup_control_request(ntp_control_message *p, uint8_t opcode, uint16_t seq){
|
|||
double jitter_request(const char *host, int *status){
|
||||
int conn=-1, i, npeers=0, num_candidates=0, syncsource_found=0;
|
||||
int run=0, min_peer_sel=PEER_INCLUDED, num_selected=0, num_valid=0;
|
||||
int peers_size=0, peer_offset=0;
|
||||
int peers_size=0, peer_offset=0, bytes_read=0;
|
||||
ntp_assoc_status_pair *peers=NULL;
|
||||
ntp_control_message req;
|
||||
const char *getvar = "jitter";
|
||||
double rval = 0.0, jitter = -1.0;
|
||||
char *startofvalue=NULL, *nptr=NULL;
|
||||
void *tmp;
|
||||
int ntp_cm_ints = sizeof(uint16_t) * 5 + sizeof(uint8_t) * 2;
|
||||
|
||||
/* Long-winded explanation:
|
||||
* Getting the jitter requires a number of steps:
|
||||
|
@ -606,7 +609,15 @@ double jitter_request(const char *host, int *status){
|
|||
|
||||
req.count = htons(MAX_CM_SIZE);
|
||||
DBG(printf("recieving READVAR response...\n"));
|
||||
read(conn, &req, SIZEOF_NTPCM(req));
|
||||
|
||||
/* cov-66524 - req.data not null terminated before usage. Also covers verifying struct was returned correctly*/
|
||||
if ((bytes_read = read(conn, &req, SIZEOF_NTPCM(req))) == -1)
|
||||
die(STATE_UNKNOWN, _("Cannot read from socket: %s"), strerror(errno));
|
||||
if (bytes_read != ntp_cm_ints + req.count)
|
||||
die(STATE_UNKNOWN, _("Invalid NTP response: %d bytes read does not equal %d plus %d data segment"), bytes_read, ntp_cm_ints, req.count);
|
||||
/* else null terminate */
|
||||
strncpy(req.data[req.count], "\0", 1);
|
||||
|
||||
DBG(print_ntp_control_message(&req));
|
||||
|
||||
if(req.op&REM_ERROR && strstr(getvar, "jitter")) {
|
||||
|
@ -858,7 +869,7 @@ void print_help(void){
|
|||
printf (" %s\n", _("Warning threshold for jitter"));
|
||||
printf (" %s\n", "-k, --jcrit=THRESHOLD");
|
||||
printf (" %s\n", _("Critical threshold for jitter"));
|
||||
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_VERBOSE);
|
||||
|
||||
printf("\n");
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_ntp_peer plugin
|
||||
* Monitoring check_ntp_peer plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2006 Sean Finney <seanius@seanius.net>
|
||||
* Copyright (c) 2006-2008 Nagios Plugins Development Team
|
||||
* Copyright (c) 2006-2008 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -37,7 +37,7 @@
|
|||
|
||||
const char *progname = "check_ntp_peer";
|
||||
const char *copyright = "2006-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
|
@ -686,7 +686,7 @@ void print_help(void){
|
|||
printf (" %s\n", _("Warning threshold for number of usable time sources (\"truechimers\")"));
|
||||
printf (" %s\n", "-n, --tcrit=THRESHOLD");
|
||||
printf (" %s\n", _("Critical threshold for number of usable time sources (\"truechimers\")"));
|
||||
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_VERBOSE);
|
||||
|
||||
printf("\n");
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_ntp_time plugin
|
||||
* Monitoring check_ntp_time plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2006 Sean Finney <seanius@seanius.net>
|
||||
* Copyright (c) 2006-2008 Nagios Plugins Development Team
|
||||
* Copyright (c) 2006-2008 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
const char *progname = "check_ntp_time";
|
||||
const char *copyright = "2006-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
|
@ -55,7 +55,9 @@ void print_help (void);
|
|||
void print_usage (void);
|
||||
|
||||
/* number of times to perform each request to get a good average. */
|
||||
#ifndef AVG_NUM
|
||||
#define AVG_NUM 4
|
||||
#endif
|
||||
|
||||
/* max size of control message data */
|
||||
#define MAX_CM_SIZE 468
|
||||
|
@ -426,7 +428,7 @@ double offset_request(const char *host, int *status){
|
|||
} else {
|
||||
/* finally, calculate the average offset */
|
||||
for(i=0; i<servers[best_index].num_responses;i++){
|
||||
avg_offset+=servers[best_index].offset[j];
|
||||
avg_offset+=servers[best_index].offset[i];
|
||||
}
|
||||
avg_offset/=servers[best_index].num_responses;
|
||||
}
|
||||
|
@ -614,7 +616,7 @@ void print_help(void){
|
|||
printf (" %s\n", _("Offset to result in warning status (seconds)"));
|
||||
printf (" %s\n", "-c, --critical=THRESHOLD");
|
||||
printf (" %s\n", _("Offset to result in critical status (seconds)"));
|
||||
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_VERBOSE);
|
||||
|
||||
printf("\n");
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_nwstat plugin
|
||||
* Monitoring check_nwstat 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_nwstat";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
|
@ -1664,7 +1664,7 @@ void print_help(void)
|
|||
printf (" %s\n", "-o, --osversion");
|
||||
printf (" %s\n", _("Include server version string in results"));
|
||||
|
||||
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_overcr plugin
|
||||
* Monitoring check_overcr 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_overcr";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
|
@ -442,7 +442,7 @@ print_help (void)
|
|||
printf (" %s\n", _("NET<port> = number of active connections on TCP port <port>"));
|
||||
printf (" %s\n", _("UPTIME = system uptime in seconds"));
|
||||
|
||||
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
|
||||
printf (UT_VERBOSE);
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_pgsql plugin
|
||||
* Monitoring check_pgsql plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 1999-2011 Nagios Plugins Development Team
|
||||
* Copyright (c) 1999-2011 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
const char *progname = "check_pgsql";
|
||||
const char *copyright = "1999-2011";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "utils.h"
|
||||
|
@ -514,7 +514,7 @@ print_help (void)
|
|||
|
||||
printf (" %s\n", "-d, --database=STRING");
|
||||
printf (" %s", _("Database to check "));
|
||||
printf (_("(default: %s)"), DEFAULT_DB);
|
||||
printf (_("(default: %s)\n"), DEFAULT_DB);
|
||||
printf (" %s\n", "-l, --logname = STRING");
|
||||
printf (" %s\n", _("Login name of user"));
|
||||
printf (" %s\n", "-p, --password = STRING");
|
||||
|
@ -524,7 +524,7 @@ print_help (void)
|
|||
|
||||
printf (UT_WARN_CRIT);
|
||||
|
||||
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
|
||||
printf (" %s\n", "-q, --query=STRING");
|
||||
printf (" %s\n", _("SQL query to run. Only first column in first row will be read"));
|
||||
|
@ -563,7 +563,7 @@ print_help (void)
|
|||
printf (" %s\n", _("connect to a remote host, be sure that the remote postmaster accepts TCP/IP"));
|
||||
printf (" %s\n\n", _("connections (start the postmaster with the -i option)."));
|
||||
|
||||
printf (" %s\n", _("Typically, the nagios user (unless the --logname option is used) should be"));
|
||||
printf (" %s\n", _("Typically, the monitoring user (unless the --logname option is used) should be"));
|
||||
printf (" %s\n", _("able to connect to the database without a password. The plugin can also send"));
|
||||
printf (" %s\n", _("a password, but no effort is made to obsure or encrypt the password."));
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_ping plugin
|
||||
* Monitoring check_ping plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2000-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 2000-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
const char *progname = "check_ping";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
|
@ -458,7 +458,8 @@ run_ping (const char *cmd, const char *addr)
|
|||
(sscanf(buf,"%*d packets transmitted, %*d received, %d%% loss, time%n",&pl,&match) && match) ||
|
||||
(sscanf(buf,"%*d packets transmitted, %*d received, %d%% packet loss, time%n",&pl,&match) && match) ||
|
||||
(sscanf(buf,"%*d packets transmitted, %*d received, +%*d errors, %d%% packet loss%n",&pl,&match) && match) ||
|
||||
(sscanf(buf,"%*d packets transmitted %*d received, +%*d errors, %d%% packet loss%n",&pl,&match) && match)
|
||||
(sscanf(buf,"%*d packets transmitted %*d received, +%*d errors, %d%% packet loss%n",&pl,&match) && match) ||
|
||||
(sscanf(buf,"%*[^(](%d%% %*[^)])%n",&pl,&match) && match)
|
||||
)
|
||||
continue;
|
||||
|
||||
|
@ -471,7 +472,9 @@ run_ping (const char *cmd, const char *addr)
|
|||
(sscanf(buf,"round-trip min/avg/max/std-dev = %*f/%f/%*f/%*f%n",&rta,&match) && match) ||
|
||||
(sscanf(buf,"round-trip (ms) min/avg/max = %*f/%f/%*f%n",&rta,&match) && match) ||
|
||||
(sscanf(buf,"round-trip (ms) min/avg/max/stddev = %*f/%f/%*f/%*f%n",&rta,&match) && match) ||
|
||||
(sscanf(buf,"rtt min/avg/max/mdev = %*f/%f/%*f/%*f ms%n",&rta,&match) && match))
|
||||
(sscanf(buf,"rtt min/avg/max/mdev = %*f/%f/%*f/%*f ms%n",&rta,&match) && match) ||
|
||||
(sscanf(buf, "%*[^=] = %*fms, %*[^=] = %*fms, %*[^=] = %fms%n", &rta, &match) && match)
|
||||
)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -482,7 +485,11 @@ run_ping (const char *cmd, const char *addr)
|
|||
/* check stderr, setting at least WARNING if there is output here */
|
||||
/* Add warning into warn_text */
|
||||
while (fgets (buf, MAX_INPUT_BUFFER - 1, child_stderr)) {
|
||||
if (! strstr(buf,"WARNING - no SO_TIMESTAMP support, falling back to SIOCGSTAMP")) {
|
||||
if (
|
||||
! strstr(buf,"WARNING - no SO_TIMESTAMP support, falling back to SIOCGSTAMP")
|
||||
&& ! strstr(buf,"Warning: time of day goes back")
|
||||
|
||||
) {
|
||||
if (verbose >= 3) {
|
||||
printf("Got stderr: %s", buf);
|
||||
}
|
||||
|
@ -581,7 +588,7 @@ print_help (void)
|
|||
printf (" %s\n", "-L, --link");
|
||||
printf (" %s\n", _("show HTML in the plugin output (obsoleted by urlize)"));
|
||||
|
||||
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
|
||||
printf ("\n");
|
||||
printf ("%s\n", _("THRESHOLD is <rta>,<pl>% where <rta> is the round trip average travel"));
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_procs plugin
|
||||
* Monitoring check_procs plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2000-2008 Nagios Plugins Development Team
|
||||
* Copyright (c) 2000-2008 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -34,7 +34,7 @@
|
|||
const char *progname = "check_procs";
|
||||
const char *program_name = "check_procs"; /* Required for coreutils libs */
|
||||
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"
|
||||
|
@ -123,6 +123,7 @@ main (int argc, char **argv)
|
|||
char *procprog;
|
||||
|
||||
pid_t mypid = 0;
|
||||
pid_t myppid = 0;
|
||||
struct stat statbuf;
|
||||
dev_t mydev = 0;
|
||||
ino_t myino = 0;
|
||||
|
@ -172,6 +173,7 @@ main (int argc, char **argv)
|
|||
|
||||
/* find ourself */
|
||||
mypid = getpid();
|
||||
myppid = getppid();
|
||||
if (usepid || stat_exe(mypid, &statbuf) == -1) {
|
||||
/* usepid might have been set by -T */
|
||||
usepid = 1;
|
||||
|
@ -241,6 +243,12 @@ main (int argc, char **argv)
|
|||
printf("not considering - is myself or gone\n");
|
||||
continue;
|
||||
}
|
||||
/* Ignore parent*/
|
||||
else if (myppid == procpid) {
|
||||
if (verbose >= 3)
|
||||
printf("not considering - is parent\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
/* filter kernel threads (childs of KTHREAD_PARENT)*/
|
||||
/* TODO adapt for other OSes than GNU/Linux
|
||||
|
@ -707,7 +715,7 @@ print_help (void)
|
|||
#if defined( __linux__ )
|
||||
printf (" %s\n", _("ELAPSED - time elapsed in seconds"));
|
||||
#endif /* defined(__linux__) */
|
||||
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_PLUG_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
|
||||
printf (" %s\n", "-v, --verbose");
|
||||
printf (" %s\n", _("Extra information. Up to 3 verbosity levels"));
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_radius plugin
|
||||
* Monitoring check_radius plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 1999-2008 Nagios Plugins Development Team
|
||||
* Copyright (c) 1999-2008 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -30,15 +30,16 @@
|
|||
|
||||
const char *progname = "check_radius";
|
||||
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"
|
||||
#include "netutils.h"
|
||||
|
||||
#ifdef HAVE_LIBRADIUSCLIENT_NG
|
||||
#if defined(HAVE_LIBFREERADIUS_CLIENT)
|
||||
#include <freeradius-client.h>
|
||||
#elif defined(HAVE_LIBRADIUSCLIENT_NG)
|
||||
#include <radiusclient-ng.h>
|
||||
rc_handle *rch = NULL;
|
||||
#else
|
||||
#include <radiusclient.h>
|
||||
#endif
|
||||
|
@ -47,11 +48,14 @@ int process_arguments (int, char **);
|
|||
void print_help (void);
|
||||
void print_usage (void);
|
||||
|
||||
/* libradiusclient(-ng) wrapper functions */
|
||||
#ifdef HAVE_LIBRADIUSCLIENT_NG
|
||||
#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG)
|
||||
#define my_rc_conf_str(a) rc_conf_str(rch,a)
|
||||
#define my_rc_send_server(a,b) rc_send_server(rch,a,b)
|
||||
#ifdef HAVE_LIBFREERADIUS_CLIENT
|
||||
#define my_rc_buildreq(a,b,c,d,e,f) rc_buildreq(rch,a,b,c,d,(a)->secret,e,f)
|
||||
#else
|
||||
#define my_rc_buildreq(a,b,c,d,e,f) rc_buildreq(rch,a,b,c,d,e,f)
|
||||
#endif
|
||||
#define my_rc_own_ipaddress() rc_own_ipaddress(rch)
|
||||
#define my_rc_avpair_add(a,b,c,d) rc_avpair_add(rch,a,b,c,-1,d)
|
||||
#define my_rc_read_dictionary(a) rc_read_dictionary(rch, a)
|
||||
|
@ -72,6 +76,10 @@ void print_usage (void);
|
|||
|
||||
int my_rc_read_config(char *);
|
||||
|
||||
#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG)
|
||||
rc_handle *rch = NULL;
|
||||
#endif
|
||||
|
||||
char *server = NULL;
|
||||
char *username = NULL;
|
||||
char *password = NULL;
|
||||
|
@ -142,11 +150,10 @@ Please note that all tags must be lowercase to use the DocBook XML DTD.
|
|||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
UINT4 service;
|
||||
char msg[BUFFER_LEN];
|
||||
SEND_DATA data;
|
||||
int result = STATE_UNKNOWN;
|
||||
UINT4 client_id;
|
||||
uint32_t client_id, service;
|
||||
char *str;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
|
@ -162,7 +169,7 @@ main (int argc, char **argv)
|
|||
str = strdup ("dictionary");
|
||||
if ((config_file && my_rc_read_config (config_file)) ||
|
||||
my_rc_read_dictionary (my_rc_conf_str (str)))
|
||||
die (STATE_UNKNOWN, _("Config file error"));
|
||||
die (STATE_UNKNOWN, _("Config file error\n"));
|
||||
|
||||
service = PW_AUTHENTICATE_ONLY;
|
||||
|
||||
|
@ -171,24 +178,24 @@ main (int argc, char **argv)
|
|||
my_rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) &&
|
||||
my_rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0)
|
||||
))
|
||||
die (STATE_UNKNOWN, _("Out of Memory?"));
|
||||
die (STATE_UNKNOWN, _("Out of Memory?\n"));
|
||||
|
||||
if (nasid != NULL) {
|
||||
if (!(my_rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0)))
|
||||
die (STATE_UNKNOWN, _("Invalid NAS-Identifier"));
|
||||
die (STATE_UNKNOWN, _("Invalid NAS-Identifier\n"));
|
||||
}
|
||||
|
||||
if (nasipaddress != NULL) {
|
||||
if (rc_good_ipaddr (nasipaddress))
|
||||
die (STATE_UNKNOWN, _("Invalid NAS-IP-Address"));
|
||||
die (STATE_UNKNOWN, _("Invalid NAS-IP-Address\n"));
|
||||
if ((client_id = rc_get_ipaddr(nasipaddress)) == 0)
|
||||
die (STATE_UNKNOWN, _("Invalid NAS-IP-Address"));
|
||||
die (STATE_UNKNOWN, _("Invalid NAS-IP-Address\n"));
|
||||
} else {
|
||||
if ((client_id = my_rc_own_ipaddress ()) == 0)
|
||||
die (STATE_UNKNOWN, _("Can't find local IP for NAS-IP-Address"));
|
||||
die (STATE_UNKNOWN, _("Can't find local IP for NAS-IP-Address\n"));
|
||||
}
|
||||
if (my_rc_avpair_add (&(data.send_pairs), PW_NAS_IP_ADDRESS, &client_id, 0) == NULL)
|
||||
die (STATE_UNKNOWN, _("Invalid NAS-IP-Address"));
|
||||
die (STATE_UNKNOWN, _("Invalid NAS-IP-Address\n"));
|
||||
|
||||
my_rc_buildreq (&data, PW_ACCESS_REQUEST, server, port, (int)timeout_interval,
|
||||
retries);
|
||||
|
@ -199,19 +206,19 @@ main (int argc, char **argv)
|
|||
rc_avpair_free (data.receive_pairs);
|
||||
|
||||
if (result == TIMEOUT_RC)
|
||||
die (STATE_CRITICAL, _("Timeout"));
|
||||
die (STATE_CRITICAL, _("Timeout\n"));
|
||||
if (result == ERROR_RC)
|
||||
die (STATE_CRITICAL, _("Auth Error"));
|
||||
die (STATE_CRITICAL, _("Auth Error\n"));
|
||||
if (result == REJECT_RC)
|
||||
die (STATE_WARNING, _("Auth Failed"));
|
||||
die (STATE_WARNING, _("Auth Failed\n"));
|
||||
if (result == BADRESP_RC)
|
||||
die (STATE_WARNING, _("Bad Response"));
|
||||
die (STATE_WARNING, _("Bad Response\n"));
|
||||
if (expect && !strstr (msg, expect))
|
||||
die (STATE_WARNING, "%s", msg);
|
||||
die (STATE_WARNING, "%s\n", msg);
|
||||
if (result == OK_RC)
|
||||
die (STATE_OK, _("Auth OK"));
|
||||
die (STATE_OK, _("Auth OK\n"));
|
||||
(void)snprintf(msg, sizeof(msg), _("Unexpected result code %d"), result);
|
||||
die (STATE_UNKNOWN, "%s", msg);
|
||||
die (STATE_UNKNOWN, "%s\n", msg);
|
||||
}
|
||||
|
||||
|
||||
|
@ -361,7 +368,7 @@ print_help (void)
|
|||
printf (" %s\n", "-r, --retries=INTEGER");
|
||||
printf (" %s\n", _("Number of times to retry a failed connection"));
|
||||
|
||||
printf (UT_TIMEOUT, timeout_interval);
|
||||
printf (UT_CONN_TIMEOUT, timeout_interval);
|
||||
|
||||
printf ("\n");
|
||||
printf ("%s\n", _("This plugin tests a RADIUS server to see if it is accepting connections."));
|
||||
|
@ -370,8 +377,8 @@ print_help (void)
|
|||
printf ("%s\n", _("the configuration file is described in the radiusclient library sources."));
|
||||
printf ("%s\n", _("The password option presents a substantial security issue because the"));
|
||||
printf ("%s\n", _("password can possibly be determined by careful watching of the command line"));
|
||||
printf ("%s\n", _("in a process listing. This risk is exacerbated because nagios will"));
|
||||
printf ("%s\n", _("run the plugin at regular predictable intervals. Please be sure that"));
|
||||
printf ("%s\n", _("in a process listing. This risk is exacerbated because the plugin will"));
|
||||
printf ("%s\n", _("typically be executed at regular predictable intervals. Please be sure that"));
|
||||
printf ("%s\n", _("the password used does not allow access to sensitive system resources."));
|
||||
|
||||
printf (UT_SUPPORT);
|
||||
|
@ -392,7 +399,7 @@ print_usage (void)
|
|||
|
||||
int my_rc_read_config(char * a)
|
||||
{
|
||||
#ifdef HAVE_LIBRADIUSCLIENT_NG
|
||||
#if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG)
|
||||
rch = rc_read_config(a);
|
||||
return (rch == NULL) ? 1 : 0;
|
||||
#else
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_real plugin
|
||||
* Monitoring check_real plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2000-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 2000-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
const char *progname = "check_real";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
|
@ -178,6 +178,7 @@ main (int argc, char **argv)
|
|||
|
||||
/* watch for the REAL connection string */
|
||||
result = recv (sd, buffer, MAX_INPUT_BUFFER - 1, 0);
|
||||
buffer[result] = "\0"; /* null terminate recieved buffer */
|
||||
|
||||
/* return a CRITICAL status if we couldn't read any data */
|
||||
if (result == -1) {
|
||||
|
@ -429,7 +430,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,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_smtp plugin
|
||||
* Monitoring check_smtp plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2000-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 2000-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
const char *progname = "check_smtp";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
|
@ -822,7 +822,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,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_snmp plugin
|
||||
* Monitoring check_snmp 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_snmp";
|
||||
const char *copyright = "1999-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "runcmd.h"
|
||||
|
@ -459,7 +459,7 @@ main (int argc, char **argv)
|
|||
/* Process this block for numeric comparisons */
|
||||
/* Make some special values,like Timeticks numeric only if a threshold is defined */
|
||||
if (thlds[i]->warning || thlds[i]->critical || calculate_rate) {
|
||||
ptr = strpbrk (show, "0123456789");
|
||||
ptr = strpbrk (show, "-0123456789");
|
||||
if (ptr == NULL)
|
||||
die (STATE_UNKNOWN,_("No valid data returned (%s)\n"), show);
|
||||
while (i >= response_size) {
|
||||
|
@ -963,11 +963,16 @@ validate_arguments ()
|
|||
if (seclevel == NULL)
|
||||
xasprintf(&seclevel, "noAuthNoPriv");
|
||||
|
||||
if (secname == NULL)
|
||||
die(STATE_UNKNOWN, _("Required parameter: %s\n"), "secname");
|
||||
|
||||
if (strcmp(seclevel, "noAuthNoPriv") == 0) {
|
||||
numauthpriv = 2;
|
||||
numauthpriv = 4;
|
||||
authpriv = calloc (numauthpriv, sizeof (char *));
|
||||
authpriv[0] = strdup ("-l");
|
||||
authpriv[1] = strdup ("noAuthNoPriv");
|
||||
authpriv[2] = strdup ("-u");
|
||||
authpriv[3] = strdup (secname);
|
||||
} else {
|
||||
if (! ( (strcmp(seclevel, "authNoPriv")==0) || (strcmp(seclevel, "authPriv")==0) ) ) {
|
||||
usage2 (_("Invalid seclevel"), seclevel);
|
||||
|
@ -976,9 +981,6 @@ validate_arguments ()
|
|||
if (authproto == NULL )
|
||||
xasprintf(&authproto, DEFAULT_AUTH_PROTOCOL);
|
||||
|
||||
if (secname == NULL)
|
||||
die(STATE_UNKNOWN, _("Required parameter: %s\n"), "secname");
|
||||
|
||||
if (authpasswd == NULL)
|
||||
die(STATE_UNKNOWN, _("Required parameter: %s\n"), "authpasswd");
|
||||
|
||||
|
@ -1160,7 +1162,7 @@ print_help (void)
|
|||
printf (" %s\n", "-D, --output-delimiter=STRING");
|
||||
printf (" %s\n", _("Separates output on multiple OID requests"));
|
||||
|
||||
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (" %s\n", "-e, --retries=INTEGER");
|
||||
printf (" %s\n", _("Number of retries to be used in the requests"));
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_ssh plugin
|
||||
* Monitoring check_ssh plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2000-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 2000-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
const char *progname = "check_ssh";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
|
@ -46,6 +46,7 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
|||
int port = -1;
|
||||
char *server_name = NULL;
|
||||
char *remote_version = NULL;
|
||||
char *remote_protocol = NULL;
|
||||
int verbose = FALSE;
|
||||
|
||||
int process_arguments (int, char **);
|
||||
|
@ -53,7 +54,7 @@ int validate_arguments (void);
|
|||
void print_help (void);
|
||||
void print_usage (void);
|
||||
|
||||
int ssh_connect (char *haddr, int hport, char *remote_version);
|
||||
int ssh_connect (char *haddr, int hport, char *remote_version, char *remote_protocol);
|
||||
|
||||
|
||||
|
||||
|
@ -78,7 +79,7 @@ main (int argc, char **argv)
|
|||
alarm (socket_timeout);
|
||||
|
||||
/* ssh_connect exits if error is found */
|
||||
result = ssh_connect (server_name, port, remote_version);
|
||||
result = ssh_connect (server_name, port, remote_version, remote_protocol);
|
||||
|
||||
alarm (0);
|
||||
|
||||
|
@ -105,6 +106,7 @@ process_arguments (int argc, char **argv)
|
|||
{"timeout", required_argument, 0, 't'},
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
{"remote-version", required_argument, 0, 'r'},
|
||||
{"remote-protcol", required_argument, 0, 'P'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
@ -116,7 +118,7 @@ process_arguments (int argc, char **argv)
|
|||
strcpy (argv[c], "-t");
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "+Vhv46t:r:H:p:", longopts, &option);
|
||||
c = getopt_long (argc, argv, "+Vhv46t:r:H:p:P:", longopts, &option);
|
||||
|
||||
if (c == -1 || c == EOF)
|
||||
break;
|
||||
|
@ -152,6 +154,9 @@ process_arguments (int argc, char **argv)
|
|||
case 'r': /* remote version */
|
||||
remote_version = optarg;
|
||||
break;
|
||||
case 'P': /* remote version */
|
||||
remote_protocol = optarg;
|
||||
break;
|
||||
case 'H': /* host */
|
||||
if (is_host (optarg) == FALSE)
|
||||
usage2 (_("Invalid hostname/address"), optarg);
|
||||
|
@ -206,7 +211,7 @@ validate_arguments (void)
|
|||
|
||||
|
||||
int
|
||||
ssh_connect (char *haddr, int hport, char *remote_version)
|
||||
ssh_connect (char *haddr, int hport, char *remote_version, char *remote_protocol)
|
||||
{
|
||||
int sd;
|
||||
int result;
|
||||
|
@ -254,6 +259,14 @@ ssh_connect (char *haddr, int hport, char *remote_version)
|
|||
exit (STATE_WARNING);
|
||||
}
|
||||
|
||||
if (remote_protocol && strcmp(remote_protocol, ssh_proto)) {
|
||||
printf
|
||||
(_("SSH WARNING - %s (protocol %s) protocol version mismatch, expected '%s'\n"),
|
||||
ssh_server, ssh_proto, remote_protocol);
|
||||
close(sd);
|
||||
exit (STATE_WARNING);
|
||||
}
|
||||
|
||||
elapsed_time = (double)deltime(tv) / 1.0e6;
|
||||
|
||||
printf
|
||||
|
@ -291,11 +304,14 @@ print_help (void)
|
|||
|
||||
printf (UT_IPv46);
|
||||
|
||||
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
|
||||
printf (" %s\n", "-r, --remote-version=STRING");
|
||||
printf (" %s\n", _("Warn if string doesn't match expected server version (ex: OpenSSH_3.9p1)"));
|
||||
|
||||
printf (" %s\n", "-P, --remote-protocol=STRING");
|
||||
printf (" %s\n", _("Warn if protocol doesn't match expected protocol version (ex: 2.0)"));
|
||||
|
||||
printf (UT_VERBOSE);
|
||||
|
||||
printf (UT_SUPPORT);
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_disk plugin
|
||||
* Monitoring check_disk plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net)
|
||||
* Copyright (c) 2000-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 2000-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This file contains the check_disk plugin
|
||||
* This file contains the check_swap plugin
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
@ -29,7 +29,7 @@
|
|||
|
||||
const char *progname = "check_swap";
|
||||
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"
|
||||
|
@ -60,9 +60,10 @@ void print_help (void);
|
|||
int warn_percent = 0;
|
||||
int crit_percent = 0;
|
||||
float warn_size_bytes = 0;
|
||||
float crit_size_bytes= 0;
|
||||
float crit_size_bytes = 0;
|
||||
int verbose;
|
||||
int allswaps;
|
||||
int no_swap_state = STATE_CRITICAL;
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
|
@ -350,7 +351,7 @@ main (int argc, char **argv)
|
|||
if(total_swap_mb) {
|
||||
percent_used = 100 * ((double) used_swap_mb) / ((double) total_swap_mb);
|
||||
} else {
|
||||
percent_used = 0;
|
||||
percent_used = 100;
|
||||
}
|
||||
|
||||
result = max_state (result, check_swap (percent_used, free_swap_mb));
|
||||
|
@ -372,6 +373,9 @@ main (int argc, char **argv)
|
|||
int
|
||||
check_swap (int usp, float free_swap_mb)
|
||||
{
|
||||
|
||||
if (!free_swap_mb) return no_swap_state;
|
||||
|
||||
int result = STATE_UNKNOWN;
|
||||
float free_swap = free_swap_mb * (1024 * 1024); /* Convert back to bytes as warn and crit specified in bytes */
|
||||
if (usp >= 0 && crit_percent != 0 && usp >= (100.0 - crit_percent))
|
||||
|
@ -400,6 +404,7 @@ process_arguments (int argc, char **argv)
|
|||
{"warning", required_argument, 0, 'w'},
|
||||
{"critical", required_argument, 0, 'c'},
|
||||
{"allswaps", no_argument, 0, 'a'},
|
||||
{"no-swap", required_argument, 0, 'n'},
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
|
@ -410,7 +415,7 @@ process_arguments (int argc, char **argv)
|
|||
return ERROR;
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "+?Vvhac:w:", longopts, &option);
|
||||
c = getopt_long (argc, argv, "+?Vvhac:w:n:", longopts, &option);
|
||||
|
||||
if (c == -1 || c == EOF)
|
||||
break;
|
||||
|
@ -455,6 +460,10 @@ process_arguments (int argc, char **argv)
|
|||
case 'a': /* all swap */
|
||||
allswaps = TRUE;
|
||||
break;
|
||||
case 'n':
|
||||
if ((no_swap_state = mp_translate_state(optarg)) == ERROR) {
|
||||
usage4 (_("no-swap result must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3)."));
|
||||
}
|
||||
case 'v': /* verbose */
|
||||
verbose++;
|
||||
break;
|
||||
|
@ -538,13 +547,16 @@ print_help (void)
|
|||
printf (" %s\n", "-c, --critical=INTEGER");
|
||||
printf (" %s\n", _("Exit with CRITICAL status if less than INTEGER bytes of swap space are free"));
|
||||
printf (" %s\n", "-c, --critical=PERCENT%%");
|
||||
printf (" %s\n", _("Exit with CRITCAL status if less than PERCENT of swap space is free"));
|
||||
printf (" %s\n", _("Exit with CRITICAL status if less than PERCENT of swap space is free"));
|
||||
printf (" %s\n", "-a, --allswaps");
|
||||
printf (" %s\n", _("Conduct comparisons for all swap partitions, one by one"));
|
||||
printf (" %s\n", "-n, --no-swap=<ok|warning|critical|unknown>");
|
||||
printf (" %s %s\n", _("Resulting state when there is no swap regardless of thresholds. Default:"), state_text(no_swap_state));
|
||||
printf (UT_VERBOSE);
|
||||
|
||||
printf ("\n");
|
||||
printf ("%s\n", _("Notes:"));
|
||||
printf (" %s\n", _("Both INTEGER and PERCENT thresholds can be specified, they are all checked."));
|
||||
printf (" %s\n", _("On AIX, if -a is specified, uses lsps -a, otherwise uses lsps -s."));
|
||||
|
||||
printf (UT_SUPPORT);
|
||||
|
@ -556,6 +568,6 @@ void
|
|||
print_usage (void)
|
||||
{
|
||||
printf ("%s\n", _("Usage:"));
|
||||
printf ("%s [-av] -w <percent_free>%% -c <percent_free>%%\n",progname);
|
||||
printf ("%s [-av] -w <bytes_free> -c <bytes_free>\n", progname);
|
||||
printf (" %s [-av] -w <percent_free>%% -c <percent_free>%%\n",progname);
|
||||
printf (" -w <bytes_free> -c <bytes_free> [-n <state>]\n");
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_tcp plugin
|
||||
* Monitoring check_tcp plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 1999-2013 Nagios Plugins Development Team
|
||||
* Copyright (c) 1999-2013 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -30,15 +30,14 @@
|
|||
/* progname "check_tcp" changes depending on symlink called */
|
||||
char *progname;
|
||||
const char *copyright = "1999-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
#include <ctype.h>
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
#include "utils.h"
|
||||
#include "utils_tcp.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
|
@ -354,8 +353,13 @@ main (int argc, char **argv)
|
|||
printf("Unexpected response from host/socket on ");
|
||||
else
|
||||
printf("%.3f second response time on ", elapsed_time);
|
||||
if(server_address[0] != '/')
|
||||
printf("port %d", server_port);
|
||||
if(server_address[0] != '/') {
|
||||
if (host_specified)
|
||||
printf("%s port %d",
|
||||
server_address, server_port);
|
||||
else
|
||||
printf("port %d", server_port);
|
||||
}
|
||||
else
|
||||
printf("socket %s", server_address);
|
||||
}
|
||||
|
@ -670,7 +674,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,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_time plugin
|
||||
* Monitoring check_time 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_time";
|
||||
const char *copyright = "1999-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
|
@ -358,7 +358,7 @@ print_help (void)
|
|||
printf (" %s\n", "-C, --critical-connect=INTEGER");
|
||||
printf (" %s\n", _("Response time (sec.) necessary to result in critical status"));
|
||||
|
||||
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
|
||||
printf (UT_SUPPORT);
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_ups plugin
|
||||
* Monitoring check_ups plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2000 Tom Shields
|
||||
* 2004 Alain Richard <alain.richard@equation.fr>
|
||||
* 2004 Arnaud Quette <arnaud.quette@mgeups.com>
|
||||
* Copyright (c) 2002-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 2002-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This file contains Network UPS Tools plugin for Nagios
|
||||
* This file contains Network UPS Tools plugin for Monitoring
|
||||
*
|
||||
* This plugin tests the UPS service on the specified host. Network UPS Tools
|
||||
* from www.networkupstools.org must be running for this plugin to work.
|
||||
|
@ -34,7 +34,7 @@
|
|||
|
||||
const char *progname = "check_ups";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
|
@ -66,7 +66,7 @@ enum {
|
|||
#define UPSSTATUS_BOOST 512
|
||||
#define UPSSTATUS_CHRG 1024
|
||||
#define UPSSTATUS_DISCHRG 2048
|
||||
#define UPSSTATUS_UNKOWN 4096
|
||||
#define UPSSTATUS_UNKNOWN 4096
|
||||
|
||||
enum { NOSUCHVAR = ERROR-1 };
|
||||
|
||||
|
@ -181,7 +181,7 @@ main (int argc, char **argv)
|
|||
if (status & UPSSTATUS_DISCHRG) {
|
||||
xasprintf (&ups_status, "%s%s", ups_status, _(", Discharging"));
|
||||
}
|
||||
if (status & UPSSTATUS_UNKOWN) {
|
||||
if (status & UPSSTATUS_UNKNOWN) {
|
||||
xasprintf (&ups_status, "%s%s", ups_status, _(", Unknown"));
|
||||
}
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ determine_status (void)
|
|||
else if (!strcmp (ptr, "DISCHRG"))
|
||||
status |= UPSSTATUS_DISCHRG;
|
||||
else
|
||||
status |= UPSSTATUS_UNKOWN;
|
||||
status |= UPSSTATUS_UNKNOWN;
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
@ -625,7 +625,7 @@ print_help (void)
|
|||
|
||||
printf (UT_WARN_CRIT);
|
||||
|
||||
printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
|
||||
|
||||
/* TODO: -v clashing with -v/-variable. Commenting out help text since verbose
|
||||
is unused up to now */
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios check_users plugin
|
||||
* Monitoring check_users plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2000-2012 Nagios Plugins Development Team
|
||||
* Copyright (c) 2000-2012 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -32,12 +32,17 @@
|
|||
|
||||
const char *progname = "check_users";
|
||||
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"
|
||||
|
||||
#if HAVE_UTMPX_H
|
||||
#if HAVE_WTSAPI32_H
|
||||
# include <windows.h>
|
||||
# include <wtsapi32.h>
|
||||
# undef ERROR
|
||||
# define ERROR -1
|
||||
#elif HAVE_UTMPX_H
|
||||
# include <utmpx.h>
|
||||
#else
|
||||
# include "popen.h"
|
||||
|
@ -58,7 +63,11 @@ main (int argc, char **argv)
|
|||
int users = -1;
|
||||
int result = STATE_UNKNOWN;
|
||||
char *perf;
|
||||
#if HAVE_UTMPX_H
|
||||
#if HAVE_WTSAPI32_H
|
||||
WTS_SESSION_INFO *wtsinfo;
|
||||
DWORD wtscount;
|
||||
DWORD index;
|
||||
#elif HAVE_UTMPX_H
|
||||
struct utmpx *putmpx;
|
||||
#else
|
||||
char input_buffer[MAX_INPUT_BUFFER];
|
||||
|
@ -78,7 +87,36 @@ main (int argc, char **argv)
|
|||
|
||||
users = 0;
|
||||
|
||||
#if HAVE_UTMPX_H
|
||||
#if HAVE_WTSAPI32_H
|
||||
if (!WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE,
|
||||
0, 1, &wtsinfo, &wtscount)) {
|
||||
printf(_("Could not enumerate RD sessions: %d\n"), GetLastError());
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
for (index = 0; index < wtscount; index++) {
|
||||
LPTSTR username;
|
||||
DWORD size;
|
||||
int len;
|
||||
|
||||
if (!WTSQuerySessionInformation(WTS_CURRENT_SERVER_HANDLE,
|
||||
wtsinfo[index].SessionId, WTSUserName, &username, &size))
|
||||
continue;
|
||||
|
||||
len = lstrlen(username);
|
||||
|
||||
WTSFreeMemory(username);
|
||||
|
||||
if (len == 0)
|
||||
continue;
|
||||
|
||||
if (wtsinfo[index].State == WTSActive ||
|
||||
wtsinfo[index].State == WTSDisconnected)
|
||||
users++;
|
||||
}
|
||||
|
||||
WTSFreeMemory(wtsinfo);
|
||||
#elif HAVE_UTMPX_H
|
||||
/* get currently logged users from utmpx */
|
||||
setutxent ();
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios plugins common include file
|
||||
* Monitoring Plugins common include file
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)
|
||||
* Copyright (c) 2003-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 2003-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios negate plugin
|
||||
* Monitoring negate plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2002-2008 Nagios Plugins Development Team
|
||||
* Copyright (c) 2002-2008 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -31,21 +31,20 @@
|
|||
|
||||
const char *progname = "negate";
|
||||
const char *copyright = "2002-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#define DEFAULT_TIMEOUT 11
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "utils.h"
|
||||
#include "utils_cmd.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
/* char *command_line; */
|
||||
|
||||
static const char **process_arguments (int, char **);
|
||||
int validate_arguments (char **);
|
||||
int translate_state (char *);
|
||||
void validate_arguments (char **);
|
||||
void print_help (void);
|
||||
void print_usage (void);
|
||||
int subst_text = FALSE;
|
||||
|
@ -99,8 +98,7 @@ main (int argc, char **argv)
|
|||
die (max_state_alt (result, STATE_UNKNOWN), _("No data returned from command\n"));
|
||||
|
||||
for (i = 0; i < chld_out.lines; i++) {
|
||||
if (subst_text && result != state[result] &&
|
||||
result >= 0 && result <= 4) {
|
||||
if (subst_text && result >= 0 && result <= 4 && result != state[result]) {
|
||||
/* Loop over each match found */
|
||||
while ((sub = strstr (chld_out.line[i], state_text (result)))) {
|
||||
/* Terminate the first part and skip over the string we'll substitute */
|
||||
|
@ -166,27 +164,27 @@ process_arguments (int argc, char **argv)
|
|||
timeout_interval = atoi (optarg);
|
||||
break;
|
||||
case 'T': /* Result to return on timeouts */
|
||||
if ((timeout_state = translate_state(optarg)) == ERROR)
|
||||
if ((timeout_state = mp_translate_state(optarg)) == ERROR)
|
||||
usage4 (_("Timeout result must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3)."));
|
||||
break;
|
||||
case 'o': /* replacement for OK */
|
||||
if ((state[STATE_OK] = translate_state(optarg)) == ERROR)
|
||||
if ((state[STATE_OK] = mp_translate_state(optarg)) == ERROR)
|
||||
usage4 (_("Ok must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3)."));
|
||||
permute = FALSE;
|
||||
break;
|
||||
|
||||
case 'w': /* replacement for WARNING */
|
||||
if ((state[STATE_WARNING] = translate_state(optarg)) == ERROR)
|
||||
if ((state[STATE_WARNING] = mp_translate_state(optarg)) == ERROR)
|
||||
usage4 (_("Warning must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3)."));
|
||||
permute = FALSE;
|
||||
break;
|
||||
case 'c': /* replacement for CRITICAL */
|
||||
if ((state[STATE_CRITICAL] = translate_state(optarg)) == ERROR)
|
||||
if ((state[STATE_CRITICAL] = mp_translate_state(optarg)) == ERROR)
|
||||
usage4 (_("Critical must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3)."));
|
||||
permute = FALSE;
|
||||
break;
|
||||
case 'u': /* replacement for UNKNOWN */
|
||||
if ((state[STATE_UNKNOWN] = translate_state(optarg)) == ERROR)
|
||||
if ((state[STATE_UNKNOWN] = mp_translate_state(optarg)) == ERROR)
|
||||
usage4 (_("Unknown must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3)."));
|
||||
permute = FALSE;
|
||||
break;
|
||||
|
@ -207,7 +205,7 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
void
|
||||
validate_arguments (char **command_line)
|
||||
{
|
||||
if (command_line[0] == NULL)
|
||||
|
@ -218,24 +216,6 @@ validate_arguments (char **command_line)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
translate_state (char *state_text)
|
||||
{
|
||||
char *temp_ptr;
|
||||
for (temp_ptr = state_text; *temp_ptr; temp_ptr++) {
|
||||
*temp_ptr = toupper(*temp_ptr);
|
||||
}
|
||||
if (!strcmp(state_text,"OK") || !strcmp(state_text,"0"))
|
||||
return STATE_OK;
|
||||
if (!strcmp(state_text,"WARNING") || !strcmp(state_text,"1"))
|
||||
return STATE_WARNING;
|
||||
if (!strcmp(state_text,"CRITICAL") || !strcmp(state_text,"2"))
|
||||
return STATE_CRITICAL;
|
||||
if (!strcmp(state_text,"UNKNOWN") || !strcmp(state_text,"3"))
|
||||
return STATE_UNKNOWN;
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
void
|
||||
print_help (void)
|
||||
{
|
||||
|
@ -252,7 +232,7 @@ print_help (void)
|
|||
|
||||
printf (UT_HELP_VRSN);
|
||||
|
||||
printf (UT_TIMEOUT, timeout_interval);
|
||||
printf (UT_PLUG_TIMEOUT, timeout_interval);
|
||||
printf (" %s\n", _("Keep timeout longer than the plugin timeout to retain CRITICAL status."));
|
||||
printf (" -T, --timeout-result=STATUS\n");
|
||||
printf (" %s\n", _("Custom result on Negate timeouts; see below for STATUS definition\n"));
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios plugins network utilities
|
||||
* Monitoring Plugins network utilities
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)
|
||||
* Copyright (c) 2003-2008 Nagios Plugins Development Team
|
||||
* Copyright (c) 2003-2008 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios plugins net utilities include file
|
||||
* Monitoring Plugins net utilities include file
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)
|
||||
* Copyright (c) 2003-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 2003-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -40,8 +40,8 @@
|
|||
#ifdef HAVE_SYS_UN_H
|
||||
# include <sys/un.h>
|
||||
# ifndef UNIX_PATH_MAX
|
||||
/* linux uses this, on sun it's hard-coded at 108 without a define */
|
||||
# define UNIX_PATH_MAX 108
|
||||
/* linux uses this, on sun it's hard-coded at 108 without a define, on BSD at 104 */
|
||||
# define UNIX_PATH_MAX 104
|
||||
# endif /* UNIX_PATH_MAX */
|
||||
#endif /* HAVE_SYS_UN_H */
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios plugins popen
|
||||
* Monitoring Plugins popen
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2005-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 2005-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
|
|
@ -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 :
|
||||
*
|
||||
|
@ -261,7 +261,7 @@ runcmd_timeout_alarm_handler (int signo)
|
|||
size_t i;
|
||||
|
||||
if (signo == SIGALRM)
|
||||
puts(_("CRITICAL - Plugin timed out while executing system call\n"));
|
||||
puts(_("CRITICAL - Plugin timed out while executing system call"));
|
||||
|
||||
if(np_pids) for(i = 0; i < maxfd; i++) {
|
||||
if(np_pids[i] != 0) kill(np_pids[i], SIGKILL);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2005 Nagios Plugins Development Team
|
||||
* Copyright (c) 2005 Monitoring Plugins Development Team
|
||||
* Author: Andreas Ericsson <ae@op5.se>
|
||||
*
|
||||
*
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios plugins SSL utilities
|
||||
* Monitoring Plugins SSL utilities
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2005-2010 Nagios Plugins Development Team
|
||||
* Copyright (c) 2005-2010 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -86,10 +86,12 @@ int np_net_ssl_init_with_hostname_version_and_cert(int sd, char *host_name, int
|
|||
if (cert && privkey) {
|
||||
SSL_CTX_use_certificate_file(c, cert, SSL_FILETYPE_PEM);
|
||||
SSL_CTX_use_PrivateKey_file(c, privkey, SSL_FILETYPE_PEM);
|
||||
#ifdef USE_OPENSSL
|
||||
if (!SSL_CTX_check_private_key(c)) {
|
||||
printf ("%s\n", _("CRITICAL - Private key does not seem to match certificate!\n"));
|
||||
return STATE_CRITICAL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifdef SSL_OP_NO_TICKET
|
||||
SSL_CTX_set_options(c, SSL_OP_NO_TICKET);
|
||||
|
|
54
plugins/t/NPTest.cache.travis
Normal file
54
plugins/t/NPTest.cache.travis
Normal file
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
'MYSQL_LOGIN_DETAILS' => '-u root -d test',
|
||||
'NP_ALLOW_SUDO' => 'yes',
|
||||
'NP_DNS_SERVER' => '8.8.8.8',
|
||||
'NP_GOOD_NTP_SERVICE' => '',
|
||||
'NP_HOSTNAME_INVALID' => 'nosuchhost',
|
||||
'NP_HOSTNAME_VALID' => 'monitoringplugins.org',
|
||||
'NP_HOSTNAME_VALID_IP' => '130.133.8.40',
|
||||
'NP_HOSTNAME_VALID_REVERSE' => 'orwell.monitoring-plugins.org.',
|
||||
'NP_HOST_DHCP_RESPONSIVE' => '',
|
||||
'NP_HOST_NONRESPONSIVE' => '10.0.0.1',
|
||||
'NP_HOST_RESPONSIVE' => 'localhost',
|
||||
'NP_HOST_SMB' => '',
|
||||
'NP_HOST_SNMP' => '',
|
||||
'NP_HOST_TCP_FTP' => '',
|
||||
'NP_HOST_TCP_HPJD' => '',
|
||||
'NP_HOST_TCP_HTTP' => 'localhost',
|
||||
'NP_HOST_TCP_HTTP2' => 'labs.consol.de',
|
||||
'NP_HOST_TCP_IMAP' => 'imap.web.de',
|
||||
'NP_HOST_TCP_POP' => 'pop.web.de',
|
||||
'NP_HOST_TCP_SMTP' => 'localhost',
|
||||
'NP_HOST_TCP_SMTP_NOTLS' => '',
|
||||
'NP_HOST_TCP_SMTP_TLS' => '',
|
||||
'NP_INTERNET_ACCESS' => 'yes',
|
||||
'NP_MOUNTPOINT2_VALID' => '',
|
||||
'NP_MOUNTPOINT_VALID' => '/',
|
||||
'NP_MYSQL_SERVER' => 'localhost',
|
||||
'NP_HOST_UDP_TIME' => 'localhost',
|
||||
'NP_MYSQL_SOCKET' => '/var/run/mysqld/mysqld.sock',
|
||||
'NP_MYSQL_WITH_SLAVE' => '',
|
||||
'NP_MYSQL_WITH_SLAVE_LOGIN' => '',
|
||||
'NP_NO_NTP_SERVICE' => 'localhost',
|
||||
'NP_SMB_SHARE' => '',
|
||||
'NP_SMB_SHARE_DENY' => '',
|
||||
'NP_SMB_SHARE_SPC' => '',
|
||||
'NP_SMB_VALID_USER' => '',
|
||||
'NP_SMB_VALID_USER_PASS' => '',
|
||||
'NP_SNMP_COMMUNITY' => '',
|
||||
'NP_SSH_CONFIGFILE' => '~/.ssh/config',
|
||||
'NP_SSH_HOST' => 'localhost',
|
||||
'NP_SSH_IDENTITY' => '~/.ssh/id_dsa',
|
||||
'NP_HOST_TCP_JABBER' => 'jabber.org',
|
||||
'host_nonresponsive' => '10.0.0.1',
|
||||
'host_responsive' => 'localhost',
|
||||
'host_snmp' => '',
|
||||
'host_tcp_ftp' => '',
|
||||
'host_tcp_http' => 'localhost',
|
||||
'host_tcp_imap' => 'imap.nierlein.de',
|
||||
'host_tcp_smtp' => 'localhost',
|
||||
'hostname_invalid' => 'nosuchhost',
|
||||
'snmp_community' => '',
|
||||
'user_snmp' => '',
|
||||
'host_udp_time' => 'none',
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
#
|
||||
|
||||
# TODO: Add in tests for perf data. Need to beef up Nagios::Plugin::Performance to cater for max, min, etc
|
||||
# TODO: Add in tests for perf data. Need to beef up Monitoring::Plugin::Performance to cater for max, min, etc
|
||||
|
||||
use strict;
|
||||
use Test::More;
|
||||
|
@ -37,7 +37,7 @@ cmp_ok( $c, '==', 2, "Got two mountpoints in output");
|
|||
|
||||
|
||||
# Get perf data
|
||||
# Should use Nagios::Plugin
|
||||
# Should use Monitoring::Plugin
|
||||
my @perf_data = sort(split(/ /, $result->perf_output));
|
||||
|
||||
|
||||
|
|
|
@ -10,14 +10,14 @@ use NPTest;
|
|||
|
||||
plan skip_all => "check_dns not compiled" unless (-x "check_dns");
|
||||
|
||||
plan tests => 13;
|
||||
plan tests => 14;
|
||||
|
||||
my $successOutput = '/DNS OK: [\.0-9]+ seconds? response time/';
|
||||
|
||||
my $hostname_valid = getTestParameter(
|
||||
"NP_HOSTNAME_VALID",
|
||||
"A valid (known to DNS) hostname",
|
||||
"nagios.com"
|
||||
"monitoring-plugins.org"
|
||||
);
|
||||
|
||||
my $hostname_valid_ip = getTestParameter(
|
||||
|
@ -54,6 +54,7 @@ cmp_ok( $res->return_code, '==', 2, "Critical threshold passed");
|
|||
|
||||
$res = NPTest->testCmd("./check_dns -H $hostname_valid -t 5 -w 0 -c 5");
|
||||
cmp_ok( $res->return_code, '==', 1, "Warning threshold passed");
|
||||
like( $res->output, "/\|time=[\d\.]+s;0.0*;5\.0*;0\.0*/", "Output performance data OK" );
|
||||
|
||||
$res = NPTest->testCmd("./check_dns -H $hostname_invalid -t 1");
|
||||
cmp_ok( $res->return_code, '==', 2, "Invalid $hostname_invalid");
|
||||
|
|
|
@ -27,16 +27,18 @@ my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_IN
|
|||
|
||||
my $t;
|
||||
|
||||
if ( -x "./check_fping" )
|
||||
{
|
||||
my $fping = qx(which fping 2> /dev/null);
|
||||
chomp($fping);
|
||||
if( ! -x "./check_fping") {
|
||||
$t += skipMissingCmd( "./check_fping", $tests );
|
||||
}
|
||||
elsif ( $> != 0 && (!$fping || ! -u $fping)) {
|
||||
$t += skipMsg( "./check_fping", $tests );
|
||||
} else {
|
||||
$t += checkCmd( "./check_fping $host_responsive", 0, $successOutput );
|
||||
$t += checkCmd( "./check_fping $host_nonresponsive", [ 1, 2 ] );
|
||||
$t += checkCmd( "./check_fping $hostname_invalid", [ 1, 2 ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$t += skipMissingCmd( "./check_fping", $tests );
|
||||
}
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
||||
|
|
|
@ -31,8 +31,8 @@ my $internet_access = getTestParameter( "NP_INTERNET_ACCESS",
|
|||
"yes");
|
||||
|
||||
my $host_tcp_http2 = getTestParameter( "NP_HOST_TCP_HTTP2",
|
||||
"A host providing an index page containing the string 'nagios'",
|
||||
"nagios.org" );
|
||||
"A host providing an index page containing the string 'monitoring'",
|
||||
"test.monitoring-plugins.org" );
|
||||
|
||||
|
||||
$res = NPTest->testCmd(
|
||||
|
@ -62,27 +62,27 @@ cmp_ok( $res->return_code, '==', 2, "Webserver $hostname_invalid not valid" );
|
|||
like( $res->output, "/Unable to open TCP socket|Socket timeout after/", "Output OK");
|
||||
|
||||
SKIP: {
|
||||
skip "No host serving nagios in index file", 7 unless $host_tcp_http2;
|
||||
skip "No host serving monitoring in index file", 7 unless $host_tcp_http2;
|
||||
|
||||
$res = NPTest->testCmd( "./check_http -H $host_tcp_http2 -r 'nagios'" );
|
||||
cmp_ok( $res->return_code, "==", 0, "Got a reference to 'nagios'");
|
||||
$res = NPTest->testCmd( "./check_http -H $host_tcp_http2 -r 'monitoring'" );
|
||||
cmp_ok( $res->return_code, "==", 0, "Got a reference to 'monitoring'");
|
||||
|
||||
$res = NPTest->testCmd( "./check_http -H $host_tcp_http2 -r 'nAGiOs'" );
|
||||
cmp_ok( $res->return_code, "==", 2, "Not got 'nAGiOs'");
|
||||
$res = NPTest->testCmd( "./check_http -H $host_tcp_http2 -r 'mONiTORing'" );
|
||||
cmp_ok( $res->return_code, "==", 2, "Not got 'mONiTORing'");
|
||||
like ( $res->output, "/pattern not found/", "Error message says 'pattern not found'");
|
||||
|
||||
$res = NPTest->testCmd( "./check_http -H $host_tcp_http2 -R 'nAGiOs'" );
|
||||
cmp_ok( $res->return_code, "==", 0, "But case insensitive doesn't mind 'nAGiOs'");
|
||||
$res = NPTest->testCmd( "./check_http -H $host_tcp_http2 -R 'mONiTORing'" );
|
||||
cmp_ok( $res->return_code, "==", 0, "But case insensitive doesn't mind 'mONiTORing'");
|
||||
|
||||
$res = NPTest->testCmd( "./check_http -H $host_tcp_http2 -r 'nagios' --invert-regex" );
|
||||
$res = NPTest->testCmd( "./check_http -H $host_tcp_http2 -r 'monitoring' --invert-regex" );
|
||||
cmp_ok( $res->return_code, "==", 2, "Invert results work when found");
|
||||
like ( $res->output, "/pattern found/", "Error message says 'pattern found'");
|
||||
|
||||
$res = NPTest->testCmd( "./check_http -H $host_tcp_http2 -r 'nAGiOs' --invert-regex" );
|
||||
$res = NPTest->testCmd( "./check_http -H $host_tcp_http2 -r 'mONiTORing' --invert-regex" );
|
||||
cmp_ok( $res->return_code, "==", 0, "And also when not found");
|
||||
}
|
||||
SKIP: {
|
||||
skip "No internet access", 11 if $internet_access eq "no";
|
||||
skip "No internet access", 16 if $internet_access eq "no";
|
||||
|
||||
$res = NPTest->testCmd(
|
||||
"./check_http --ssl www.verisign.com"
|
||||
|
|
|
@ -29,7 +29,7 @@ my $hostname_invalid = getTestParameter(
|
|||
);
|
||||
|
||||
|
||||
my $jabberOK = '/JABBER OK\s-\s\d+\.\d+\ssecond response time on port 5222/';
|
||||
my $jabberOK = '/JABBER OK\s-\s\d+\.\d+\ssecond response time on '.$host_tcp_jabber.' port 5222/';
|
||||
|
||||
my $jabberUnresponsive = '/CRITICAL\s-\sSocket timeout after\s\d+\sseconds/';
|
||||
|
||||
|
@ -40,7 +40,7 @@ my $r;
|
|||
SKIP: {
|
||||
skip "No jabber server defined", 6 unless $host_tcp_jabber;
|
||||
|
||||
$r = NPTest->testCmd( "./check_jabber $host_tcp_jabber" );
|
||||
$r = NPTest->testCmd( "./check_jabber -H $host_tcp_jabber" );
|
||||
is( $r->return_code, 0, "Connected okay");
|
||||
like( $r->output, $jabberOK, "Output as expected" );
|
||||
|
||||
|
@ -48,7 +48,7 @@ SKIP: {
|
|||
is( $r->return_code, 0, "Connected okay, within limits" );
|
||||
like( $r->output, $jabberOK, "Output as expected" );
|
||||
|
||||
$r = NPTest->testCmd( "./check_jabber $host_tcp_jabber -wt 9 -ct 9 -to 10" );
|
||||
$r = NPTest->testCmd( "./check_jabber -H $host_tcp_jabber -wt 9 -ct 9 -to 10" );
|
||||
is( $r->return_code, 0, "Old syntax okay" );
|
||||
like( $r->output, $jabberOK, "Output as expected" );
|
||||
|
||||
|
|
|
@ -21,27 +21,29 @@ plan skip_all => "check_mysql not compiled" unless (-x "check_mysql");
|
|||
plan tests => 15;
|
||||
|
||||
my $bad_login_output = '/Access denied for user /';
|
||||
my $mysqlserver = getTestParameter(
|
||||
"NP_MYSQL_SERVER",
|
||||
my $mysqlserver = getTestParameter(
|
||||
"NP_MYSQL_SERVER",
|
||||
"A MySQL Server hostname or IP with no slaves setup"
|
||||
);
|
||||
my $mysqlsocket = getTestParameter(
|
||||
"NP_MYSQL_SOCKET",
|
||||
"A MySQL Server socket with no slaves setup"
|
||||
my $mysqlsocket = getTestParameter(
|
||||
"NP_MYSQL_SOCKET",
|
||||
"Full path to a MySQL Server socket with no slaves setup"
|
||||
);
|
||||
my $mysql_login_details = getTestParameter(
|
||||
"MYSQL_LOGIN_DETAILS",
|
||||
"Command line parameters to specify login access",
|
||||
"-u user -ppw -d db",
|
||||
my $mysql_login_details = getTestParameter(
|
||||
"MYSQL_LOGIN_DETAILS",
|
||||
"Command line parameters to specify login access (requires " .
|
||||
"REPLICATION CLIENT privleges)",
|
||||
"-u test -ptest",
|
||||
);
|
||||
my $with_slave = getTestParameter(
|
||||
"NP_MYSQL_WITH_SLAVE",
|
||||
my $with_slave = getTestParameter(
|
||||
"NP_MYSQL_WITH_SLAVE",
|
||||
"MySQL server with slaves setup"
|
||||
);
|
||||
my $with_slave_login = getTestParameter(
|
||||
"NP_MYSQL_WITH_SLAVE_LOGIN",
|
||||
"Login details for server with slave",
|
||||
"-uroot -ppw"
|
||||
my $with_slave_login = getTestParameter(
|
||||
"NP_MYSQL_WITH_SLAVE_LOGIN",
|
||||
"Login details for server with slave (requires REPLICATION CLIENT " .
|
||||
"privleges)",
|
||||
$mysql_login_details || "-u test -ptest"
|
||||
);
|
||||
|
||||
my $result;
|
||||
|
|
|
@ -23,12 +23,12 @@ my $no_ntp_service = getTestParameter( "NP_NO_NTP_SERVICE",
|
|||
"A host NOT providing the NTP service",
|
||||
"localhost" );
|
||||
|
||||
my $host_nonresponsive = getTestParameter( "NP_HOST_NONRESPONSIVE",
|
||||
my $host_nonresponsive = getTestParameter( "NP_HOST_NONRESPONSIVE",
|
||||
"The hostname of system not responsive to network requests",
|
||||
"10.0.0.1" );
|
||||
|
||||
my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID",
|
||||
"An invalid (not known to DNS) hostname",
|
||||
my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID",
|
||||
"An invalid (not known to DNS) hostname",
|
||||
"nosuchhost");
|
||||
|
||||
my $ntp_okmatch1 = '/^NTP\sOK:\sOffset\s-?[0-9]+(\.[0-9]+)?(e-[0-9]{2})?\ssecs/';
|
||||
|
@ -43,7 +43,7 @@ my $ntp_nosuchhost = '/^check_ntp.*: Invalid hostname/address - ' . $hostname_in
|
|||
|
||||
foreach my $plugin (@PLUGINS1) {
|
||||
SKIP: {
|
||||
skip "No NTP server defined", 1 unless $ntp_service;
|
||||
skip "No NTP server defined", 6 unless $ntp_service;
|
||||
$res = NPTest->testCmd(
|
||||
"./$plugin -H $ntp_service -w 1000 -c 2000"
|
||||
);
|
||||
|
@ -88,7 +88,7 @@ foreach my $plugin (@PLUGINS1) {
|
|||
|
||||
foreach my $plugin (@PLUGINS2) {
|
||||
SKIP: {
|
||||
skip "No NTP server defined", 1 unless $ntp_service;
|
||||
skip "No NTP server defined", 6 unless $ntp_service;
|
||||
$res = NPTest->testCmd(
|
||||
"./$plugin -H $ntp_service -w 1000 -c 2000 -W 20 -C 21 -j 100000 -k 200000 -m 1: -n 0:"
|
||||
);
|
||||
|
|
|
@ -13,7 +13,7 @@ my $t;
|
|||
if (`uname -s` eq "SunOS\n" && ! -x "/usr/local/nagios/libexec/pst3") {
|
||||
plan skip_all => "Ignoring tests on solaris because of pst3";
|
||||
} else {
|
||||
plan tests => 12;
|
||||
plan tests => 14;
|
||||
}
|
||||
|
||||
my $result;
|
||||
|
@ -26,6 +26,11 @@ $result = NPTest->testCmd( "./check_procs -w 100000 -c 100000 -s Z" );
|
|||
is( $result->return_code, 0, "Checking less than 100000 zombie processes" );
|
||||
like( $result->output, '/^PROCS OK: [0-9]+ process(es)? with /', "Output correct" );
|
||||
|
||||
if(fork() == 0) { exec("sleep 7"); } else { sleep(1) } # fork a test process in child and give child time to fork in parent
|
||||
$result = NPTest->testCmd( "./check_procs -a 'sleep 7'" );
|
||||
is( $result->return_code, 0, "Parent process is ignored" );
|
||||
like( $result->output, '/^PROCS OK: 1 process?/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "./check_procs -w 0 -c 100000" );
|
||||
is( $result->return_code, 1, "Checking warning if processes > 0" );
|
||||
like( $result->output, '/^PROCS WARNING: [0-9]+ process(es)? | procs=[0-9]+;0;100000;0;$/', "Output correct" );
|
||||
|
|
|
@ -10,7 +10,7 @@ use NPTest;
|
|||
|
||||
BEGIN {
|
||||
plan skip_all => 'check_snmp is not compiled' unless -x "./check_snmp";
|
||||
plan tests => 60;
|
||||
plan tests => 61;
|
||||
}
|
||||
|
||||
my $res;
|
||||
|
@ -26,6 +26,7 @@ my $host_nonresponsive = getTestParameter( "host_nonresponsive", "NP_HOST_NONRES
|
|||
|
||||
my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost",
|
||||
"An invalid (not known to DNS) hostname" );
|
||||
my $user_snmp = getTestParameter( "user_snmp", "NP_SNMP_USER", "auth_md5", "An SNMP user");
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -t 1" );
|
||||
is( $res->return_code, 3, "No host name" );
|
||||
|
@ -35,7 +36,7 @@ $res = NPTest->testCmd( "./check_snmp -H fakehostname" );
|
|||
is( $res->return_code, 3, "No OIDs specified" );
|
||||
is( $res->output, "No OIDs specified" );
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H fakehost -o oids -P 3 --seclevel=rubbish" );
|
||||
$res = NPTest->testCmd( "./check_snmp -H fakehost -o oids -P 3 -U not_a_user --seclevel=rubbish" );
|
||||
is( $res->return_code, 3, "Invalid seclevel" );
|
||||
like( $res->output, "/check_snmp: Invalid seclevel - rubbish/" );
|
||||
|
||||
|
@ -44,7 +45,7 @@ is( $res->return_code, 3, "Invalid protocol" );
|
|||
like( $res->output, "/check_snmp: Invalid SNMP version - 3c/" );
|
||||
|
||||
SKIP: {
|
||||
skip "no snmp host defined", 38 if ( ! $host_snmp );
|
||||
skip "no snmp host defined", 48 if ( ! $host_snmp );
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:");
|
||||
cmp_ok( $res->return_code, '==', 0, "Exit OK when querying uptime" );
|
||||
|
@ -154,6 +155,12 @@ SKIP: {
|
|||
like($res->output, '/^SNMP OK - Timeticks:\s\(\d+\)\s+(?:\d+ days?,\s+)?\d+:\d+:\d+\.\d+\s.*$/', "Timetick used as a string, result printed rather than parsed");
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
skip "no SNMP user defined", 1 if ( ! $user_snmp );
|
||||
$res = NPTest->testCmd( "./check_snmp -H $host_snmp -o HOST-RESOURCES-MIB::hrSystemUptime.0 -P 3 -U $user_snmp -L noAuthNoPriv");
|
||||
like( $res->output, '/^SNMP OK - Timeticks:\s\(\d+\)\s+(?:\d+ days?,\s+)?\d+:\d+:\d+\.\d+\s.*$/', "noAuthNoPriv security level works properly" );
|
||||
}
|
||||
|
||||
# These checks need a complete command line. An invalid community is used so
|
||||
# the tests can run on hosts w/o snmp host/community in NPTest.cache. Execution will fail anyway
|
||||
SKIP: {
|
||||
|
|
|
@ -12,7 +12,6 @@ BEGIN {
|
|||
use NPTest;
|
||||
$has_ipv6 = NPTest::has_ipv6();
|
||||
$tests = $has_ipv6 ? 14 : 11;
|
||||
plan tests => $tests;
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,20 +24,29 @@ my $host_nonresponsive = getTestParameter( "host_nonresponsive", "NP_HOST_NONRES
|
|||
my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost",
|
||||
"An invalid (not known to DNS) hostname" );
|
||||
|
||||
my $internet_access = getTestParameter( "NP_INTERNET_ACCESS",
|
||||
"Is this system directly connected to the internet?",
|
||||
"yes");
|
||||
|
||||
my $successOutput = '/^TCP OK\s-\s+[0-9]?\.?[0-9]+ second response time on port [0-9]+/';
|
||||
|
||||
my $failedExpect = '/^TCP WARNING\s-\sUnexpected response from host/socket on port [0-9]+/';
|
||||
|
||||
my $t;
|
||||
|
||||
$tests = $tests - 4 if $internet_access eq "no";
|
||||
plan tests => $tests;
|
||||
|
||||
$t += checkCmd( "./check_tcp $host_tcp_http -p 80 -wt 300 -ct 600", 0, $successOutput );
|
||||
$t += checkCmd( "./check_tcp $host_tcp_http -p 81 -wt 0 -ct 0 -to 1", 2 ); # use invalid port for this test
|
||||
$t += checkCmd( "./check_tcp $host_nonresponsive -p 80 -wt 0 -ct 0 -to 1", 2 );
|
||||
$t += checkCmd( "./check_tcp $hostname_invalid -p 80 -wt 0 -ct 0 -to 1", 2 );
|
||||
$t += checkCmd( "./check_tcp -S -D 1 -H www.verisign.com -p 443", 0 );
|
||||
$t += checkCmd( "./check_tcp -S -D 9000,1 -H www.verisign.com -p 443", 1 );
|
||||
$t += checkCmd( "./check_tcp -S -D 9000 -H www.verisign.com -p 443", 1 );
|
||||
$t += checkCmd( "./check_tcp -S -D 9000,8999 -H www.verisign.com -p 443", 2 );
|
||||
if($internet_access ne "no") {
|
||||
$t += checkCmd( "./check_tcp -S -D 1 -H www.verisign.com -p 443", 0 );
|
||||
$t += checkCmd( "./check_tcp -S -D 9000,1 -H www.verisign.com -p 443", 1 );
|
||||
$t += checkCmd( "./check_tcp -S -D 9000 -H www.verisign.com -p 443", 1 );
|
||||
$t += checkCmd( "./check_tcp -S -D 9000,8999 -H www.verisign.com -p 443", 2 );
|
||||
}
|
||||
|
||||
# Need the \r\n to make it more standards compliant with web servers. Need the various quotes
|
||||
# so that perl doesn't interpret the \r\n and is passed onto command line correctly
|
||||
|
|
|
@ -62,7 +62,7 @@ SKIP: {
|
|||
cmp_ok( $res->return_code, '==', '2', "Hung waiting for response");
|
||||
like ( $res->output, '/Socket timeout after 5 seconds/', "Timeout message");
|
||||
like ( $duration, '/^[56]$/', "Timeout after 5 (possibly 6) seconds");
|
||||
my $read_nc = <NC>;
|
||||
my $read_nc = <NC> || '';
|
||||
close NC;
|
||||
cmp_ok( $read_nc, 'eq', "foofoo", "Data received correctly" );
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ foreach my $current_state (keys(%state)) {
|
|||
}
|
||||
}
|
||||
|
||||
# Same as aboce with substitute
|
||||
# Same as above with substitute
|
||||
foreach my $current_state (keys(%state)) {
|
||||
foreach my $new_state (keys(%state)) {
|
||||
$res = NPTest->testCmd( "./negate -s --$current_state=$new_state ./check_dummy ".$state{$current_state}." 'Fake $new_state'" );
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# Country Name (2 letter code) [AU]:UK
|
||||
# State or Province Name (full name) [Some-State]:Derbyshire
|
||||
# Locality Name (eg, city) []:Belper
|
||||
# Organization Name (eg, company) [Internet Widgits Pty Ltd]:Nagios Plugins
|
||||
# Organization Name (eg, company) [Internet Widgits Pty Ltd]:Monitoring Plugins
|
||||
# Organizational Unit Name (eg, section) []:
|
||||
# Common Name (eg, YOUR name) []:Ton Voon
|
||||
# Email Address []:tonvoon@mac.com
|
||||
|
@ -20,8 +20,9 @@ use FindBin qw($Bin);
|
|||
my $common_tests = 70;
|
||||
my $ssl_only_tests = 8;
|
||||
# Check that all dependent modules are available
|
||||
eval "use HTTP::Daemon 6.01;";
|
||||
plan skip_all => 'HTTP::Daemon >= 6.01 required' if $@;
|
||||
eval {
|
||||
require HTTP::Daemon;
|
||||
require HTTP::Status;
|
||||
require HTTP::Response;
|
||||
};
|
||||
|
@ -392,27 +393,21 @@ sub run_common_tests {
|
|||
skip "This doesn't seems to work all the time", 1 unless ($ENV{HTTP_EXTERNAL});
|
||||
$cmd = "$command -f follow -u /redir_external -t 5";
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { die "alarm\n" };
|
||||
alarm(2);
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
alarm(0); };
|
||||
is( $@, "alarm\n", $cmd );
|
||||
$result = NPTest->testCmd( $cmd, 2 );
|
||||
};
|
||||
like( $@, "/timeout in command: $cmd/", $cmd );
|
||||
}
|
||||
|
||||
$cmd = "$command -u /timeout -t 5";
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { die "alarm\n" };
|
||||
alarm(2);
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
alarm(0); };
|
||||
is( $@, "alarm\n", $cmd );
|
||||
$result = NPTest->testCmd( $cmd, 2 );
|
||||
};
|
||||
like( $@, "/timeout in command: $cmd/", $cmd );
|
||||
|
||||
$cmd = "$command -f follow -u /redir_timeout -t 2";
|
||||
eval {
|
||||
local $SIG{ALRM} = sub { die "alarm\n" };
|
||||
alarm(5);
|
||||
$result = NPTest->testCmd( $cmd );
|
||||
alarm(0); };
|
||||
isnt( $@, "alarm\n", $cmd );
|
||||
$result = NPTest->testCmd( $cmd, 5 );
|
||||
};
|
||||
is( $@, "", $cmd );
|
||||
|
||||
}
|
||||
|
|
85
plugins/tests/check_procs.t
Normal file → Executable file
85
plugins/tests/check_procs.t
Normal file → Executable file
|
@ -18,59 +18,68 @@ my $command = "./check_procs --input-file=tests/var/ps-axwo.darwin";
|
|||
|
||||
$result = NPTest->testCmd( "$command" );
|
||||
is( $result->return_code, 0, "Run with no options" );
|
||||
like( $result->output, '/^PROCS OK: 95 processes$/', "Output correct" );
|
||||
is( $result->output, "PROCS OK: 95 processes | procs=95;;;0;", "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -w 5" );
|
||||
is( $result->return_code, 1, "Checking > 5 processes" );
|
||||
like( $result->output, '/^PROCS WARNING: 95 processes$/', "Output correct" );
|
||||
is( $result->output, "PROCS WARNING: 95 processes | procs=95;5;;0;", "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -w 4 -c 44" );
|
||||
is( $result->return_code, 2, "Checking critical" );
|
||||
like( $result->output, '/^PROCS CRITICAL: 95 processes$/', "Output correct" );
|
||||
is( $result->output, "PROCS CRITICAL: 95 processes | procs=95;4;44;0;", "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -w 100 -c 200" );
|
||||
is( $result->return_code, 0, "Checking no threshold breeched" );
|
||||
like( $result->output, '/^PROCS OK: 95 processes$/', "Output correct" );
|
||||
is( $result->output, "PROCS OK: 95 processes | procs=95;100;200;0;", "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -C launchd -c 5" );
|
||||
is( $result->return_code, 2, "Checking processes filtered by command name" );
|
||||
like( $result->output, '/^PROCS CRITICAL: 6 processes with command name \'launchd\'$/', "Output correct" );
|
||||
is( $result->output, "PROCS CRITICAL: 6 processes with command name 'launchd' | procs=6;;5;0;", "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -u 501 -w 39 -c 41" );
|
||||
is( $result->return_code, 1, "Checking processes filtered by userid" );
|
||||
like( $result->output, '/^PROCS WARNING: 40 processes with UID = 501 (.*)$/', "Output correct" );
|
||||
SKIP: {
|
||||
skip 'user with uid 501 required', 4 unless getpwuid(501);
|
||||
|
||||
$result = NPTest->testCmd( "$command -C launchd -u 501" );
|
||||
is( $result->return_code, 0, "Checking processes filtered by command name and userid" );
|
||||
like( $result->output, '/^PROCS OK: 1 process with command name \'launchd\', UID = 501 (.*)$/', "Output correct" );
|
||||
$result = NPTest->testCmd( "$command -u 501 -w 39 -c 41" );
|
||||
is( $result->return_code, 1, "Checking processes filtered by userid" );
|
||||
like( $result->output, '/^PROCS WARNING: 40 processes with UID = 501 (.*)$/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -u -2 -w 2:2" );
|
||||
is( $result->return_code, 1, "Checking processes with userid=-2" );
|
||||
like( $result->output, '/^PROCS WARNING: 3 processes with UID = -2 \(nobody\)$/', "Output correct" );
|
||||
$result = NPTest->testCmd( "$command -C launchd -u 501" );
|
||||
is( $result->return_code, 0, "Checking processes filtered by command name and userid" );
|
||||
like( $result->output, '/^PROCS OK: 1 process with command name \'launchd\', UID = 501 (.*)$/', "Output correct" );
|
||||
}
|
||||
|
||||
$result = NPTest->testCmd( "$command -u -2 -w 3:3" );
|
||||
is( $result->return_code, 0, "Checking processes with userid=-2 past threshold" );
|
||||
like( $result->output, '/^PROCS OK: 3 processes with UID = -2 \(nobody\)$/', "Output correct" );
|
||||
SKIP: {
|
||||
skip 'user with uid -2 required', 8 unless getpwuid(-2);
|
||||
skip 'uid -2 must have name "nobody"', 8 unless getpwuid(-2) eq 'nobody';
|
||||
|
||||
$result = NPTest->testCmd( "$command -u -2 -a usb" );
|
||||
is( $result->return_code, 0, "Checking processes with userid=-2 and usb in arguments" );
|
||||
like( $result->output, '/^PROCS OK: 1 process with UID = -2 \(nobody\), args \'usb\'/', "Output correct" );
|
||||
$result = NPTest->testCmd( "$command -u -2 -w 2:2" );
|
||||
is( $result->return_code, 1, "Checking processes with userid=-2" );
|
||||
like( $result->output, '/^PROCS WARNING: 3 processes with UID = -2 \(nobody\)$/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -u -2 -a UsB" );
|
||||
is( $result->return_code, 0, "Checking case sensitivity of args" );
|
||||
like( $result->output, '/^PROCS OK: 0 processes with UID = -2 \(nobody\), args \'UsB\'/', "Output correct" );
|
||||
$result = NPTest->testCmd( "$command -u -2 -w 3:3" );
|
||||
is( $result->return_code, 0, "Checking processes with userid=-2 past threshold" );
|
||||
like( $result->output, '/^PROCS OK: 3 processes with UID = -2 \(nobody\)$/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -u -2 -a usb" );
|
||||
is( $result->return_code, 0, "Checking processes with userid=-2 and usb in arguments" );
|
||||
like( $result->output, '/^PROCS OK: 1 process with UID = -2 \(nobody\), args \'usb\'/', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -u -2 -a UsB" );
|
||||
is( $result->return_code, 0, "Checking case sensitivity of args" );
|
||||
like( $result->output, '/^PROCS OK: 0 processes with UID = -2 \(nobody\), args \'UsB\'/', "Output correct" );
|
||||
};
|
||||
|
||||
$result = NPTest->testCmd( "$command --ereg-argument-array='mdworker.*501'" );
|
||||
is( $result->return_code, 0, "Checking regexp search of arguments" );
|
||||
is( $result->output, "PROCS OK: 1 process with regex args 'mdworker.*501'", "Output correct" );
|
||||
is( $result->output, "PROCS OK: 1 process with regex args 'mdworker.*501' | procs=1;;;0;", "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command --vsz 1000000" );
|
||||
is( $result->return_code, 0, "Checking filter by VSZ" );
|
||||
like( $result->output, '/^PROCS OK: 24 processes with VSZ >= 1000000$/', "Output correct" );
|
||||
is( $result->output, 'PROCS OK: 24 processes with VSZ >= 1000000 | procs=24;;;0;', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command --rss 100000" );
|
||||
is( $result->return_code, 0, "Checking filter by RSS" );
|
||||
like( $result->output, '/^PROCS OK: 3 processes with RSS >= 100000$/', "Output correct" );
|
||||
is( $result->output, 'PROCS OK: 3 processes with RSS >= 100000 | procs=3;;;0;', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -s S" );
|
||||
is( $result->return_code, 0, "Checking filter for sleeping processes" );
|
||||
|
@ -86,34 +95,38 @@ like( $result->output, '/^PROCS CRITICAL: 39 processes with PPID = 1/', "Output
|
|||
|
||||
$result = NPTest->testCmd( "$command -P 0.71" );
|
||||
is( $result->return_code, 0, "Checking filter for percentage cpu > 0.71" );
|
||||
is( $result->output, 'PROCS OK: 7 processes with PCPU >= 0.71', "Output correct" );
|
||||
is( $result->output, 'PROCS OK: 7 processes with PCPU >= 0.71 | procs=7;;;0;', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command -P 0.70" );
|
||||
is( $result->return_code, 0, "Checking filter for percentage cpu > 0.70" );
|
||||
is( $result->output, 'PROCS OK: 8 processes with PCPU >= 0.70', "Output correct" );
|
||||
is( $result->output, 'PROCS OK: 8 processes with PCPU >= 0.70 | procs=8;;;0;', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command --metric=CPU -w 8" );
|
||||
is( $result->return_code, 1, "Checking against metric of CPU > 8" );
|
||||
is( $result->output, 'CPU WARNING: 1 warn out of 95 processes', "Output correct" );
|
||||
is( $result->output, 'CPU WARNING: 1 warn out of 95 processes | procs=95;;;0; procs_warn=1;;;0; procs_crit=0;;;0;', "Output correct" );
|
||||
|
||||
# TODO: Because of a conversion to int, if CPU is 1.45%, will not alert, but 2.01% will.
|
||||
$result = NPTest->testCmd( "$command --metric=CPU -w 1 -u 501 -v" );
|
||||
is( $result->return_code, 1, "Checking against metric of CPU > 1 with uid=501 - TODO" );
|
||||
is( $result->output, 'CPU WARNING: 2 warn out of 40 processes with UID = 501 (tonvoon) [Skype, PubSubAgent]', "Output correct" );
|
||||
SKIP: {
|
||||
skip 'user with uid 501 required', 2 unless getpwuid(501);
|
||||
|
||||
$result = NPTest->testCmd( "$command --metric=CPU -w 1 -u 501 -v" );
|
||||
is( $result->return_code, 1, "Checking against metric of CPU > 1 with uid=501 - TODO" );
|
||||
is( $result->output, 'CPU WARNING: 2 warn out of 40 processes with UID = 501 (tonvoon) [Skype, PubSubAgent]', "Output correct" );
|
||||
};
|
||||
|
||||
$result = NPTest->testCmd( "$command --metric=VSZ -w 1200000 -v" );
|
||||
is( $result->return_code, 1, "Checking against VSZ > 1.2GB" );
|
||||
is( $result->output, 'VSZ WARNING: 4 warn out of 95 processes [WindowServer, Safari, Mail, Skype]', "Output correct" );
|
||||
is( $result->output, 'VSZ WARNING: 4 warn out of 95 processes [WindowServer, Safari, Mail, Skype] | procs=95;;;0; procs_warn=4;;;0; procs_crit=0;;;0;', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command --metric=VSZ -w 1200000 -v" );
|
||||
is( $result->return_code, 1, "Checking against VSZ > 1.2GB" );
|
||||
is( $result->output, 'VSZ WARNING: 4 warn out of 95 processes [WindowServer, Safari, Mail, Skype]', "Output correct" );
|
||||
is( $result->output, 'VSZ WARNING: 4 warn out of 95 processes [WindowServer, Safari, Mail, Skype] | procs=95;;;0; procs_warn=4;;;0; procs_crit=0;;;0;', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command --metric=RSS -c 70000 -v" );
|
||||
is( $result->return_code, 2, "Checking against RSS > 70MB" );
|
||||
is( $result->output, 'RSS CRITICAL: 5 crit, 0 warn out of 95 processes [WindowServer, SystemUIServer, Safari, Mail, Safari]', "Output correct" );
|
||||
is( $result->output, 'RSS CRITICAL: 5 crit, 0 warn out of 95 processes [WindowServer, SystemUIServer, Safari, Mail, Safari] | procs=95;;;0; procs_warn=0;;;0; procs_crit=5;;;0;', "Output correct" );
|
||||
|
||||
$result = NPTest->testCmd( "$command --ereg-argument-array='(nosuchname|nosuch2name)'" );
|
||||
is( $result->return_code, 0, "Checking no pipe symbol in output" );
|
||||
is( $result->output, "PROCS OK: 0 processes with regex args '(nosuchname,nosuch2name)'", "Output correct" );
|
||||
is( $result->output, "PROCS OK: 0 processes with regex args '(nosuchname,nosuch2name)' | procs=0;;;0;", "Output correct" );
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ use Test::More;
|
|||
use NPTest;
|
||||
use FindBin qw($Bin);
|
||||
|
||||
my $tests = 53;
|
||||
my $tests = 67;
|
||||
# Check that all dependent modules are available
|
||||
eval {
|
||||
require NetSNMP::OID;
|
||||
|
@ -59,7 +59,7 @@ if ($ARGV[0] && $ARGV[0] eq "-d") {
|
|||
}
|
||||
|
||||
# We should merge that with $ENV{'NPTEST_CACHE'}, use one dir for all test data
|
||||
$ENV{'NAGIOS_PLUGIN_STATE_DIRECTORY'} ||= "/var/tmp";
|
||||
$ENV{'MP_STATE_PATH'} ||= "/var/tmp";
|
||||
|
||||
my $res;
|
||||
|
||||
|
@ -79,7 +79,7 @@ Copyright (c) 1986-2004 by cisco Systems, Inc.
|
|||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.0 -o sysContact.0 -o .1.3.6.1.4.1.8072.3.2.67.1");
|
||||
cmp_ok( $res->return_code, '==', 0, "Exit OK when querying multi-line OIDs" );
|
||||
like($res->output, '/^SNMP OK - /', "String contains SNMP OK");
|
||||
like($res->output, '/'.quotemeta('SNMP OK - Cisco Internetwork Operating System Software Alice Kisco Outernetwork Oserating Gystem Totware |
|
||||
like($res->output, '/'.quotemeta('SNMP OK - Cisco Internetwork Operating System Software ').'"?Alice"?'.quotemeta(' Kisco Outernetwork Oserating Gystem Totware |
|
||||
.1.3.6.1.4.1.8072.3.2.67.0:
|
||||
"Cisco Internetwork Operating System Software
|
||||
IOS (tm) Catalyst 4000 \"L3\" Switch Software (cat4000-I9K91S-M), Version
|
||||
|
@ -109,7 +109,7 @@ like($res->output, '/'.quotemeta('SNMP OK - And now have fun with with this: \"C
|
|||
"And now have fun with with this: \"C:\\\\\"
|
||||
because we\'re not done yet!"').'/m', "Attempt to confuse parser No.3");
|
||||
|
||||
system("rm -f ".$ENV{'NAGIOS_PLUGIN_STATE_DIRECTORY'}."/check_snmp/*");
|
||||
system("rm -f ".$ENV{'MP_STATE_PATH'}."/check_snmp/*");
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -w 600" );
|
||||
is($res->return_code, 0, "Returns OK");
|
||||
is($res->output, "No previous data to calculate rate - assume okay");
|
||||
|
@ -214,3 +214,31 @@ $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1
|
|||
is($res->return_code, 0, "String check should check whole string, not a parsed number" );
|
||||
is($res->output, 'SNMP OK - "CUSTOM CHECK OK: foo is 12345" | ', "String check witn numbers returns whole string");
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.16 -w -2: -c -3:" );
|
||||
is($res->return_code, 0, "Negative integer check OK" );
|
||||
is($res->output, 'SNMP OK - -2 | iso.3.6.1.4.1.8072.3.2.67.16=-2 ', "Negative integer check OK output" );
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.16 -w -2: -c -3:" );
|
||||
is($res->return_code, 1, "Negative integer check WARNING" );
|
||||
is($res->output, 'SNMP WARNING - *-3* | iso.3.6.1.4.1.8072.3.2.67.16=-3 ', "Negative integer check WARNING output" );
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.16 -w -2: -c -3:" );
|
||||
is($res->return_code, 2, "Negative integer check CRITICAL" );
|
||||
is($res->output, 'SNMP CRITICAL - *-4* | iso.3.6.1.4.1.8072.3.2.67.16=-4 ', "Negative integer check CRITICAL output" );
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.17 -w -3: -c -6:" );
|
||||
is($res->return_code, 1, "Negative integer as string, WARNING" );
|
||||
is($res->output, 'SNMP WARNING - *-4* | iso.3.6.1.4.1.8072.3.2.67.17=-4 ', "Negative integer as string, WARNING output" );
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.17 -w -2: -c -3:" );
|
||||
is($res->return_code, 2, "Negative integer as string, CRITICAL" );
|
||||
is($res->output, 'SNMP CRITICAL - *-4* | iso.3.6.1.4.1.8072.3.2.67.17=-4 ', "Negative integer as string, CRITICAL output" );
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.18 -c ~:-6.5" );
|
||||
is($res->return_code, 0, "Negative float OK" );
|
||||
is($res->output, 'SNMP OK - -6.6 | iso.3.6.1.4.1.8072.3.2.67.18=-6.6 ', "Negative float OK output" );
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.18 -w ~:-6.65 -c ~:-6.55" );
|
||||
is($res->return_code, 1, "Negative float WARNING" );
|
||||
is($res->output, 'SNMP WARNING - *-6.6* | iso.3.6.1.4.1.8072.3.2.67.18=-6.6 ', "Negative float WARNING output" );
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
use NetSNMP::OID qw(:all);
|
||||
use NetSNMP::agent;
|
||||
use NetSNMP::ASN qw(ASN_OCTET_STR ASN_COUNTER ASN_COUNTER64 ASN_INTEGER ASN_INTEGER64 ASN_UNSIGNED ASN_UNSIGNED64);
|
||||
#use Math::Int64 qw(uint64); # Skip that module whie we don't need it
|
||||
#use Math::Int64 qw(uint64); # Skip that module while we don't need it
|
||||
sub uint64 { return $_ }
|
||||
|
||||
if (!$agent) {
|
||||
|
@ -16,8 +16,6 @@ if (!$agent) {
|
|||
}
|
||||
|
||||
my $baseoid = '.1.3.6.1.4.1.8072.3.2.67';
|
||||
# Next are arrays of indexes (Type, initial value and increments)
|
||||
# Undef miltipliers are randomized
|
||||
my $multiline = 'Cisco Internetwork Operating System Software
|
||||
IOS (tm) Catalyst 4000 "L3" Switch Software (cat4000-I9K91S-M), Version
|
||||
12.2(20)EWA, RELEASE SOFTWARE (fc1)
|
||||
|
@ -33,10 +31,12 @@ ends with with this: C:\\';
|
|||
my $multilin5 = 'And now have fun with with this: "C:\\"
|
||||
because we\'re not done yet!';
|
||||
|
||||
# 0..15 <---- please update comment when adding/removing fields
|
||||
my @fields = (ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_UNSIGNED, ASN_UNSIGNED, ASN_COUNTER, ASN_COUNTER64, ASN_UNSIGNED, ASN_COUNTER, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR );
|
||||
my @values = ($multiline, $multilin2, $multilin3, $multilin4, $multilin5, 4294965296, 1000, 4294965296, uint64("18446744073709351616"), int(rand(2**32)), 64000, "stringtests", "3.5", "87.4startswithnumberbutshouldbestring", '555"I said"', 'CUSTOM CHECK OK: foo is 12345' );
|
||||
my @incrts = (undef, undef, undef, undef, undef, 1000, -500, 1000, 100000, undef, 666, undef, undef, undef, undef, undef );
|
||||
# Next are arrays of indexes (Type, initial value and increments)
|
||||
# 0..16 <---- please update comment when adding/removing fields
|
||||
my @fields = (ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_UNSIGNED, ASN_UNSIGNED, ASN_COUNTER, ASN_COUNTER64, ASN_UNSIGNED, ASN_COUNTER, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_INTEGER, ASN_OCTET_STR, ASN_OCTET_STR );
|
||||
my @values = ($multiline, $multilin2, $multilin3, $multilin4, $multilin5, 4294965296, 1000, 4294965296, uint64("18446744073709351616"), int(rand(2**32)), 64000, "stringtests", "3.5", "87.4startswithnumberbutshouldbestring", '555"I said"', 'CUSTOM CHECK OK: foo is 12345', -2, '-4', '-6.6' );
|
||||
# undef increments are randomized
|
||||
my @incrts = (undef, undef, undef, undef, undef, 1000, -500, 1000, 100000, undef, 666, undef, undef, undef, undef, undef, -1, undef, undef );
|
||||
|
||||
# Number of elements in our OID
|
||||
my $oidelts;
|
||||
|
|
|
@ -31,7 +31,7 @@ S 0 6907 1 2308 892 0.0 mysqld_safe /bin/sh /usr/bin/mysqld_
|
|||
S 103 6944 6907 123220 27724 0.0 mysqld /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
|
||||
S 0 6945 6907 1488 420 0.0 logger logger -p daemon.err -t mysqld_safe -i -t mysqld
|
||||
S 1001 17778 1 6436 1588 0.0 snmpd /usr/sbin/snmpd -u nagios -Lsd -Lf /dev/null -p/var/run/snmpd.pid
|
||||
Ss 0 17789 1 9496 5556 0.0 snmptrapd /usr/sbin/snmptrapd -t -m ALL -M /usr/share/snmp/mibs:/usr/local/nagios/snmp/load -p /var/run/snmptrapd.pid
|
||||
Ss 0 17789 1 9496 5556 0.0 snmptrapd /usr/sbin/snmptrapd -t -m ALL -M /usr/share/snmp/mibs:/usr/local/monitoring/snmp/load -p /var/run/snmptrapd.pid
|
||||
Ss 0 847 2319 14452 1752 0.0 sshd sshd: tonvoon [priv]
|
||||
S 1000 857 847 14616 1832 0.0 sshd sshd: tonvoon@pts/3
|
||||
Ss 1000 860 857 2984 1620 0.0 bash -bash
|
||||
|
@ -79,6 +79,6 @@ Ss 1001 23783 1 3220 764 0.0 ndo2db /usr/local/nagios/bin/nd
|
|||
Ss 1001 23784 1 6428 4948 0.0 import_ndologsd import_ndologsd
|
||||
S+ 1001 9803 18955 4132 1936 0.0 ssh ssh altinity@cube02.lei.altinity
|
||||
S 1001 22505 22324 20256 1616 0.0 nagios ../../bin/nagios -d /usr/local/nagios/etc/nagios.cfg
|
||||
S 1001 22506 22505 1676 608 0.0 check_ping /usr/local/nagios/libexec/check_ping -H 192.168.10.23 -w 3000.0,80% -c 5000.0,100% -p 1
|
||||
S 1001 22506 22505 1676 608 0.0 check_ping /usr/local/libexec/check_ping -H 192.168.10.23 -w 3000.0,80% -c 5000.0,100% -p 1
|
||||
S 1001 22507 22506 1660 492 0.0 ping /bin/ping -n -U -w 10 -c 1 192.168.10.23
|
||||
R+ 1001 22508 23370 2308 680 0.0 ps ps axwo stat uid pid ppid vsz rss pcpu comm args
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
/*****************************************************************************
|
||||
*
|
||||
* Nagios urlize plugin
|
||||
* Monitoring urlize plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2000-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 2000-2007 Monitoring Plugins Development Team
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This file contains the urlize plugin
|
||||
*
|
||||
* This plugin wraps the text output of another command (plugin) in HTML <A>
|
||||
* tags, thus displaying the child plugin's output as a clickable link in the
|
||||
* Nagios status screen. This plugin returns the status of the invoked plugin.
|
||||
* tags. This plugin returns the status of the invoked plugin.
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
@ -32,7 +31,7 @@
|
|||
|
||||
const char *progname = "urlize";
|
||||
const char *copyright = "2000-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
const char *email = "devel@monitoring-plugins.org";
|
||||
|
||||
#include "common.h"
|
||||
#include "utils.h"
|
||||
|
@ -166,9 +165,9 @@ print_help (void)
|
|||
printf ("Copyright (c) 2000 Karl DeBisschop <kdebisschop@users.sourceforge.net>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
||||
printf ("%s\n", _("This plugin wraps the text output of another command (plugin)"));
|
||||
printf ("%s\n", _("in HTML <A> tags, thus displaying the child plugin's output as a clickable link in"));
|
||||
printf ("%s\n", _("the Nagios status screen. This plugin returns the status of the invoked plugin."));
|
||||
printf ("%s\n", _("This plugin wraps the text output of another command (plugin) in HTML <A>"));
|
||||
printf ("%s\n", _("tags, thus displaying the child plugin's output as a clickable link in compatible"));
|
||||
printf ("%s\n", _("monitoring status screen. This plugin returns the status of the invoked plugin."));
|
||||
|
||||
printf ("\n\n");
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2000 Karl DeBisschop (karl@debisschop.net)
|
||||
* Copyright (c) 2002-2007 Nagios Plugin Development Team
|
||||
* Copyright (c) 2002-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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef NP_UTILS_H
|
||||
#define NP_UTILS_H
|
||||
/* Header file for nagios plugins utils.c */
|
||||
/* Header file for Monitoring Plugins utils.c */
|
||||
|
||||
/* This file should be included in all plugins */
|
||||
|
||||
|
@ -131,7 +131,7 @@ char *fperfdata (const char *,
|
|||
{"warning",required_argument,0,'w'},\
|
||||
{"hostname",required_argument,0,'H'}
|
||||
|
||||
#define COPYRIGHT "Copyright (c) %s Nagios Plugin Development Team\n\
|
||||
#define COPYRIGHT "Copyright (c) %s Monitoring Plugins Development Team\n\
|
||||
\t<%s>\n\n"
|
||||
|
||||
#define UT_HLP_VRS _("\
|
||||
|
@ -159,7 +159,8 @@ char *fperfdata (const char *,
|
|||
|
||||
#define UT_VERBOSE _("\
|
||||
-v, --verbose\n\
|
||||
Show details for command-line debugging (Nagios may truncate output)\n")
|
||||
Show details for command-line debugging (output may be truncated by\n\
|
||||
the monitoring system)\n")
|
||||
|
||||
#define UT_WARN_CRIT _("\
|
||||
-w, --warning=DOUBLE\n\
|
||||
|
@ -173,31 +174,36 @@ char *fperfdata (const char *,
|
|||
-c, --critical=RANGE\n\
|
||||
Critical range\n")
|
||||
|
||||
#define UT_TIMEOUT _("\
|
||||
#define UT_CONN_TIMEOUT _("\
|
||||
-t, --timeout=INTEGER\n\
|
||||
Seconds before connection times out (default: %d)\n")
|
||||
|
||||
#define UT_PLUG_TIMEOUT _("\
|
||||
-t, --timeout=INTEGER\n\
|
||||
Seconds before plugin times out (default: %d)\n")
|
||||
|
||||
#ifdef NP_EXTRA_OPTS
|
||||
#define UT_EXTRA_OPTS _("\
|
||||
--extra-opts=[section][@file]\n\
|
||||
Read options from an ini file. See http://nagiosplugins.org/extra-opts\n\
|
||||
Read options from an ini file. See\n\
|
||||
https://www.monitoring-plugins.org/doc/extra-opts.html\n\
|
||||
for usage and examples.\n")
|
||||
#else
|
||||
#define UT_EXTRA_OPTS ""
|
||||
#define UT_EXTRA_OPTS " \b"
|
||||
#endif
|
||||
|
||||
#define UT_THRESHOLDS_NOTES _("\
|
||||
See:\n\
|
||||
http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT\n\
|
||||
https://www.monitoring-plugins.org/doc/guidelines.html#THRESHOLDFORMAT\n\
|
||||
for THRESHOLD format and examples.\n")
|
||||
|
||||
#define UT_SUPPORT _("\n\
|
||||
Send email to nagios-users@lists.sourceforge.net if you have questions\n\
|
||||
regarding use of this software. To submit patches or suggest improvements,\n\
|
||||
send email to nagiosplug-devel@lists.sourceforge.net\n\n")
|
||||
Send email to help@monitoring-plugins.org if you have questions regarding\n\
|
||||
use of this software. To submit patches or suggest improvements, send email\n\
|
||||
to devel@monitoring-plugins.org\n\n")
|
||||
|
||||
#define UT_NOWARRANTY _("\n\
|
||||
The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n\
|
||||
The Monitoring Plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n\
|
||||
copies of the plugins under the terms of the GNU General Public License.\n\
|
||||
For more information about these matters, see the file named COPYING.\n")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue