Imported Upstream version 1.4.12

This commit is contained in:
Jan Wagner 2013-11-26 23:55:28 +01:00
parent 1d1585cd09
commit 4ab9f0d24c
291 changed files with 27277 additions and 11364 deletions

View file

@ -4,10 +4,11 @@ VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plug
INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl @LDAPINCLUDE@ @PGINCLUDE@ @SSLINCLUDE@
datadir = @datadir@
localedir = $(datadir)/locale
# gettext docs say to use AM_CPPFLAGS, but per module_CPPFLAGS override this
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
LIBS = @LIBINTL@ @LIBS@
# gettext docs say to use LDADD, but per module_LDADD override
LIBS = @LTLIBINTL@ @LIBS@
MATHLIBS = @MATHLIBS@
# This is not portable. Run ". tools/devmode" to get development compile flags

View file

@ -54,36 +54,40 @@ subdir = plugins
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/np_mysqlclient.m4 \
$(top_srcdir)/gl/m4/absolute-header.m4 \
$(top_srcdir)/gl/m4/alloca.m4 \
$(top_srcdir)/gl/m4/arpa_inet_h.m4 \
$(top_srcdir)/gl/m4/c-strtod.m4 $(top_srcdir)/gl/m4/cloexec.m4 \
$(top_srcdir)/gl/m4/codeset.m4 $(top_srcdir)/gl/m4/dirname.m4 \
$(top_srcdir)/gl/m4/dos.m4 \
$(top_srcdir)/gl/m4/base64.m4 $(top_srcdir)/gl/m4/c-strtod.m4 \
$(top_srcdir)/gl/m4/cloexec.m4 $(top_srcdir)/gl/m4/codeset.m4 \
$(top_srcdir)/gl/m4/dirname.m4 $(top_srcdir)/gl/m4/dos.m4 \
$(top_srcdir)/gl/m4/double-slash-root.m4 \
$(top_srcdir)/gl/m4/eoverflow.m4 $(top_srcdir)/gl/m4/error.m4 \
$(top_srcdir)/gl/m4/exitfail.m4 \
$(top_srcdir)/gl/m4/extensions.m4 \
$(top_srcdir)/gl/m4/fcntl-safer.m4 \
$(top_srcdir)/gl/m4/float_h.m4 $(top_srcdir)/gl/m4/floorf.m4 \
$(top_srcdir)/gl/m4/fstypename.m4 \
$(top_srcdir)/gl/m4/fsusage.m4 \
$(top_srcdir)/gl/m4/getaddrinfo.m4 \
$(top_srcdir)/gl/m4/gethostname.m4 \
$(top_srcdir)/gl/m4/getloadavg.m4 \
$(top_srcdir)/gl/m4/getopt.m4 $(top_srcdir)/gl/m4/gettext.m4 \
$(top_srcdir)/gl/m4/glibc21.m4 \
$(top_srcdir)/gl/m4/gnulib-common.m4 \
$(top_srcdir)/gl/m4/gnulib-comp.m4 \
$(top_srcdir)/gl/m4/iconv.m4 $(top_srcdir)/gl/m4/inet_ntop.m4 \
$(top_srcdir)/gl/m4/inline.m4 $(top_srcdir)/gl/m4/intmax_t.m4 \
$(top_srcdir)/gl/m4/iconv.m4 \
$(top_srcdir)/gl/m4/include_next.m4 \
$(top_srcdir)/gl/m4/inet_ntop.m4 $(top_srcdir)/gl/m4/inline.m4 \
$(top_srcdir)/gl/m4/intlmacosx.m4 \
$(top_srcdir)/gl/m4/intmax_t.m4 \
$(top_srcdir)/gl/m4/inttypes_h.m4 \
$(top_srcdir)/gl/m4/lib-ld.m4 $(top_srcdir)/gl/m4/lib-link.m4 \
$(top_srcdir)/gl/m4/lib-prefix.m4 $(top_srcdir)/gl/m4/lock.m4 \
$(top_srcdir)/gl/m4/longdouble.m4 \
$(top_srcdir)/gl/m4/lib-prefix.m4 \
$(top_srcdir)/gl/m4/localcharset.m4 \
$(top_srcdir)/gl/m4/longlong.m4 \
$(top_srcdir)/gl/m4/ls-mntd-fs.m4 \
$(top_srcdir)/gl/m4/mbchar.m4 $(top_srcdir)/gl/m4/mbiter.m4 \
$(top_srcdir)/gl/m4/mbrtowc.m4 $(top_srcdir)/gl/m4/memchr.m4 \
$(top_srcdir)/gl/m4/minmax.m4 $(top_srcdir)/gl/m4/mountlist.m4 \
$(top_srcdir)/gl/m4/malloc.m4 $(top_srcdir)/gl/m4/math_h.m4 \
$(top_srcdir)/gl/m4/mbstate_t.m4 \
$(top_srcdir)/gl/m4/mountlist.m4 \
$(top_srcdir)/gl/m4/netinet_in_h.m4 $(top_srcdir)/gl/m4/nls.m4 \
$(top_srcdir)/gl/m4/onceonly_2_57.m4 $(top_srcdir)/gl/m4/po.m4 \
$(top_srcdir)/gl/m4/progtest.m4 $(top_srcdir)/gl/m4/regex.m4 \
@ -93,21 +97,21 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/np_mysqlclient.m4 \
$(top_srcdir)/gl/m4/snprintf.m4 $(top_srcdir)/gl/m4/socklen.m4 \
$(top_srcdir)/gl/m4/sockpfaf.m4 $(top_srcdir)/gl/m4/ssize_t.m4 \
$(top_srcdir)/gl/m4/stdbool.m4 $(top_srcdir)/gl/m4/stdint.m4 \
$(top_srcdir)/gl/m4/stdint_h.m4 $(top_srcdir)/gl/m4/strcase.m4 \
$(top_srcdir)/gl/m4/strdup.m4 $(top_srcdir)/gl/m4/strndup.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/strdup.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/sys_socket_h.m4 \
$(top_srcdir)/gl/m4/ulonglong.m4 \
$(top_srcdir)/gl/m4/unistd-safer.m4 \
$(top_srcdir)/gl/m4/unistd_h.m4 \
$(top_srcdir)/gl/m4/vasnprintf.m4 \
$(top_srcdir)/gl/m4/vasprintf.m4 \
$(top_srcdir)/gl/m4/vsnprintf.m4 $(top_srcdir)/gl/m4/wchar.m4 \
$(top_srcdir)/gl/m4/wchar_t.m4 $(top_srcdir)/gl/m4/wctype.m4 \
$(top_srcdir)/gl/m4/wcwidth.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)/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
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs
@ -239,10 +243,6 @@ CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plugins/t
INSTALL = @INSTALL@
ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@
ABSOLUTE_UNISTD_H = @ABSOLUTE_UNISTD_H@
ABSOLUTE_WCHAR_H = @ABSOLUTE_WCHAR_H@
ABSOLUTE_WCTYPE_H = @ABSOLUTE_WCTYPE_H@
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
ALLOCA_H = @ALLOCA_H@
@ -271,6 +271,7 @@ CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
# gettext docs say to use AM_CPPFLAGS, but per module_CPPFLAGS override this
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
DEPDIR = @DEPDIR@
DEPLIBS = @DEPLIBS@
@ -287,27 +288,177 @@ EXTRA_NETOBJS = @EXTRA_NETOBJS@
EXTRA_TEST = @EXTRA_TEST@
F77 = @F77@
FFLAGS = @FFLAGS@
FLOAT_H = @FLOAT_H@
FLOORF_LIBM = @FLOORF_LIBM@
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
GETOPT_H = @GETOPT_H@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GLIBC21 = @GLIBC21@
GL_COND_LIBTOOL_FALSE = @GL_COND_LIBTOOL_FALSE@
GL_COND_LIBTOOL_TRUE = @GL_COND_LIBTOOL_TRUE@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
GNULIB_CEILF = @GNULIB_CEILF@
GNULIB_CEILL = @GNULIB_CEILL@
GNULIB_CHOWN = @GNULIB_CHOWN@
GNULIB_DUP2 = @GNULIB_DUP2@
GNULIB_FCHDIR = @GNULIB_FCHDIR@
GNULIB_FFLUSH = @GNULIB_FFLUSH@
GNULIB_FLOORF = @GNULIB_FLOORF@
GNULIB_FLOORL = @GNULIB_FLOORL@
GNULIB_FOPEN = @GNULIB_FOPEN@
GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
GNULIB_FREOPEN = @GNULIB_FREOPEN@
GNULIB_FREXP = @GNULIB_FREXP@
GNULIB_FREXPL = @GNULIB_FREXPL@
GNULIB_FSEEK = @GNULIB_FSEEK@
GNULIB_FSEEKO = @GNULIB_FSEEKO@
GNULIB_FTELL = @GNULIB_FTELL@
GNULIB_FTELLO = @GNULIB_FTELLO@
GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@
GNULIB_GETCWD = @GNULIB_GETCWD@
GNULIB_GETDELIM = @GNULIB_GETDELIM@
GNULIB_GETLINE = @GNULIB_GETLINE@
GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
GNULIB_ISFINITE = @GNULIB_ISFINITE@
GNULIB_LCHOWN = @GNULIB_LCHOWN@
GNULIB_LDEXPL = @GNULIB_LDEXPL@
GNULIB_LSEEK = @GNULIB_LSEEK@
GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@
GNULIB_MATHL = @GNULIB_MATHL@
GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@
GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@
GNULIB_MBSCHR = @GNULIB_MBSCHR@
GNULIB_MBSCSPN = @GNULIB_MBSCSPN@
GNULIB_MBSLEN = @GNULIB_MBSLEN@
GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@
GNULIB_MBSNLEN = @GNULIB_MBSNLEN@
GNULIB_MBSPBRK = @GNULIB_MBSPBRK@
GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@
GNULIB_MBSRCHR = @GNULIB_MBSRCHR@
GNULIB_MBSSEP = @GNULIB_MBSSEP@
GNULIB_MBSSPN = @GNULIB_MBSSPN@
GNULIB_MBSSTR = @GNULIB_MBSSTR@
GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@
GNULIB_MEMMEM = @GNULIB_MEMMEM@
GNULIB_MEMPCPY = @GNULIB_MEMPCPY@
GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
GNULIB_PUTENV = @GNULIB_PUTENV@
GNULIB_READLINK = @GNULIB_READLINK@
GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
GNULIB_ROUND = @GNULIB_ROUND@
GNULIB_ROUNDF = @GNULIB_ROUNDF@
GNULIB_ROUNDL = @GNULIB_ROUNDL@
GNULIB_SETENV = @GNULIB_SETENV@
GNULIB_SIGNBIT = @GNULIB_SIGNBIT@
GNULIB_SLEEP = @GNULIB_SLEEP@
GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
GNULIB_STPCPY = @GNULIB_STPCPY@
GNULIB_STPNCPY = @GNULIB_STPNCPY@
GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
GNULIB_STRDUP = @GNULIB_STRDUP@
GNULIB_STRERROR = @GNULIB_STRERROR@
GNULIB_STRNDUP = @GNULIB_STRNDUP@
GNULIB_STRNLEN = @GNULIB_STRNLEN@
GNULIB_STRPBRK = @GNULIB_STRPBRK@
GNULIB_STRSEP = @GNULIB_STRSEP@
GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
GNULIB_STRSTR = @GNULIB_STRSTR@
GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
GNULIB_TRUNC = @GNULIB_TRUNC@
GNULIB_TRUNCF = @GNULIB_TRUNCF@
GNULIB_TRUNCL = @GNULIB_TRUNCL@
GNULIB_UNSETENV = @GNULIB_UNSETENV@
GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@
GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@
GNULIB_WCWIDTH = @GNULIB_WCWIDTH@
GREP = @GREP@
HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
HAVE_DECL_ACOSL = @HAVE_DECL_ACOSL@
HAVE_DECL_ASINL = @HAVE_DECL_ASINL@
HAVE_DECL_ATANL = @HAVE_DECL_ATANL@
HAVE_DECL_COSL = @HAVE_DECL_COSL@
HAVE_DECL_EXPL = @HAVE_DECL_EXPL@
HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@
HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@
HAVE_DECL_LOGL = @HAVE_DECL_LOGL@
HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@
HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
HAVE_DECL_SINL = @HAVE_DECL_SINL@
HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@
HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
HAVE_DECL_TANL = @HAVE_DECL_TANL@
HAVE_DECL_TRUNC = @HAVE_DECL_TRUNC@
HAVE_DECL_TRUNCF = @HAVE_DECL_TRUNCF@
HAVE_DECL_TRUNCL = @HAVE_DECL_TRUNCL@
HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
HAVE_DUP2 = @HAVE_DUP2@
HAVE_FSEEKO = @HAVE_FSEEKO@
HAVE_FTELLO = @HAVE_FTELLO@
HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
HAVE_ISWCNTRL = @HAVE_ISWCNTRL@
HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
HAVE_MEMPCPY = @HAVE_MEMPCPY@
HAVE_MKDTEMP = @HAVE_MKDTEMP@
HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
HAVE_OS_H = @HAVE_OS_H@
HAVE_READLINK = @HAVE_READLINK@
HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
HAVE_SETENV = @HAVE_SETENV@
HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
HAVE_SLEEP = @HAVE_SLEEP@
HAVE_STDINT_H = @HAVE_STDINT_H@
HAVE_STPCPY = @HAVE_STPCPY@
HAVE_STPNCPY = @HAVE_STPNCPY@
HAVE_STRCASESTR = @HAVE_STRCASESTR@
HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
HAVE_STRNDUP = @HAVE_STRNDUP@
HAVE_STRPBRK = @HAVE_STRPBRK@
HAVE_STRSEP = @HAVE_STRSEP@
HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
HAVE_UNISTD_H = @HAVE_UNISTD_H@
HAVE_UNSETENV = @HAVE_UNSETENV@
HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
HAVE_VASPRINTF = @HAVE_VASPRINTF@
HAVE_WCHAR_H = @HAVE_WCHAR_H@
HAVE_WCTYPE_H = @HAVE_WCTYPE_H@
HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@
HAVE_WINT_T = @HAVE_WINT_T@
HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@
HAVE__BOOL = @HAVE__BOOL@
HOSTNAME = @HOSTNAME@
INCLUDE_NEXT = @INCLUDE_NEXT@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -325,9 +476,11 @@ LIBGNU_LTLIBDEPS = @LIBGNU_LTLIBDEPS@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
LIBOBJS = @LIBOBJS@
LIBS = @LIBINTL@ @LIBS@
# gettext docs say to use LDADD, but per module_LDADD override
LIBS = @LTLIBINTL@ @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
@ -341,6 +494,17 @@ MYSQLINCLUDE = @MYSQLINCLUDE@
MYSQLLIBS = @MYSQLLIBS@
NEED_SETGID = @NEED_SETGID@
NETINET_IN_H = @NETINET_IN_H@
NEXT_FLOAT_H = @NEXT_FLOAT_H@
NEXT_MATH_H = @NEXT_MATH_H@
NEXT_NETINET_IN_H = @NEXT_NETINET_IN_H@
NEXT_STDINT_H = @NEXT_STDINT_H@
NEXT_STDIO_H = @NEXT_STDIO_H@
NEXT_STDLIB_H = @NEXT_STDLIB_H@
NEXT_STRING_H = @NEXT_STRING_H@
NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@
NEXT_UNISTD_H = @NEXT_UNISTD_H@
NEXT_WCHAR_H = @NEXT_WCHAR_H@
NEXT_WCTYPE_H = @NEXT_WCTYPE_H@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@ -379,11 +543,56 @@ PKG_ARCH = @PKG_ARCH@
PLUGIN_TEST = @PLUGIN_TEST@
POSUB = @POSUB@
POW_LIB = @POW_LIB@
PST3CFLAGS = @PST3CFLAGS@
PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
PYTHON = @PYTHON@
RADIUSLIBS = @RADIUSLIBS@
RANLIB = @RANLIB@
RELEASE = @RELEASE@
REPLACE_CEILF = @REPLACE_CEILF@
REPLACE_CEILL = @REPLACE_CEILL@
REPLACE_CHOWN = @REPLACE_CHOWN@
REPLACE_FCHDIR = @REPLACE_FCHDIR@
REPLACE_FFLUSH = @REPLACE_FFLUSH@
REPLACE_FLOORF = @REPLACE_FLOORF@
REPLACE_FLOORL = @REPLACE_FLOORL@
REPLACE_FOPEN = @REPLACE_FOPEN@
REPLACE_FPRINTF = @REPLACE_FPRINTF@
REPLACE_FREOPEN = @REPLACE_FREOPEN@
REPLACE_FREXP = @REPLACE_FREXP@
REPLACE_FREXPL = @REPLACE_FREXPL@
REPLACE_FSEEK = @REPLACE_FSEEK@
REPLACE_FSEEKO = @REPLACE_FSEEKO@
REPLACE_FTELL = @REPLACE_FTELL@
REPLACE_FTELLO = @REPLACE_FTELLO@
REPLACE_GETCWD = @REPLACE_GETCWD@
REPLACE_GETLINE = @REPLACE_GETLINE@
REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
REPLACE_ISFINITE = @REPLACE_ISFINITE@
REPLACE_LCHOWN = @REPLACE_LCHOWN@
REPLACE_LDEXPL = @REPLACE_LDEXPL@
REPLACE_LSEEK = @REPLACE_LSEEK@
REPLACE_MEMMEM = @REPLACE_MEMMEM@
REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
REPLACE_PRINTF = @REPLACE_PRINTF@
REPLACE_PUTENV = @REPLACE_PUTENV@
REPLACE_ROUND = @REPLACE_ROUND@
REPLACE_ROUNDF = @REPLACE_ROUNDF@
REPLACE_ROUNDL = @REPLACE_ROUNDL@
REPLACE_SIGNBIT = @REPLACE_SIGNBIT@
REPLACE_SIGNBIT_USING_GCC = @REPLACE_SIGNBIT_USING_GCC@
REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
REPLACE_SPRINTF = @REPLACE_SPRINTF@
REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
REPLACE_STRERROR = @REPLACE_STRERROR@
REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
REPLACE_STRSTR = @REPLACE_STRSTR@
REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
REPLACE_VPRINTF = @REPLACE_VPRINTF@
REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
REV_DATESTAMP = @REV_DATESTAMP@
REV_TIMESTAMP = @REV_TIMESTAMP@
SCRIPT_TEST = @SCRIPT_TEST@
@ -400,9 +609,11 @@ STDINT_H = @STDINT_H@
STRIP = @STRIP@
SUPPORT = @SUPPORT@
SYS_SOCKET_H = @SYS_SOCKET_H@
UNISTD_H = @UNISTD_H@
USE_NLS = @USE_NLS@
USE_PARSE_INI_FALSE = @USE_PARSE_INI_FALSE@
USE_PARSE_INI_TRUE = @USE_PARSE_INI_TRUE@
VERSION = @VERSION@
VOID_UNSETENV = @VOID_UNSETENV@
WARRANTY = @WARRANTY@
WCHAR_H = @WCHAR_H@
WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
@ -410,6 +621,7 @@ WCTYPE_H = @WCTYPE_H@
WINT_T_SUFFIX = @WINT_T_SUFFIX@
XGETTEXT = @XGETTEXT@
XGETTEXT_015 = @XGETTEXT_015@
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
@ -436,6 +648,8 @@ dvidir = @dvidir@
exec_prefix = @exec_prefix@
gl_LIBOBJS = @gl_LIBOBJS@
gl_LTLIBOBJS = @gl_LTLIBOBJS@
gltests_LIBOBJS = @gltests_LIBOBJS@
gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@

View file

@ -1,43 +1,41 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_apt plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Original author: sean finney
*
* Last Modified: $Date: 2007-01-28 21:46:41 +0000 (Sun, 28 Jan 2007) $
*
* Copyright (c) 2006-2008 Nagios Plugins Development Team
*
* Original author: Sean Finney
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_apt plugin
*
* check for available updates in apt package management systems
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
* Check for available updates in apt package management systems
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: check_apt.c 1590 2007-01-28 21:46:41Z hweiss $
*
******************************************************************************/
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_apt.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_apt";
const char *revision = "$Revision: 1590 $";
const char *copyright = "2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2006-2008";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -90,6 +88,9 @@ static int exec_warning = 0; /* if a cmd exited non-zero */
int main (int argc, char **argv) {
int result=STATE_UNKNOWN, packages_available=0, sec_count=0;
/* Parse extra opts if any */
argv=np_extra_opts(&argc, argv, progname);
if (process_arguments(argc, argv) == ERROR)
usage_va(_("Could not parse arguments"));
@ -404,9 +405,9 @@ void
print_help (void)
{
print_revision(progname, revision);
printf(_(COPYRIGHT), copyright, email);
printf("%s\n", _("This plugin checks for software updates on systems that use"));
printf("%s\n", _("package management systems based on the apt-get(8) command"));
printf("%s\n", _("found in Debian GNU/Linux"));
@ -414,11 +415,12 @@ print_help (void)
printf ("\n\n");
print_usage();
printf(_(UT_HELP_VRSN));
printf(_(UT_EXTRA_OPTS));
printf(_(UT_TIMEOUT), timeout_interval);
printf (" %s\n", "-U, --upgrade=OPTS");
printf (" %s\n", _("[Default] Perform an upgrade. If an optional OPTS argument is provided,"));
printf (" %s\n", _("apt-get will be run with these command line options instead of the"));
@ -447,17 +449,25 @@ print_help (void)
printf (" %s\n", _("upgrades for Debian and Ubuntu:"));
printf (" \t\%s\n", SECURITY_RE);
printf (" %s\n", _("Note that the package must first match the include list before its"));
printf (" %s\n\n\n", _("information is compared against the critical list."));
printf (" %s\n\n", _("information is compared against the critical list."));
printf ("%s\n\n", _("The following options require root privileges and should be used with care:"));
printf (" %s\n", "-u, --update=OPTS");
printf (" %s\n", _("First perform an 'apt-get update'. An optional OPTS parameter overrides"));
printf (" %s\n", _("the default options. Note: you may also need to adjust the global"));
printf (" %s\n", _("timeout (with -t) to prevent the plugin from timing out if apt-get"));
printf (" %s\n", _("upgrade is expected to take longer than the default timeout."));
#ifdef NP_EXTRA_OPTS
printf("\n");
printf("%s\n", _("Notes:"));
printf(_(UT_EXTRA_OPTS_NOTES));
#endif
printf(_(UT_SUPPORT));
}
/* simple usage heading */
void
print_usage(void)

View file

@ -1,39 +1,37 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_by_ssh plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-09-23 13:26:03 +0100 (Sun, 23 Sep 2007) $
*
* Copyright (c) 2000-2008 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-27 22:31:13 +0100 (Tue, 27 May 2008) $
*
* Description:
*
*
* This file contains the check_by_ssh plugin
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: check_by_ssh.c 1792 2007-09-23 12:26:03Z psychotrahe $
*
******************************************************************************/
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_by_ssh.c 2002 2008-05-27 21:31:13Z tonvoon $
*
*****************************************************************************/
const char *progname = "check_by_ssh";
const char *revision = "$Revision: 1792 $";
const char *copyright = "2000-2006";
const char *revision = "$Revision: 2002 $";
const char *copyright = "2000-2008";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -78,6 +76,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
/* process arguments */
if (process_arguments (argc, argv) == ERROR)
usage_va(_("Could not parse arguments"));
@ -99,11 +100,11 @@ main (int argc, char **argv)
if (skip_stderr == -1) /* --skip-stderr specified without argument */
skip_stderr = chld_err.lines;
/* UNKNOWN if (non-skipped) output found on stderr */
/* UNKNOWN or worse if (non-skipped) output found on stderr */
if(chld_err.lines > skip_stderr) {
printf (_("Remote command execution failed: %s\n"),
chld_err.line[skip_stderr]);
return STATE_UNKNOWN;
return max_state_alt(result, STATE_UNKNOWN);
}
/* this is simple if we're not supposed to be passive.
@ -132,21 +133,20 @@ main (int argc, char **argv)
local_time = time (NULL);
commands = 0;
for(i = skip_stdout; i < chld_out.lines; i++) {
status_text = strstr (chld_out.line[i], "STATUS CODE: ");
if (status_text == NULL) {
printf ("%s", chld_out.line[i]);
return result;
}
status_text = chld_out.line[i++];
if (i == chld_out.lines || strstr (chld_out.line[i], "STATUS CODE: ") == NULL)
die (STATE_UNKNOWN, _("%s: Error parsing output\n"), progname);
if (service[commands] && status_text
&& sscanf (status_text, "STATUS CODE: %d", &cresult) == 1)
&& sscanf (chld_out.line[i], "STATUS CODE: %d", &cresult) == 1)
{
fprintf (fp, "[%d] PROCESS_SERVICE_CHECK_RESULT;%s;%s;%d;%s\n",
(int) local_time, host_shortname, service[commands++],
cresult, chld_out.line[i]);
cresult, status_text);
}
}
/* force an OK state */
/* Multiple commands and passive checking should always return OK */
return result;
}
@ -307,7 +307,7 @@ process_arguments (int argc, char **argv)
asprintf (&remotecmd, "%s", argv[c]);
}
if (commands > 1)
if (commands > 1 || passive)
asprintf (&remotecmd, "%s;echo STATUS CODE: $?;", remotecmd);
if (remotecmd == NULL || strlen (remotecmd) <= 1)
@ -347,11 +347,13 @@ print_help (void)
printf (_("This plugin uses SSH to execute commands on a remote host"));
printf ("\n\n");
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (_(UT_HOST_PORT), 'p', "none");
printf (_(UT_IPv46));
@ -365,7 +367,7 @@ print_help (void)
printf (" %s\n", "-E, --skip-stderr[=n]");
printf (" %s\n", _("Ignore all or (if specified) first n lines on STDERR [optional]"));
printf (" %s\n", "-f");
printf (" %s\n", _("tells ssh to fork rather than create a tty [optional]"));
printf (" %s\n", _("tells ssh to fork rather than create a tty [optional]. This will always return OK if ssh is executed"));
printf (" %s\n","-C, --command='COMMAND STRING'");
printf (" %s\n", _("command to execute on the remote machine"));
printf (" %s\n","-l, --logname=USERNAME");
@ -384,6 +386,8 @@ print_help (void)
printf (" %s\n", _("Tell ssh to suppress warning and diagnostic messages [optional]"));
printf (_(UT_WARN_CRIT));
printf (_(UT_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"));
printf (" %s\n", _("the '-i' option. In this mode, the identity pair should have a null"));
printf (" %s\n", _("passphrase and the public key should be listed in the authorized_keys"));
@ -391,6 +395,7 @@ print_help (void)
printf (" %s\n", _("only one command on the remote server. If the remote SSH server tracks"));
printf (" %s\n", _("invocation arguments, the one remote program may be an agent that can"));
printf (" %s\n", _("execute additional commands as proxy"));
printf("\n");
printf (" %s\n", _("To use passive mode, provide multiple '-C' options, and provide"));
printf (" %s\n", _("all of -O, -s, and -n options (servicelist order must match '-C'options)"));
printf ("\n");
@ -400,8 +405,14 @@ print_help (void)
printf (" %s\n", "[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c1;0; up 2 days");
printf (" %s\n", "[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c2;0; up 2 days");
printf (" %s\n", "[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c3;0; up 2 days");
printf (_(UT_VERBOSE));
printf (_(UT_SUPPORT));
#ifdef NP_EXTRA_OPTS
printf("\n");
printf("%s\n", _("Notes:"));
printf(_(UT_EXTRA_OPTS_NOTES));
#endif
printf(_(UT_SUPPORT));
}

View file

@ -1,35 +1,34 @@
/*****************************************************************************
*
* CHECK_CLUSTER2.C - Host and Service Cluster Plugin for Nagios 2.x
*
* Copyright (c) 2000-2004 Ethan Galstad (nagios@nagios.org)
* Copyright (c) 2007 nagios-plugins team
* License: GPL
* Last Modified: $Date: 2007-12-11 05:57:35 +0000 (Tue, 11 Dec 2007) $
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: check_cluster.c 1861 2007-12-11 05:57:35Z dermoth $
*
******************************************************************************/
*
* check_cluster.c - Host and Service Cluster Plugin for Nagios 2.x
*
* License: GPL
* Copyright (c) 2000-2004 Ethan Galstad (nagios@nagios.org)
* Copyright (c) 2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_cluster.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_cluster";
const char *revision = "$Revision: 1861 $";
const char *copyright = "2007";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2000-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -75,6 +74,9 @@ int main(int argc, char **argv){
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts(&argc, argv, progname);
if(process_arguments(argc,argv)==ERROR)
usage(_("Could not parse arguments"));
@ -237,6 +239,7 @@ print_help(void)
printf("\n");
printf("%s\n", _("Options:"));
printf(_(UT_EXTRA_OPTS));
printf (" %s\n", "-s, --service");
printf (" %s\n", _("Check service cluster status"));
printf (" %s\n", "-h, --host");
@ -257,12 +260,13 @@ print_help(void)
printf("\n");
printf("%s\n", _("Notes:"));
printf(" %s\n", _("See:"));
printf(" %s\n", ("http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT"));
printf(" %s\n", _("for THRESHOLD format and examples."));
printf(_(UT_THRESHOLDS_NOTES));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf(_(UT_SUPPORT));
printf("\n");
}

View file

@ -1,34 +1,32 @@
/*****************************************************************************
*
*
* Nagios check_dig plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-01-28 21:46:41 +0000 (Sun, 28 Jan 2007) $
*
* Copyright (c) 2002-2008 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_dig plugin
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: check_dig.c 1590 2007-01-28 21:46:41Z hweiss $
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_dig.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
/* Hackers note:
@ -38,8 +36,8 @@
* because on some architectures those strings are in non-writable memory */
const char *progname = "check_dig";
const char *revision = "$Revision: 1590 $";
const char *copyright = "2002-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2002-2008";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -59,6 +57,7 @@ char *query_address = NULL;
char *record_type = "A";
char *expected_address = NULL;
char *dns_server = NULL;
char *dig_args = "";
int verbose = FALSE;
int server_port = DEFAULT_PORT;
double warning_interval = UNDEFINED;
@ -85,12 +84,15 @@ main (int argc, char **argv)
if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR)
usage_va(_("Cannot catch SIGALRM"));
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage_va(_("Could not parse arguments"));
/* get the command to run */
asprintf (&command_line, "%s @%s -p %d %s -t %s",
PATH_TO_DIG, dns_server, server_port, query_address, record_type);
asprintf (&command_line, "%s @%s -p %d %s -t %s %s",
PATH_TO_DIG, dns_server, server_port, query_address, record_type, dig_args);
alarm (timeout_interval);
gettimeofday (&tv, NULL);
@ -192,6 +194,7 @@ process_arguments (int argc, char **argv)
{"warning", required_argument, 0, 'w'},
{"critical", required_argument, 0, 'c'},
{"timeout", required_argument, 0, 't'},
{"dig-arguments", required_argument, 0, 'A'},
{"verbose", no_argument, 0, 'v'},
{"version", no_argument, 0, 'V'},
{"help", no_argument, 0, 'h'},
@ -205,7 +208,7 @@ process_arguments (int argc, char **argv)
return ERROR;
while (1) {
c = getopt_long (argc, argv, "hVvt:l:H:w:c:T:p:a:", longopts, &option);
c = getopt_long (argc, argv, "hVvt:l:H:w:c:T:p:a:A:", longopts, &option);
if (c == -1 || c == EOF)
break;
@ -256,6 +259,9 @@ process_arguments (int argc, char **argv)
usage_va(_("Timeout interval must be a positive integer - %s"), optarg);
}
break;
case 'A': /* dig arguments */
dig_args = strdup(optarg);
break;
case 'v': /* verbose */
verbose = TRUE;
break;
@ -314,17 +320,34 @@ print_help (void)
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (_(UT_HOST_PORT), 'p', myport);
printf (" %s\n","-l, --lookup=STRING");
printf (" %s\n",_("machine name to lookup"));
printf (" %s\n","-l, --query_address=STRING");
printf (" %s\n",_("Machine name to lookup"));
printf (" %s\n","-T, --record_type=STRING");
printf (" %s\n",_("record type to lookup (default: A)"));
printf (" %s\n",_("Record type to lookup (default: A)"));
printf (" %s\n","-a, --expected_address=STRING");
printf (" %s\n",_("an address expected to be in the answer section.if not set, uses whatever was in -l"));
printf (" %s\n",_("An address expected to be in the answer section. If not set, uses whatever"));
printf (" %s\n",_("was in -l"));
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_VERBOSE));
printf ("\n");
printf ("%s\n", _("Examples:"));
printf (" %s\n", "check_dig -H DNSSERVER -l www.example.com -A \"+tcp\"");
printf (" %s\n", "This will send a tcp query to DNSSERVER for www.example.com");
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}
@ -334,7 +357,7 @@ void
print_usage (void)
{
printf (_("Usage:"));
printf ("%s -H host -l lookup [-p <server port>] [-T <query type>]", progname);
printf (" [-w <warning interval>] [-c <critical interval>] [-t <timeout>]");
printf (" [-a <expected answer address>] [-v]\n");
printf ("%s -H <host> -l <query_address> [-p <server port>]\n", progname);
printf (" [-T <query type>] [-w <warning interval>] [-c <critical interval>]\n");
printf (" [-t <timeout>] [-a <expected answer address>] [-v]\n");
}

View file

@ -1,40 +1,38 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_disk plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-12-08 16:34:05 +0000 (Sat, 08 Dec 2007) $
*
* Copyright (c) 1999-2008 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_disk plugin
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: check_disk.c 1848 2007-12-08 16:34:05Z dermoth $
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_disk.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_disk";
const char *program_name = "check_disk"; /* Required for coreutils libs */
const char *revision = "$Revision: 1848 $";
const char *copyright = "1999-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "1999-2008";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
@ -194,6 +192,9 @@ main (int argc, char **argv)
mount_list = read_file_system_list (0);
/* Parse extra opts if any */
argv = np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -222,7 +223,7 @@ main (int argc, char **argv)
temp_list = temp_list->name_next;
}
/* Process for every path in list */
for (path = path_select_list; path; path=path->name_next) {
@ -256,7 +257,7 @@ main (int argc, char **argv)
for (temp_list = path_select_list; temp_list; temp_list=temp_list->name_next) {
if (temp_list->group && ! (strcmp(temp_list->group, path->group))) {
stat_path(path);
get_fs_usage (temp_list->best_match->me_mountdir, temp_list->best_match->me_devname, &tmpfsp);
@ -265,10 +266,11 @@ main (int argc, char **argv)
(fsp.fsu_blocks + tmpfsp.fsu_blocks); /* Size of a block. */
fsp.fsu_blocks += tmpfsp.fsu_blocks; /* Total blocks. */
fsp.fsu_bfree += tmpfsp.fsu_bfree; /* Free blocks available to superuser. */
fsp.fsu_bavail += tmpfsp.fsu_bavail; /* Free blocks available to non-superuser. */
/* Gnulib workaround - see comment about it a few lines below */
fsp.fsu_bavail += (tmpfsp.fsu_bavail > tmpfsp.fsu_bfree ? 0 : tmpfsp.fsu_bavail); /* Free blocks available to non-superuser. */
fsp.fsu_files += tmpfsp.fsu_files; /* Total file nodes. */
fsp.fsu_ffree += tmpfsp.fsu_ffree; /* Free file nodes. */
if (verbose > 3)
printf("Group %s: add %llu blocks (%s) \n", path->group, tmpfsp.fsu_bavail, temp_list->name);
/* printf("Group %s: add %u blocks (%s)\n", temp_list->name); *//* path->group, tmpfsp.fsu_bavail, temp_list->name); */
@ -319,7 +321,7 @@ main (int argc, char **argv)
me->me_mountdir, total, available, available_to_root, used, fsp.fsu_files, fsp.fsu_ffree);
dused_pct = calculate_percent( used, used + available ); /* used + available can never be > uintmax */
dfree_pct = 100 - dused_pct;
dused_units = used*fsp.fsu_blocksize/mult;
dfree_units = available*fsp.fsu_blocksize/mult;
@ -386,10 +388,10 @@ main (int argc, char **argv)
asprintf (&perf, "%s %s", perf,
perfdata ((!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir,
dused_units, units,
(warning_high_tide != UINT_MAX ? TRUE : FALSE), warning_high_tide,
(critical_high_tide != UINT_MAX ? TRUE : FALSE), critical_high_tide,
TRUE, 0,
TRUE, dtotal_units));
(warning_high_tide != UINT_MAX ? TRUE : FALSE), warning_high_tide,
(critical_high_tide != UINT_MAX ? TRUE : FALSE), critical_high_tide,
TRUE, 0,
TRUE, dtotal_units));
if (disk_result==STATE_OK && erronly && !verbose)
continue;
@ -475,8 +477,6 @@ process_arguments (int argc, char **argv)
{"iwarning", required_argument, 0, 'W'},
/* Dang, -C is taken. We might want to reshuffle this. */
{"icritical", required_argument, 0, 'K'},
{"local", required_argument, 0, 'l'},
{"stat-remote-fs", required_argument, 0, 'L'},
{"kilobytes", required_argument, 0, 'k'},
{"megabytes", required_argument, 0, 'm'},
{"units", required_argument, 0, 'u'},
@ -493,6 +493,8 @@ process_arguments (int argc, char **argv)
{"ignore-ereg-partition", required_argument, 0, 'i'},
{"ignore-eregi-path", required_argument, 0, 'I'},
{"ignore-eregi-partition", required_argument, 0, 'I'},
{"local", no_argument, 0, 'l'},
{"stat-remote-fs", no_argument, 0, 'L'},
{"mountpoint", no_argument, 0, 'M'},
{"errors-only", no_argument, 0, 'e'},
{"exact-match", no_argument, 0, 'E'},
@ -540,7 +542,7 @@ process_arguments (int argc, char **argv)
}
} else {
if (*optarg == '@') {
warn_freespace_units = optarg;
warn_freespace_units = optarg;
} else {
asprintf(&warn_freespace_units, "@%s", optarg);
}
@ -684,12 +686,12 @@ process_arguments (int argc, char **argv)
while (temp_list) {
if (temp_list->best_match) {
if (np_regex_match_mount_entry(temp_list->best_match, &re)) {
if (verbose >=3)
printf("ignoring %s matching regex\n", temp_list->name);
printf("ignoring %s matching regex\n", temp_list->name);
temp_list = np_del_parameter(temp_list, previous);
/* pointer to first element needs to be uüdated if first item gets deleted */
/* pointer to first element needs to be updated if first item gets deleted */
if (previous == NULL)
path_select_list = temp_list;
} else {
@ -723,7 +725,7 @@ process_arguments (int argc, char **argv)
regerror (err, &re, errbuf, MAX_INPUT_BUFFER);
die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"), _("Could not compile regular expression"), errbuf);
}
for (me = mount_list; me; me = me->me_next) {
if (np_regex_match_mount_entry(me, &re)) {
fnd = TRUE;
@ -777,7 +779,7 @@ process_arguments (int argc, char **argv)
crit_usedinodes_percent = NULL;
warn_freeinodes_percent = NULL;
crit_freeinodes_percent = NULL;
path_selected = FALSE;
group = NULL;
break;
@ -829,11 +831,17 @@ print_path (const char *mypath)
void
set_all_thresholds (struct parameter_list *path)
{
if (path->freespace_units != NULL) free(path->freespace_units);
set_thresholds(&path->freespace_units, warn_freespace_units, crit_freespace_units);
if (path->freespace_percent != NULL) free (path->freespace_percent);
set_thresholds(&path->freespace_percent, warn_freespace_percent, crit_freespace_percent);
if (path->usedspace_units != NULL) free (path->usedspace_units);
set_thresholds(&path->usedspace_units, warn_usedspace_units, crit_usedspace_units);
if (path->usedspace_percent != NULL) free (path->usedspace_percent);
set_thresholds(&path->usedspace_percent, warn_usedspace_percent, crit_usedspace_percent);
if (path->usedinodes_percent != NULL) free (path->usedinodes_percent);
set_thresholds(&path->usedinodes_percent, warn_usedinodes_percent, crit_usedinodes_percent);
if (path->freeinodes_percent != NULL) free (path->freeinodes_percent);
set_thresholds(&path->freeinodes_percent, warn_freeinodes_percent, crit_freeinodes_percent);
}
@ -870,7 +878,7 @@ INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greate
print_path (mypath);
return ERROR;
}
return OK;
}
@ -898,6 +906,7 @@ print_help (void)
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (" %s\n", "-w, --warning=INTEGER");
printf (" %s\n", _("Exit with WARNING status if less than INTEGER units of disk are free"));
@ -950,6 +959,13 @@ print_help (void)
printf (_(UT_VERBOSE));
printf (" %s\n", "-X, --exclude-type=TYPE");
printf (" %s\n", _("Ignore all filesystems of indicated type (may be repeated)"));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf ("\n");
printf ("%s\n", _("Examples:"));
printf (" %s\n", "check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /");
@ -959,6 +975,7 @@ print_help (void)
printf (" %s\n", _("are grouped which means the freespace thresholds are applied to all disks together"));
printf (" %s\n", "check_disk -w 100M -c 50M -C -w 1000M -c 500M -p /foo -C -w 5% -c 3% -p /bar");
printf (" %s\n", _("Checks /foo for 1000M/500M and /bar for 5/3%. All remaining volumes use 100M/50M"));
printf (_(UT_SUPPORT));
}

View file

@ -1,43 +1,40 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_dns plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-01-28 21:46:41 +0000 (Sun, 28 Jan 2007) $
*
* Copyright (c) 2000-2008 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-13 10:14:45 +0100 (Tue, 13 May 2008) $
*
* Description:
*
*
* This file contains the check_dns plugin
*
* LIMITATION: nslookup on Solaris 7 can return output over 2 lines, which will not
* be picked up by this plugin
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* LIMITATION: nslookup on Solaris 7 can return output over 2 lines, which
* will not be picked up by this plugin
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
* $Id: check_dns.c 1590 2007-01-28 21:46:41Z hweiss $
*
******************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_dns.c 1992 2008-05-13 09:14:45Z dermoth $
*
*****************************************************************************/
const char *progname = "check_dns";
const char *revision = "$Revision: 1590 $";
const char *copyright = "2000-2006";
const char *revision = "$Revision: 1992 $";
const char *copyright = "2000-2008";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -57,17 +54,30 @@ char query_address[ADDRESS_LENGTH] = "";
char dns_server[ADDRESS_LENGTH] = "";
char ptr_server[ADDRESS_LENGTH] = "";
int verbose = FALSE;
char expected_address[ADDRESS_LENGTH] = "";
int match_expected_address = FALSE;
char **expected_address = NULL;
int expected_address_cnt = 0;
int expect_authority = FALSE;
thresholds *time_thresholds = NULL;
static int
qstrcmp(const void *p1, const void *p2)
{
/* The actual arguments to this function are "pointers to
pointers to char", but strcmp() arguments are "pointers
to char", hence the following cast plus dereference */
return strcmp(* (char * const *) p1, * (char * const *) p2);
}
int
main (int argc, char **argv)
{
char *command_line = NULL;
char input_buffer[MAX_INPUT_BUFFER];
char *address = NULL;
char *address = NULL; /* comma seperated str with addrs/ptrs (sorted) */
char **addresses = NULL;
int n_addresses = 0;
char *msg = NULL;
char *temp_buffer = NULL;
int non_authoritative = FALSE;
@ -89,6 +99,9 @@ main (int argc, char **argv)
usage_va(_("Cannot catch SIGALRM"));
}
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR) {
usage_va(_("Could not parse arguments"));
}
@ -110,12 +123,17 @@ main (int argc, char **argv)
/* scan stdout */
for(i = 0; i < chld_out.lines; i++) {
if (addresses == NULL)
addresses = malloc(sizeof(*addresses)*10);
else if (!(n_addresses % 10))
addresses = realloc(addresses,sizeof(*addresses) * (n_addresses + 10));
if (verbose)
puts(chld_out.line[i]);
if (strstr (chld_out.line[i], ".in-addr.arpa")) {
if ((temp_buffer = strstr (chld_out.line[i], "name = ")))
address = strdup (temp_buffer + 7);
addresses[n_addresses++] = strdup (temp_buffer + 7);
else {
msg = (char *)_("Warning plugin error");
result = STATE_WARNING;
@ -133,7 +151,7 @@ main (int argc, char **argv)
/* Strip leading spaces */
for (; *temp_buffer != '\0' && *temp_buffer == ' '; temp_buffer++)
/* NOOP */;
strip(temp_buffer);
if (temp_buffer==NULL || strlen(temp_buffer)==0) {
die (STATE_CRITICAL,
@ -141,16 +159,13 @@ main (int argc, char **argv)
NSLOOKUP_COMMAND);
}
if (address == NULL)
address = strdup (temp_buffer);
else
asprintf(&address, "%s,%s", address, temp_buffer);
addresses[n_addresses++] = strdup(temp_buffer);
}
else if (strstr (chld_out.line[i], _("Non-authoritative answer:"))) {
non_authoritative = TRUE;
}
result = error_scan (chld_out.line[i]);
if (result != STATE_OK) {
msg = strchr (chld_out.line[i], ':');
@ -171,17 +186,39 @@ main (int argc, char **argv)
}
}
/* If we got here, we should have an address string,
* and we can segfault if we do not */
if (address==NULL || strlen(address)==0)
if (addresses) {
int i,slen;
char *adrp;
qsort(addresses, n_addresses, sizeof(*addresses), qstrcmp);
for(i=0, slen=1; i < n_addresses; i++) {
slen += strlen(addresses[i])+1;
}
adrp = address = malloc(slen);
for(i=0; i < n_addresses; i++) {
if (i) *adrp++ = ',';
strcpy(adrp, addresses[i]);
adrp += strlen(addresses[i]);
}
*adrp = 0;
} else
die (STATE_CRITICAL,
_("DNS CRITICAL - '%s' msg parsing exited with no address\n"),
NSLOOKUP_COMMAND);
/* compare to expected address */
if (result == STATE_OK && match_expected_address && strcmp(address, expected_address)) {
if (result == STATE_OK && expected_address_cnt > 0) {
result = STATE_CRITICAL;
asprintf(&msg, _("expected '%s' but got '%s'"), expected_address, address);
temp_buffer = "";
for (i=0; i<expected_address_cnt; i++) {
/* check if we get a match and prepare an error string */
if (strcmp(address, expected_address[i]) == 0) result = STATE_OK;
asprintf(&temp_buffer, "%s%s; ", temp_buffer, expected_address[i]);
}
if (result == STATE_CRITICAL) {
/* Strip off last semicolon... */
temp_buffer[strlen(temp_buffer)-2] = '\0';
asprintf(&msg, _("expected '%s' but got '%s'"), temp_buffer, address);
}
}
/* check if authoritative */
@ -357,8 +394,9 @@ process_arguments (int argc, char **argv)
case 'a': /* expected address */
if (strlen (optarg) >= ADDRESS_LENGTH)
die (STATE_UNKNOWN, _("Input buffer overflow\n"));
strcpy (expected_address, optarg);
match_expected_address = TRUE;
expected_address = (char **)realloc(expected_address, (expected_address_cnt+1) * sizeof(char**));
expected_address[expected_address_cnt] = strdup(optarg);
expected_address_cnt++;
break;
case 'A': /* expect authority */
expect_authority = TRUE;
@ -416,19 +454,23 @@ print_help (void)
printf ("%s\n", _("This plugin uses the nslookup program to obtain the IP address for the given host/domain query."));
printf ("%s\n", _("An optional DNS server to use may be specified."));
printf ("%s\n", _("If no DNS server is specified, the default server(s) specified in /etc/resolv.conf will be used."));
printf ("\n\n");
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (" -H, --hostname=HOST\n");
printf (" %s\n", _("The name or address you want to query"));
printf (" -s, --server=HOST\n");
printf (" %s\n", _("Optional DNS server you want to use for the lookup"));
printf (" -a, --expected-address=IP-ADDRESS|HOST\n");
printf (" %s\n", _("Optional IP-ADDRESS you expect the DNS server to return. HOST must end with ."));
printf (" %s\n", _("Optional IP-ADDRESS you expect the DNS server to return. HOST must end with"));
printf (" %s\n", _("a dot (.). This option can be repeated multiple times (Returns OK if any"));
printf (" %s\n", _("value match). If multiple addresses are returned at once, you have to match"));
printf (" %s\n", _("the whole string of addresses separated with commas (sorted alphabetically)."));
printf (" -A, --expect-authority\n");
printf (" %s\n", _("Optionally expect the DNS server to be authoritative for the lookup"));
printf (" -w, --warning=seconds\n");
@ -437,6 +479,13 @@ print_help (void)
printf (" %s\n", _("Return critical if elapsed time exceeds value. Default off"));
printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,42 +1,39 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_dummy plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-05-24 09:35:53 +0100 (Thu, 24 May 2007) $
*
* Copyright (c) 1999-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-04-27 15:35:26 +0100 (Sun, 27 Apr 2008) $
*
* Description:
*
*
* This file contains the check_dummy plugin
*
* This plugin will simply return the state corresponding to the numeric value
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin will simply return the state corresponding to the numeric value
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: check_dummy.c 1716 2007-05-24 08:35:53Z tonvoon $
******************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_dummy.c 1984 2008-04-27 14:35:26Z dermoth $
*
*****************************************************************************/
const char *progname = "check_dummy";
const char *revision = "$Revision: 1716 $";
const char *copyright = "1999-2006";
const char *revision = "$Revision: 1984 $";
const char *copyright = "1999-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -109,11 +106,11 @@ print_help (void)
printf (COPYRIGHT, copyright, email);
printf ("%s\n", _("This plugin will simply return the state corresponding to the numeric value"));
printf ("%s\n", _("of the <state> argument with optional text"));
printf ("\n\n");
print_usage ();
printf (_(UT_HELP_VRSN));

View file

@ -1,42 +1,40 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_fping plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-01-28 21:46:41 +0000 (Sun, 28 Jan 2007) $
*
* Copyright (c) 2000-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_disk plugin
*
* This plugin will use the fping command to ping the specified host for a fast check
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin will use the fping command to ping the specified host for a
* fast check
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: check_fping.c 1590 2007-01-28 21:46:41Z hweiss $
******************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_fping.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_fping";
const char *revision = "$Revision: 1590 $";
const char *copyright = "2000-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2000-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -85,6 +83,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -206,7 +207,7 @@ textscan (char *buf)
die (status, _("FPING %s - %s (loss=%.0f%% )|%s\n"),
state_text (status), server_name, loss ,
perfdata ("loss", (long int)loss, "%", wpl_p, wpl, cpl_p, cpl, TRUE, 0, TRUE, 100));
}
else {
status = max_state (status, STATE_WARNING);
@ -373,14 +374,15 @@ print_help (void)
printf (COPYRIGHT, copyright, email);
printf ("%s\n", _("This plugin will use the fping command to ping the specified host for a fast check"));
printf ("%s\n", _("Note that it is necessary to set the suid flag on fping."));
printf ("\n\n");
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (" %s\n", "-H, --hostname=HOST");
printf (" %s\n", _("name or IP Address of host to ping (IP Address bypasses name lookup, reducing system load)"));
@ -394,9 +396,16 @@ print_help (void)
printf (" %s\n", _("number of ICMP packets to send (default: %d)"),PACKET_COUNT);
printf (_(UT_VERBOSE));
printf ("\n");
printf (" %s\n", _("THRESHOLD is <rta>,<pl>%% where <rta> is the round trip average travel time (ms)"));
printf (" %s\n", _("which triggers a WARNING or CRITICAL state, and <pl> is the percentage of"));
printf (" %s\n", _("packet loss to trigger an alarm state."));
printf (" %s\n", _("THRESHOLD is <rta>,<pl>%% where <rta> is the round trip average travel time (ms)"));
printf (" %s\n", _("which triggers a WARNING or CRITICAL state, and <pl> is the percentage of"));
printf (" %s\n", _("packet loss to trigger an alarm state."));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,41 +1,40 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_game plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-01-28 21:46:41 +0000 (Sun, 28 Jan 2007) $
*
* Copyright (c) 2002-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_game plugin
*
*
* This plugin tests game server connections with the specified host.
* using the qstat program
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_game.c 1991 2008-05-07 10:02:42Z dermoth $
*
* $Id: check_game.c 1590 2007-01-28 21:46:41Z hweiss $
*****************************************************************************/
const char *progname = "check_game";
const char *revision = "$Revision: 1590 $";
const char *copyright = "2002-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2002-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -79,7 +78,10 @@ main (int argc, char **argv)
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage_va(_("Could not parse arguments"));
@ -88,7 +90,7 @@ main (int argc, char **argv)
/* create the command line to execute */
asprintf (&command_line, "%s -raw %s -%s %s",
PATH_TO_QSTAT, QSTAT_DATA_DELIMITER, game_type, server_ip);
if (port)
asprintf (&command_line, "%s:%-d", command_line, port);
@ -299,11 +301,12 @@ print_help (void)
printf (_("This plugin tests game server connections with the specified host."));
printf ("\n\n");
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (" %s\n", "-p");
printf (" %s\n", _("Optional port of which to connect"));
printf (" %s\n", "gf");
@ -315,13 +318,15 @@ print_help (void)
printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
printf ("\n");
printf ("%s\n", _("Notes:"));
printf ("%s\n", _("This plugin uses the 'qstat' command, the popular game server status query tool ."));
printf ("%s\n", _("If you don't have the package installed, you will need to download it from"));
printf ("%s\n", _("http://www.activesw.com/people/steve/qstat.html before you can use this plugin."));
printf (" %s\n", _("This plugin uses the 'qstat' command, the popular game server status query tool."));
printf (" %s\n", _("If you don't have the package installed, you will need to download it from"));
printf (" %s\n", _("http://www.activesw.com/people/steve/qstat.html before you can use this plugin."));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,42 +1,40 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_hpjd plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-01-28 21:46:41 +0000 (Sun, 28 Jan 2007) $
*
* Copyright (c) 2000-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_hpjd plugin
*
* This plugin tests the STATUS of an HP printer with a JetDirect card.
* Net-snmp must be installed on the computer running the plugin.
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin tests the STATUS of an HP printer with a JetDirect card.
* Net-SNMP must be installed on the computer running the plugin.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: check_hpjd.c 1590 2007-01-28 21:46:41Z hweiss $
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_hpjd.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_hpjd";
const char *revision = "$Revision: 1590 $";
const char *copyright = "2000-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2000-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -102,6 +100,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -392,17 +393,25 @@ print_help (void)
printf (COPYRIGHT, copyright, email);
printf ("%s\n", _("This plugin tests the STATUS of an HP printer with a JetDirect card."));
printf ("%s\n", _("Net-snmp must be installed on the computer running the plugin."));
printf ("%s\n", _("Net-snmp must be installed on the computer running the plugin."));
printf ("\n\n");
printf ("\n\n");
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (" %s\n", "-C, --community=STRING");
printf (" %s", _("The SNMP community name "));
printf (_("(default=%s)"), DEFAULT_COMMUNITY);
printf (" %s", _("The SNMP community name "));
printf (_("(default=%s)"), DEFAULT_COMMUNITY);
printf ("\n");
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,54 +1,51 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_http plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-12-11 05:57:35 +0000 (Tue, 11 Dec 2007) $
*
* Copyright (c) 1999-2008 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_http plugin
*
* This plugin tests the HTTP service on the specified host. It can test
* normal (http) and secure (https) servers, follow redirects, search for
* strings and regular expressions, check connection times, and report on
* certificate expiration times.
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin tests the HTTP service on the specified host. It can test
* normal (http) and secure (https) servers, follow redirects, search for
* strings and regular expressions, check connection times, and report on
* certificate expiration times.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_http.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
$Id: check_http.c 1861 2007-12-11 05:57:35Z dermoth $
******************************************************************************/
/* splint -I. -I../../plugins -I../../lib/ -I/usr/kerberos/include/ ../../plugins/check_http.c */
const char *progname = "check_http";
const char *revision = "$Revision: 1861 $";
const char *copyright = "1999-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "1999-2008";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include <ctype.h>
#include "common.h"
#include "netutils.h"
#include "utils.h"
#include "base64.h"
#include <ctype.h>
#define INPUT_DELIMITER ";"
@ -150,6 +147,9 @@ main (int argc, char **argv)
asprintf (&user_agent, "User-Agent: check_http/%s (nagios-plugins %s)",
clean_revstring (revision), VERSION);
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -174,6 +174,7 @@ int
process_arguments (int argc, char **argv)
{
int c = 1;
char *p;
enum {
INVERT_REGEX = CHAR_MAX + 1
@ -317,8 +318,12 @@ process_arguments (int argc, char **argv)
/* Note: H, I, and u must be malloc'd or will fail on redirects */
case 'H': /* Host Name (virtual host) */
host_name = strdup (optarg);
if (strstr (optarg, ":"))
sscanf (optarg, "%*[^:]:%d", &server_port);
if (host_name[0] == '[') {
if ((p = strstr (host_name, "]:")) != NULL) /* [IPv6]:port */
server_port = atoi (p + 2);
} else if ((p = strchr (host_name, ':')) != NULL
&& strchr (++p, ':') == NULL) /* IPv4:port or host:port */
server_port = atoi (p);
break;
case 'I': /* Server IP-address */
server_address = strdup (optarg);
@ -748,7 +753,7 @@ check_http (void)
/* optionally send the host header info */
if (host_name)
asprintf (&buf, "%sHost: %s\r\n", buf, host_name);
asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port);
/* optionally send any other header tag */
if (http_opt_headers_count) {
@ -761,7 +766,7 @@ check_http (void)
/* optionally send the authentication info */
if (strlen(user_auth)) {
auth = base64 (user_auth, strlen (user_auth));
base64_encode_alloc (user_auth, strlen (user_auth), &auth);
asprintf (&buf, "%sAuthorization: Basic %s\r\n", buf, auth);
}
@ -772,7 +777,7 @@ check_http (void)
} else {
asprintf (&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf);
}
asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, (int)strlen (http_post_data));
asprintf (&buf, "%s%s%s", buf, http_post_data, CRLF);
}
@ -934,7 +939,7 @@ check_http (void)
} /* end if (http_status >= 300) */
} /* end else (server_expect_yn) */
if (maximum_age >= 0) {
check_document_dates (header);
}
@ -1046,7 +1051,7 @@ redir (char *pos, char *status_line)
addr = malloc (MAX_IPV4_HOSTLENGTH + 1);
if (addr == NULL)
die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate addr\n"));
url = malloc (strcspn (pos, "\r\n"));
if (url == NULL)
die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate url\n"));
@ -1230,6 +1235,7 @@ print_help (void)
printf ("\n");
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (" %s\n", "-H, --hostname=ADDRESS");
printf (" %s\n", _("Host name argument for servers using host headers (virtual host)"));
@ -1297,19 +1303,24 @@ print_help (void)
printf (_(UT_VERBOSE));
printf (_("Notes:"));
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (" %s\n", _("This plugin will attempt to open an HTTP connection with the host."));
printf (" %s\n", _("Successful connects return STATE_OK, refusals and timeouts return STATE_CRITICAL"));
printf (" %s\n", _("other errors return STATE_UNKNOWN. Successful connects, but incorrect reponse"));
printf (" %s\n", _("messages from the host result in STATE_WARNING return values. If you are"));
printf (" %s\n", _("checking a virtual server that uses 'host headers' you must supply the FQDN"));
printf (" %s\n", _("(fully qualified domain name) as the [host_name] argument."));
printf ("\n");
printf (_(UT_EXTRA_OPTS_NOTES));
#ifdef HAVE_SSL
printf ("\n");
printf (" %s\n", _("This plugin can also check whether an SSL enabled web server is able to"));
printf (" %s\n", _("serve content (optionally within a specified time) or whether the X509 "));
printf (" %s\n", _("certificate is still valid for the specified number of days."));
printf (_("Examples:"));
printf ("\n");
printf ("%s\n", _("Examples:"));
printf (" %s\n\n", "CHECK CONTENT: check_http -w 5 -c 10 --ssl -H www.verisign.com");
printf (" %s\n", _("When the 'www.verisign.com' server returns its content within 5 seconds,"));
printf (" %s\n", _("a STATE_OK will be returned. When the server returns its content but exceeds"));
@ -1320,7 +1331,7 @@ print_help (void)
printf (" %s\n", _("When the certificate of 'www.verisign.com' is valid for more than 14 days,"));
printf (" %s\n", _("a STATE_OK is returned. When the certificate is still valid, but for less than"));
printf (" %s\n", _("14 days, a STATE_WARNING is returned. A STATE_CRITICAL will be returned when"));
printf (" %s\n\n", _("the certificate is expired."));
printf (" %s\n", _("the certificate is expired."));
#endif
printf (_(UT_SUPPORT));

View file

@ -1,46 +1,44 @@
/******************************************************************************
* Nagios check_ide_smart plugin
*
* License: GPL
*
* ide-smart 1.3 - IDE S.M.A.R.T. checking tool
* Copyright (C) 1998-1999 Ragnar Hojland Espinosa <ragnar@lightside.dhis.org>
* 1998 Gadi Oxman <gadio@netvision.net.il>
/*****************************************************************************
*
* Nagios 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-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-06-13 10:43:28 +0100 (Wed, 13 Jun 2007) $
*
* Copyright (c) 2000-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_ide_smart plugin
*
* This plugin checks a local hard drive with the (Linux specific) SMART interface
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin checks a local hard drive with the (Linux specific) SMART
* interface
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: check_ide_smart.c 1739 2007-06-13 09:43:28Z psychotrahe $
*/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_ide_smart.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_ide_smart";
const char *revision = "$Revision: 1739 $";
const char *copyright = "2000-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "1998-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -164,6 +162,9 @@ main (int argc, char *argv[])
values_t values;
int fd;
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
static struct option longopts[] = {
{"device", required_argument, 0, 'd'},
{"immediate", no_argument, 0, 'i'},
@ -486,13 +487,14 @@ print_help (void)
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]."));
printf ("\n\n");
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
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"));
@ -505,7 +507,14 @@ print_help (void)
printf (" %s\n", "-0, --auto-off");
printf (" %s\n", _("Turn off automatic offline tests"));
printf (" %s\n", "-n, --nagios");
printf (" %s\n\n", _("Output suitable for Nagios"));
printf (" %s\n", _("Output suitable for Nagios"));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,40 +1,38 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_ldap plugin
*
*
* License: GPL
* Copyright (c) 2000-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-07-07 23:20:40 +0100 (Sat, 07 Jul 2007) $
*
* Copyright (c) 2000-2008 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_ldap plugin
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: check_ldap.c 1753 2007-07-07 22:20:40Z psychotrahe $
******************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_ldap.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
/* progname may be check_ldaps */
char *progname = "check_ldap";
const char *revision = "$Revision: 1753 $";
const char *copyright = "2000-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2000-2008";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -67,6 +65,9 @@ int ld_port = DEFAULT_PORT;
#ifdef HAVE_LDAP_SET_OPTION
int ld_protocol = DEFAULT_PROTOCOL;
#endif
#ifndef LDAP_OPT_SUCCESS
# define LDAP_OPT_SUCCESS LDAP_SUCCESS
#endif
double warn_time = UNDEFINED;
double crit_time = UNDEFINED;
struct timeval tv;
@ -103,7 +104,10 @@ main (int argc, char *argv[])
if (strstr(argv[0],"check_ldaps")) {
asprintf (&progname, "check_ldaps");
}
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -391,11 +395,12 @@ print_help (void)
printf ("Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)\n");
printf (COPYRIGHT, copyright, email);
printf ("\n\n");
printf ("\n\n");
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (_(UT_HOST_PORT), 'p', myport);
@ -412,14 +417,14 @@ print_help (void)
printf (" %s\n", "-T [--starttls]");
printf (" %s\n", _("use starttls mechanism introduced in protocol version 3"));
printf (" %s\n", "-S [--ssl]");
printf (" %s\n", _("use ldaps (ldap v2 ssl method). this also sets the default port to %s"), LDAPS_PORT);
printf (" %s %i\n", _("use ldaps (ldap v2 ssl method). this also sets the default port to"), LDAPS_PORT);
#ifdef HAVE_LDAP_SET_OPTION
printf (" %s\n", "-2 [--ver2]");
printf (" %s\n", _("use ldap protocol version 2"));
printf (" %s\n", "-3 [--ver3]");
printf (" %s\n", _("use ldap protocol version 3"));
printf (" (default protocol version: %d)\n", DEFAULT_PROTOCOL);
printf (" (%s %d)\n", _("default protocol version:"), DEFAULT_PROTOCOL);
#endif
printf (_(UT_WARN_CRIT));
@ -428,12 +433,17 @@ print_help (void)
printf (_(UT_VERBOSE));
printf ("\n%s\n", _("Note:"));
printf ("%s\n", _("If this plugin is called via 'check_ldaps', method 'STARTTLS' will be"));
printf (_("implied (using default port %i) unless --port=636 is specified. In that case %s"), DEFAULT_PORT, "\n");
printf ("%s\n", _("'SSL on connect' will be used no matter how the plugin was called."));
printf ("%s\n", _("This detection is deprecated, please use 'check_ldap' with the '--starttls' or '--ssl' flags"));
printf ("%s\n", _("to define the behaviour explicitly instead."));
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (" %s\n", _("If this plugin is called via 'check_ldaps', method 'STARTTLS' will be"));
printf (_(" implied (using default port %i) unless --port=636 is specified. In that case\n"), DEFAULT_PORT);
printf (" %s\n", _("'SSL on connect' will be used no matter how the plugin was called."));
printf (" %s\n", _("This detection is deprecated, please use 'check_ldap' with the '--starttls' or '--ssl' flags"));
printf (" %s\n", _("to define the behaviour explicitly instead."));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,42 +1,39 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_load plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-12-10 00:19:27 +0000 (Mon, 10 Dec 2007) $
*
* Copyright (c) 1999-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_load plugin
*
* This plugin tests the current system load average.
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin tests the current system load average.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: check_load.c 1851 2007-12-10 00:19:27Z psychotrahe $
******************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_load.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_load";
const char *revision = "$Revision: 1851 $";
const char *copyright = "1999-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "1999-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -122,6 +119,9 @@ main (int argc, char **argv)
textdomain (PACKAGE);
setlocale(LC_NUMERIC, "POSIX");
/* Parse extra opts if any */
argv = np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -306,10 +306,11 @@ print_help (void)
printf (_("This plugin tests the current system load average."));
printf ("\n\n");
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (" %s\n", "-w, --warning=WLOAD1,WLOAD5,WLOAD15");
printf (" %s\n", _("Exit with WARNING status if load average exceeds WLOADn"));
@ -319,6 +320,12 @@ print_help (void)
printf (" %s\n", "-r, --percpu");
printf (" %s\n", _("Divide the load averages by the number of CPUs (when possible)"));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,43 +1,40 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_mrtg plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-02-06 21:03:21 +0000 (Tue, 06 Feb 2007) $
*
* Copyright (c) 1999-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_mrtg plugin
*
* This plugin will check either the average or maximum value of one of the
* two variables recorded in an MRTG log file.
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin will check either the average or maximum value of one of the
* two variables recorded in an MRTG log file.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: check_mrtg.c 1611 2007-02-06 21:03:21Z opensides $
******************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_mrtg.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_mrtg";
const char *revision = "$Revision: 1611 $";
const char *copyright = "1999-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "1999-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -75,6 +72,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments\n"));
@ -326,10 +326,11 @@ print_help (void)
printf ("%s\n", _("two variables recorded in an MRTG log file."));
printf ("\n\n");
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (" %s\n", "-F, --logfile=FILE");
printf (" %s\n", _("The MRTG log file containing the data you want to monitor"));
@ -349,25 +350,30 @@ print_help (void)
printf (" %s\n", _("Option units label for data (Example: Packets/Sec, Errors/Sec,"));
printf (" %s\n", _("\"Bytes Per Second\", \"%% Utilization\")"));
printf ("%s\n", _("If the value exceeds the <vwl> threshold, a WARNING status is returned. If"));
printf ("%s\n", _("the value exceeds the <vcl> threshold, a CRITICAL status is returned. If"));
printf ("%s\n", _("the data in the log file is older than <expire_minutes> old, a WARNING"));
printf ("%s\n", _("status is returned and a warning message is printed."));
printf ("\n");
printf (" %s\n", _("If the value exceeds the <vwl> threshold, a WARNING status is returned. If"));
printf (" %s\n", _("the value exceeds the <vcl> threshold, a CRITICAL status is returned. If"));
printf (" %s\n", _("the data in the log file is older than <expire_minutes> old, a WARNING"));
printf (" %s\n", _("status is returned and a warning message is printed."));
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", _("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."));
printf ("\n");
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", _("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."));
printf ("%s\n", _("Notes:"));
printf (" %s\n", _("- This plugin only monitors one of the two variables stored in the MRTG log"));
printf (" %s\n", _(" file. If you want to monitor both values you will have to define two"));
printf (" %s\n", _(" commands with different values for the <variable> argument. Of course,"));
printf (" %s\n", _("you can always hack the code to make this plugin work for you..."));
printf (" %s\n", _("file. If you want to monitor both values you will have to define two"));
printf (" %s\n", _("commands with different values for the <variable> argument. Of course,"));
printf (" %s\n", _("you can always hack the code to make this plugin work for you..."));
printf (" %s\n", _("- MRTG stands for the Multi Router Traffic Grapher. It can be downloaded from"));
printf (" %s\n", "http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html");
printf (" %s\n", "http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html");
#ifdef NP_EXTRA_OPTS
printf (" -%s", _(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,45 +1,42 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_mrtgtraf plugin
*
*
* License: GPL
* Copyright (c) 1999-2007 nagios-plugins team
*
* Last Modified: $Date: 2007-12-11 05:57:35 +0000 (Tue, 11 Dec 2007) $
*
* Copyright (c) 1999-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_mtrgtraf plugin
*
* This plugin will check the incoming/outgoing transfer rates of a router
* switch, etc recorded in an MRTG log.
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin will check the incoming/outgoing transfer rates of a router
* switch, etc recorded in an MRTG log.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: check_mrtgtraf.c 1861 2007-12-11 05:57:35Z dermoth $
******************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_mrtgtraf.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
#include "common.h"
#include "utils.h"
const char *progname = "check_mrtgtraf";
const char *revision = "$Revision: 1861 $";
const char *revision = "$Revision: 1991 $";
const char *copyright = "1999-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
@ -83,6 +80,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -350,6 +350,7 @@ print_help (void)
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (" %s\n", "-F, --filename=STRING");
printf (" %s\n", _("File to read log from"));
@ -362,6 +363,7 @@ print_help (void)
printf (" %s\n", "-c, --critical");
printf (" %s\n", _("Critical threshold pair <incoming>,<outgoing>"));
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (" %s\n", _("- MRTG stands for Multi Router Traffic Grapher. It can be downloaded from"));
printf (" %s\n", " http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html");
@ -370,6 +372,9 @@ print_help (void)
printf (" %s\n", _("- The calculated i/o rates are a little off from what MRTG actually"));
printf (" %s\n", _(" reports. I'm not sure why this is right now, but will look into it"));
printf (" %s\n", _(" for future enhancements of this plugin."));
#ifdef NP_EXTRA_OPTS
printf (" -%s", _(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,44 +1,41 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_mysql plugin
*
*
* License: GPL
* Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)
* Copyright (c) 1999-2006 nagios-plugins team
* Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net)
*
* Last Modified: $Date: 2007-12-10 07:52:00 +0000 (Mon, 10 Dec 2007) $
* Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)
* Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net)
* Copyright (c) 1999-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_mysql plugin
*
* This program tests connections to a mysql server
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This program tests connections to a mysql server
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: check_mysql.c 1859 2007-12-10 07:52:00Z dermoth $
*
******************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_mysql.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_mysql";
const char *revision = "$Revision: 1859 $";
const char *copyright = "1999-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "1999-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#define SLAVERESULTSIZE 70
@ -53,6 +50,7 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
char *db_user = NULL;
char *db_host = NULL;
char *db_socket = NULL;
char *db_pass = NULL;
char *db = NULL;
unsigned int db_port = MYSQL_PORT;
@ -84,6 +82,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -93,7 +94,7 @@ main (int argc, char **argv)
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,NULL,0)) {
if (!mysql_real_connect(&mysql,db_host,db_user,db_pass,db,db_port,db_socket,0)) {
if (mysql_errno (&mysql) == CR_UNKNOWN_HOST)
die (STATE_WARNING, "%s\n", mysql_error (&mysql));
else if (mysql_errno (&mysql) == CR_VERSION_ERROR)
@ -246,6 +247,7 @@ process_arguments (int argc, char **argv)
int option = 0;
static struct option longopts[] = {
{"hostname", required_argument, 0, 'H'},
{"socket", required_argument, 0, 's'},
{"database", required_argument, 0, 'd'},
{"username", required_argument, 0, 'u'},
{"password", required_argument, 0, 'p'},
@ -263,7 +265,7 @@ process_arguments (int argc, char **argv)
return ERROR;
while (1) {
c = getopt_long (argc, argv, "hvVSP:p:u:d:H:c:w:", longopts, &option);
c = getopt_long (argc, argv, "hvVSP:p:u:d:H:s:c:w:", longopts, &option);
if (c == -1 || c == EOF)
break;
@ -277,14 +279,23 @@ process_arguments (int argc, char **argv)
usage2 (_("Invalid hostname/address"), optarg);
}
break;
case 'd': /* hostname */
case 's': /* socket */
db_socket = optarg;
break;
case 'd': /* database */
db = optarg;
break;
case 'u': /* username */
db_user = optarg;
break;
case 'p': /* authentication information: password */
db_pass = optarg;
db_pass = strdup(optarg);
/* Delete the password from process list */
while (*optarg != '\0') {
*optarg = 'X';
optarg++;
}
break;
case 'P': /* critical time threshold */
db_port = atoi (optarg);
@ -373,29 +384,43 @@ print_help (void)
printf ("%s\n", _("This program tests connections to a mysql server"));
printf ("\n\n");
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (_(UT_HOST_PORT), 'P', myport);
printf (_(UT_HOST_PORT), 'P', myport);
printf (" %s\n", "-s, --socket=STRING");
printf (" %s\n", _("Use the specified socket (has no effect if -H is used)"));
printf (" %s\n", "-d, --database=STRING");
printf (" %s\n", "-d, --database=STRING");
printf (" %s\n", _("Check database with indicated name"));
printf (" %s\n", "-u, --username=STRING");
printf (" %s\n", _("Connect using the indicated username"));
printf (" %s\n", "-p, --password=STRING");
printf (" %s\n", _("Use the indicated password to authenticate the connection"));
printf (" %s\n", _("==> IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!! <=="));
printf (" %s\n", _("Your clear-text password will be visible as a process table entry"));
printf (" ==> %s <==\n", _("IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!!"));
printf (" %s\n", _("Your clear-text password could be visible as a process table entry"));
printf (" %s\n", "-S, --check-slave");
printf (" %s\n", _("Check if the slave thread is running properly."));
printf (" %s\n", "-w, --warning");
printf (" %s\n", _("Exit with WARNING status if slave server is more than INTEGER seconds behind master"));
printf (" %s\n", _("Exit with WARNING status if slave server is more than INTEGER seconds"));
printf (" %s\n", _("behind master"));
printf (" %s\n", "-c, --critical");
printf (" %s\n", _("Exit with CRITICAL status if slave server is more then INTEGER seconds behind master"));
printf (" %s\n", _("There are no required arguments. By default, the local database with"));
printf (_("a server listening on MySQL standard port %d will be checked\n"), MYSQL_PORT);
printf (" %s\n", _("Exit with CRITICAL status if slave server is more then INTEGER seconds"));
printf (" %s\n", _("behind master"));
printf ("\n");
printf (" %s\n", _("There are no required arguments. By default, the local database is checked"));
printf (" %s\n", _("using the default unix socket. You can force TCP on localhost by using an"));
printf (" %s\n", _("IP address or FQDN ('localhost' will use the socket as well)."));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}
@ -405,5 +430,6 @@ void
print_usage (void)
{
printf (_("Usage:"));
printf ("%s [-d database] [-H host] [-P port] [-u user] [-p password] [-S]\n",progname);
printf (" %s [-d database] [-H host] [-P port] [-s socket]\n",progname);
printf (" [-u user] [-p password] [-S]\n");
}

View file

@ -1,42 +1,40 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_mysql_query plugin
*
*
* License: GPL
* Copyright (c) 2006 nagios-plugins team, after Didi Rieder (check_mysql)
*
* Last Modified: $Date: 2007-01-28 21:46:41 +0000 (Sun, 28 Jan 2007) $
*
* Copyright (c) 2006-2007 Nagios Plugins Development Team
* Original code from check_mysql, copyright 1999 Didi Rieder
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_mysql_query plugin
*
* This plugin is for running arbitrary SQL and checking the results
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin is for running arbitrary SQL and checking the results
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* CHECK_MYSQL_QUERY.C
*
* $Id: check_mysql_query.c 1590 2007-01-28 21:46:41Z hweiss $
*
******************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_mysql_query.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_mysql_query";
const char *revision = "$Revision: 1590 $";
const char *copyright = "2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "1999-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -49,6 +47,7 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
char *db_user = NULL;
char *db_host = NULL;
char *db_socket = NULL;
char *db_pass = NULL;
char *db = NULL;
unsigned int db_port = MYSQL_PORT;
@ -79,6 +78,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -88,7 +90,7 @@ main (int argc, char **argv)
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,NULL,0)) {
if (!mysql_real_connect(&mysql,db_host,db_user,db_pass,db,db_port,db_socket,0)) {
if (mysql_errno (&mysql) == CR_UNKNOWN_HOST)
die (STATE_WARNING, "QUERY %s: %s\n", _("WARNING"), mysql_error (&mysql));
else if (mysql_errno (&mysql) == CR_VERSION_ERROR)
@ -172,6 +174,7 @@ process_arguments (int argc, char **argv)
int option = 0;
static struct option longopts[] = {
{"hostname", required_argument, 0, 'H'},
{"socket", required_argument, 0, 's'},
{"database", required_argument, 0, 'd'},
{"username", required_argument, 0, 'u'},
{"password", required_argument, 0, 'p'},
@ -189,7 +192,7 @@ process_arguments (int argc, char **argv)
return ERROR;
while (1) {
c = getopt_long (argc, argv, "hvVSP:p:u:d:H:q:w:c:", longopts, &option);
c = getopt_long (argc, argv, "hvVSP:p:u:d:H:s:q:w:c:", longopts, &option);
if (c == -1 || c == EOF)
break;
@ -203,14 +206,17 @@ process_arguments (int argc, char **argv)
usage2 (_("Invalid hostname/address"), optarg);
}
break;
case 'd': /* hostname */
case 's': /* socket */
db_socket = optarg;
break;
case 'd': /* database */
db = optarg;
break;
case 'u': /* username */
db_user = optarg;
break;
case 'p': /* authentication information: password */
asprintf(&db_pass, "%s", optarg);
db_pass = strdup(optarg);
/* Delete the password from process list */
while (*optarg != '\0') {
@ -291,10 +297,13 @@ print_help (void)
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (" -q, --query=STRING\n");
printf (" %s\n", _("SQL query to run. Only first column in first row will be read"));
printf (_(UT_WARN_CRIT_RANGE));
printf (_(UT_HOST_PORT), 'P', myport);
printf (" %s\n", "-s, --socket=STRING");
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 (" -u, --username=STRING\n");
@ -302,11 +311,17 @@ print_help (void)
printf (" -p, --password=STRING\n");
printf (" %s\n", _("Password to login with"));
printf (" ==> %s <==\n", _("IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!!"));
printf (" %s\n", _("Your clear-text password could be visible as a process table entry"));
printf ("\n");
printf (" %s\n", _("A query is required. The result from the query should be numeric."));
printf (" %s\n", _("For extra security, create a user with minimal access."));
printf ("%s\n", _("A query is required. The result from the query should be numeric."));
printf ("%s\n", _("For extra security, create a user with minimal access."));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}
@ -316,6 +331,6 @@ void
print_usage (void)
{
printf (_("Usage:"));
printf ("%s -q SQL_query [-w warn] [-c crit]\n",progname);
printf ("[-d database] [-H host] [-P port] [-u user] [-p password]\n");
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");
}

View file

@ -1,45 +1,43 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_nagios plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-01-28 21:46:41 +0000 (Sun, 28 Jan 2007) $
*
* Copyright (c) 1999-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_nagios plugin
*
* This plugin checks the status of the Nagios process on the local machine
* The plugin will check to make sure the Nagios status log is no older than
* the number of minutes specified by the expires option.
* It also checks the process table for a process matching the command argument.
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin checks the status of the Nagios process on the local machine.
* The plugin will check to make sure the Nagios status log is no older than
* the number of minutes specified by the expires option.
* It also checks the process table for a process matching the command
* argument.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: check_nagios.c 1590 2007-01-28 21:46:41Z hweiss $
******************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_nagios.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_nagios";
const char *revision = "$Revision: 1590 $";
const char *copyright = "1999-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "1999-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -90,6 +88,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage_va(_("Could not parse arguments"));
@ -287,10 +288,11 @@ print_help (void)
printf ("%s\n", _("It also checks the process table for a process matching the command argument."));
printf ("\n\n");
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (" %s\n", "-F, --filename=FILE");
printf (" %s\n", _("Name of the log file to check"));
@ -299,9 +301,17 @@ print_help (void)
printf (" %s\n", "-C, --command=STRING");
printf (" %s\n", _("Substring to search for in process arguments"));
printf (_(UT_VERBOSE));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf ("\n");
printf ("%s\n", _("Examples:"));
printf (" %s\n", "check_nagios -e 5 -F /usr/local/nagios/var/status.log -C /usr/local/nagios/bin/nagios");
printf (_(UT_SUPPORT));
}

View file

@ -1,44 +1,43 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_nt plugin
*
*
* License: GPL
* Copyright (c) 2000-2002 Yves Rubin (rubiyz@yahoo.com)
* Copyright (c) 2003-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-01-28 21:46:41 +0000 (Sun, 28 Jan 2007) $
*
* Copyright (c) 2003-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_nt plugin
*
* This plugin collects data from the NSClient service running on a
* Windows NT/2000/XP/2003 server.
* This requires NSClient software to run on NT (http://nsclient.ready2run.nl/)
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin collects data from the NSClient service running on a
* Windows NT/2000/XP/2003 server.
* This plugin requires NSClient software to run on NT
* (http://nsclient.ready2run.nl/)
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: check_nt.c 1590 2007-01-28 21:46:41Z hweiss $
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_nt.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_nt";
const char *revision = "$Revision: 1590 $";
const char *copyright = "2003-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2000-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -55,7 +54,8 @@ enum checkvars {
CHECK_PROCSTATE,
CHECK_MEMUSE,
CHECK_COUNTER,
CHECK_FILEAGE
CHECK_FILEAGE,
CHECK_INSTANCES
};
enum {
@ -122,6 +122,9 @@ int main(int argc, char **argv){
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if(process_arguments(argc,argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -157,7 +160,7 @@ int main(int argc, char **argv){
return_code=STATE_OK;
temp_string = strdup (_("CPU Load"));
temp_string_perf = strdup (" ");
/* loop until one of the parameters is wrong or not present */
while (lvalue_list[0+offset]> (unsigned long)0 &&
lvalue_list[0+offset]<=(unsigned long)17280 &&
@ -185,7 +188,7 @@ int main(int argc, char **argv){
asprintf(&temp_string_perf,"%s%s",temp_string_perf,perfdata);
offset+=3; /* move across the array */
}
if (strlen(temp_string)>10) { /* we had at least one loop */
output_message = strdup (temp_string);
perfdata = temp_string_perf;
@ -414,7 +417,7 @@ int main(int argc, char **argv){
return_code=STATE_WARNING;
else
return_code=STATE_OK;
}
}
else { /* inverse thresholds */
if(check_critical_value==TRUE && age_in_minutes <= critical_value)
return_code=STATE_CRITICAL;
@ -426,6 +429,21 @@ int main(int argc, char **argv){
}
break;
case CHECK_INSTANCES:
if (value_list==NULL)
output_message = strdup (_("No counter specified"));
else {
asprintf(&send_buffer,"%s&10&%s", req_password,value_list);
fetch_data (server_address, server_port, send_buffer);
if (!strncmp(recv_buffer,"ERROR",5)) {
printf("NSClient - %s\n",recv_buffer);
exit(STATE_UNKNOWN);
}
asprintf(&output_message,"%s",recv_buffer);
return_code=STATE_OK;
}
break;
case CHECK_NONE:
default:
usage4 (_("Please specify a variable to check"));
@ -483,14 +501,13 @@ int process_arguments(int argc, char **argv){
strcpy(argv[c],"-c");
}
while (1){
while (1) {
c = getopt_long(argc,argv,"+hVH:t:c:w:p:v:l:s:d:",longopts,&option);
if (c==-1||c==EOF||c==1)
break;
switch (c)
{
switch (c) {
case '?': /* print short usage statement if args not parsable */
usage5 ();
case 'h': /* help */
@ -533,6 +550,8 @@ int process_arguments(int argc, char **argv){
vars_to_check=CHECK_COUNTER;
else if(!strcmp(optarg,"FILEAGE"))
vars_to_check=CHECK_FILEAGE;
else if(!strcmp(optarg,"INSTANCES"))
vars_to_check=CHECK_INSTANCES;
else
return ERROR;
break;
@ -624,12 +643,13 @@ void print_help(void)
printf ("%s\n", _("Windows NT/2000/XP/2003 server."));
printf ("\n\n");
print_usage();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf ("%s\n", _("Options:"));
printf ("%s\n", _("Options:"));
printf (" %s\n", "-H, --hostname=HOST");
printf (" %s\n", _("Name of the host to check"));
printf (" %s\n", "-p, --port=INTEGER");
@ -671,7 +691,7 @@ void print_help(void)
printf (" %s\n", "MEMUSE =");
printf (" %s\n", _("Memory use."));
printf (" %s\n", _("Warning and critical thresholds can be specified with -w and -c."));
printf (" %s\n,", "SERVICESTATE =");
printf (" %s\n", "SERVICESTATE =");
printf (" %s\n", _("Check the state of one or several services."));
printf (" %s\n", _("Request a -l parameters with the following syntax:"));
printf (" %s\n", _("-l <service1>,<service2>,<service3>,..."));
@ -686,18 +706,38 @@ void print_help(void)
printf (" %s\n", _("-l \"\\\\<performance object>\\\\counter\",\"<description>"));
printf (" %s\n", _("The <description> parameter is optional and is given to a printf "));
printf (" %s\n", _("output command which requires a float parameter."));
printf (" %s\n\n", _("If <description> does not include \"%%\", it is used as a label."));
printf (" %s\n", _("If <description> does not include \"%%\", it is used as a label."));
printf (" %s\n", _("Some examples:"));
printf (" %s\n", "\"Paging file usage is %%.2f %%%%\"");
printf (" %s\n\n", "\"%%.f %%%% paging file used.\"");
printf (_("Notes:"));
printf (" %s\n", "\"%%.f %%%% paging file used.\"");
printf (" %s\n", "INSTANCES =");
printf (" %s\n", _("Check any performance counter object of Windows NT/2000."));
printf (" %s\n", _("Syntax: check_nt -H <hostname> -p <port> -v INSTANCES -l <counter object>"));
printf (" %s\n", _("<counter object> is a Windows Perfmon Counter object (eg. Process),"));
printf (" %s\n", _("if it is two words, it should be enclosed in quotes"));
printf (" %s\n", _("The returned results will be a comma-separated list of instances on "));
printf (" %s\n", _(" the selected computer for that object."));
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", _(" configuration files."));
printf (" %s\n", _("Some examples:"));
printf (" %s\n\n", _("check_nt -H 192.168.1.1 -p 1248 -v INSTANCES -l Process"));
printf ("%s\n", _("Notes:"));
printf (" %s\n", _("- The NSClient service should be running on the server to get any information"));
printf (" %s\n", "(http://nsclient.ready2run.nl).");
printf (" %s\n", "(http://nsclient.ready2run.nl).");
printf (" %s\n", _("- Critical thresholds should be lower than warning thresholds"));
printf (" %s\n", _("- Default port 1248 is sometimes in use by other services. The error"));
printf (" %s\n", _("output when this happens contains \"Cannot map xxxxx to protocol number\"."));
printf (" %s\n", _("One fix for this is to change the port to something else on check_nt "));
printf (" %s\n", _("and on the client service it\'s connecting to."));
printf (" %s\n", _("output when this happens contains \"Cannot map xxxxx to protocol number\"."));
printf (" %s\n", _("One fix for this is to change the port to something else on check_nt "));
printf (" %s\n", _("and on the client service it\'s connecting to."));
#ifdef NP_EXTRA_OPTS
printf (" -%s", _(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,44 +1,41 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_ntp plugin
*
*
* License: GPL
* Copyright (c) 2006 sean finney <seanius@seanius.net>
* Copyright (c) 2007 nagios-plugins team
*
* Last Modified: $Date: 2007-12-11 05:57:35 +0000 (Tue, 11 Dec 2007) $
*
* Copyright (c) 2006 Sean Finney <seanius@seanius.net>
* Copyright (c) 2006-2008 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_ntp plugin
*
* This plugin to check ntp servers independant of any commandline
* programs or external libraries.
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin to check ntp servers independant of any commandline
* programs or external libraries.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: check_ntp.c 1861 2007-12-11 05:57:35Z dermoth $
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_ntp.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_ntp";
const char *revision = "$Revision: 1861 $";
const char *copyright = "2007";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2006-2008";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -302,50 +299,52 @@ void setup_request(ntp_message *p){
* this is done by filtering servers based on stratum, dispersion, and
* finally round-trip delay. */
int best_offset_server(const ntp_server_results *slist, int nservers){
int i=0, j=0, cserver=0, candidates[5], csize=0;
int i=0, cserver=0, best_server=-1;
/* for each server */
for(cserver=0; cserver<nservers; cserver++){
/* sort out servers with error flags */
if ( LI(slist[cserver].flags) != LI_NOWARNING ){
if (verbose) printf("discarding peer id %d: flags=%d\n", cserver, LI(slist[cserver].flags));
break;
/* We don't want any servers that fails these tests */
/* Sort out servers that didn't respond or responede with a 0 stratum;
* stratum 0 is for reference clocks so no NTP server should ever report
* a stratum 0 */
if ( slist[cserver].stratum == 0){
if (verbose) printf("discarding peer %d: stratum=%d\n", cserver, slist[cserver].stratum);
continue;
}
/* Sort out servers with error flags */
if ( LI(slist[cserver].flags) == LI_ALARM ){
if (verbose) printf("discarding peer %d: flags=%d\n", cserver, LI(slist[cserver].flags));
continue;
}
/* compare it to each of the servers already in the candidate list */
for(i=0; i<csize; i++){
/* does it have an equal or better stratum? */
if(slist[cserver].stratum <= slist[i].stratum){
/* does it have an equal or better dispersion? */
if(slist[cserver].rtdisp <= slist[i].rtdisp){
/* does it have a better rtdelay? */
if(slist[cserver].rtdelay < slist[i].rtdelay){
break;
}
/* If we don't have a server yet, use the first one */
if (best_server == -1) {
best_server = cserver;
DBG(printf("using peer %d as our first candidate\n", best_server));
continue;
}
/* compare the server to the best one we've seen so far */
/* does it have an equal or better stratum? */
DBG(printf("comparing peer %d with peer %d\n", cserver, best_server));
if(slist[cserver].stratum <= slist[best_server].stratum){
DBG(printf("stratum for peer %d <= peer %d\n", cserver, best_server));
/* does it have an equal or better dispersion? */
if(slist[cserver].rtdisp <= slist[best_server].rtdisp){
DBG(printf("dispersion for peer %d <= peer %d\n", cserver, best_server));
/* does it have a better rtdelay? */
if(slist[cserver].rtdelay < slist[best_server].rtdelay){
DBG(printf("rtdelay for peer %d < peer %d\n", cserver, best_server));
best_server = cserver;
DBG(printf("peer %d is now our best candidate\n", best_server));
}
}
}
/* if we haven't reached the current list's end, move everyone
* over one to the right, and insert the new candidate */
if(i<csize){
for(j=5; j>i; j--){
candidates[j]=candidates[j-1];
}
}
/* regardless, if they should be on the list... */
if(i<5) {
candidates[i]=cserver;
if(csize<5) csize++;
/* otherwise discard the server */
} else {
DBG(printf("discarding peer id %d\n", cserver));
}
}
if(csize>0) {
DBG(printf("best server selected: peer %d\n", candidates[0]));
return candidates[0];
if(best_server >= 0) {
DBG(printf("best server selected: peer %d\n", best_server));
return best_server;
} else {
DBG(printf("no peers meeting synchronization criteria :(\n"));
return -1;
@ -392,6 +391,7 @@ double offset_request(const char *host, int *status){
servers=(ntp_server_results*)malloc(sizeof(ntp_server_results)*num_hosts);
if(servers==NULL) die(STATE_UNKNOWN, "can not allocate server array");
memset(servers, 0, sizeof(ntp_server_results)*num_hosts);
DBG(printf("Found %d peers to check\n", num_hosts));
/* setup each socket for writing, and the corresponding struct pollfd */
ai_tmp=ai;
@ -763,6 +763,9 @@ int main(int argc, char *argv[]){
result = offset_result = jitter_result = STATE_OK;
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -837,45 +840,54 @@ void print_help(void){
printf ("Copyright (c) 2006 Sean Finney\n");
printf (COPYRIGHT, copyright, email);
printf ("%s\n", _("This plugin checks the selected ntp server"));
printf ("\n\n");
printf ("%s\n", _("This plugin checks the selected ntp server"));
printf ("\n\n");
print_usage();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (_(UT_HOST_PORT), 'p', "123");
printf (" %s\n", "-w, --warning=THRESHOLD");
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 (" %s\n", "-j, --warning=THRESHOLD");
printf (" %s\n", "-j, --jwarn=THRESHOLD");
printf (" %s\n", _("Warning threshold for jitter"));
printf (" %s\n", "-k, --critical=THRESHOLD");
printf (" %s\n", "-k, --jcrit=THRESHOLD");
printf (" %s\n", _("Critical threshold for jitter"));
printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
printf (_(UT_VERBOSE));
printf("\n");
printf("%s\n", _("Notes:"));
printf(" %s\n", _("See:"));
printf(" %s\n", ("http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT"));
printf(" %s\n", _("for THRESHOLD format and examples."));
printf(_(UT_THRESHOLDS_NOTES));
#ifdef NP_EXTRA_OPTS
printf("\n");
printf(_(UT_EXTRA_OPTS_NOTES));
#endif
printf("\n");
printf("%s\n", _("Examples:"));
printf(" %s\n", _("Normal offset check:"));
printf(" %s\n", ("./check_ntp -H ntpserv -w 0.5 -c 1"));
printf("\n");
printf(" %s\n", _("Check jitter too, avoiding critical notifications if jitter isn't available"));
printf(" %s\n", _("(See Notes above for more details on thresholds formats):"));
printf(" %s\n", ("./check_ntp -H ntpserv -w 0.5 -c 1 -j -1:100 -k -1:200"));
printf (_(UT_SUPPORT));
printf ("%s\n", _("WARNING: check_ntp is deprecated. Please use check_ntp_peer or"));
printf ("%s\n\n", _("check_ntp_time istead."));
}
void
print_usage(void)
{
printf (_("Usage:"));
printf(" %s -H <host> [-w <warn>] [-c <crit>] [-j <warn>] [-k <crit>] [-v verbose]\n", progname);
printf ("%s\n", _("WARNING: check_ntp is deprecated. Please use check_ntp_peer or"));
printf ("%s\n\n", _("check_ntp_time istead."));
printf (_("Usage:"));
printf(" %s -H <host> [-w <warn>] [-c <crit>] [-j <warn>] [-k <crit>] [-v verbose]\n", progname);
}

View file

@ -1,49 +1,46 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_ntp_peer plugin
*
*
* License: GPL
* Copyright (c) 2006 sean finney <seanius@seanius.net>
* Copyright (c) 2007 nagios-plugins team
*
* Last Modified: $Date: 2007-12-11 13:31:22 +0000 (Tue, 11 Dec 2007) $
*
* Copyright (c) 2006 Sean Finney <seanius@seanius.net>
* Copyright (c) 2006-2008 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_ntp_peer plugin
*
* This plugin checks an NTP server independent of any commandline
* programs or external libraries.
*
* Use this plugin to check the health of an NTP server. It supports
* checking the offset with the sync peer, the jitter and stratum. This
* plugin will not check the clock offset between the local host and NTP
* server; please use check_ntp_time for that purpose.
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin checks an NTP server independent of any commandline
* programs or external libraries.
*
* Use this plugin to check the health of an NTP server. It supports
* checking the offset with the sync peer, the jitter and stratum. This
* plugin will not check the clock offset between the local host and NTP
* server; please use check_ntp_time for that purpose.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: check_ntp_peer.c 1864 2007-12-11 13:31:22Z dermoth $
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_ntp_peer.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_ntp_peer";
const char *revision = "$Revision: 1864 $";
const char *copyright = "2007";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2006-2008";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -63,6 +60,7 @@ static short do_jitter=0;
static char *jwarn="-1:5000";
static char *jcrit="-1:10000";
static int syncsource_found=0;
static int li_alarm=0;
int process_arguments (int, char **);
thresholds *offset_thresholds = NULL;
@ -267,6 +265,7 @@ int ntp_request(const char *host, double *offset, int *offset_result, double *ji
if(read(conn, &req, SIZEOF_NTPCM(req)) == -1)
die(STATE_CRITICAL, "NTP CRITICAL: No response from NTP server\n");
DBG(print_ntp_control_message(&req));
if (LI(req.flags) == LI_ALARM) li_alarm = 1;
/* Each peer identifier is 4 bytes in the data section, which
* we represent as a ntp_assoc_status_pair datatype.
*/
@ -297,6 +296,10 @@ int ntp_request(const char *host, double *offset, int *offset_result, double *ji
status = STATE_WARNING;
if(verbose) printf("warning: no synchronization source found\n");
}
if(li_alarm){
status = STATE_WARNING;
if(verbose) printf("warning: LI_ALARM bit is set\n");
}
for (i = 0; i < npeers; i++){
@ -549,6 +552,9 @@ int main(int argc, char *argv[]){
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -597,6 +603,8 @@ int main(int argc, char *argv[]){
}
if(!syncsource_found)
asprintf(&result_line, "%s %s,", result_line, _("Server not synchronized"));
else if(li_alarm)
asprintf(&result_line, "%s %s,", result_line, _("Server has the LI_ALARM bit set"));
if(offset_result == STATE_UNKNOWN){
asprintf(&result_line, "%s %s", result_line, _("Offset unknown"));
@ -633,6 +641,7 @@ void print_help(void){
print_usage();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (_(UT_HOST_PORT), 'p', "123");
printf (" %s\n", "-q, --quiet");
printf (" %s\n", _("Returns UNKNOWN instead of CRITICAL or WARNING if server isn't synchronized"));
@ -640,37 +649,42 @@ 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 (" %s\n", "-W, --warning=THRESHOLD");
printf (" %s\n", "-W, --swarn=THRESHOLD");
printf (" %s\n", _("Warning threshold for stratum"));
printf (" %s\n", "-W, --critical=THRESHOLD");
printf (" %s\n", "-C, --scrit=THRESHOLD");
printf (" %s\n", _("Critical threshold for stratum"));
printf (" %s\n", "-j, --warning=THRESHOLD");
printf (" %s\n", "-j, --jwarn=THRESHOLD");
printf (" %s\n", _("Warning threshold for jitter"));
printf (" %s\n", "-k, --critical=THRESHOLD");
printf (" %s\n", "-k, --jcrit=THRESHOLD");
printf (" %s\n", _("Critical threshold for jitter"));
printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
printf (_(UT_VERBOSE));
printf("\n");
printf("%s\n", _("This plugin checks an NTP server independent of any commandline"));
printf("%s\n\n", _("programs or external libraries."));
printf("%s\n", _("Notes:"));
printf(" %s\n", _("This plugin checks an NTP server independent of any commandline"));
printf(" %s\n\n", _("programs or external libraries."));
printf(" %s\n", _("Use this plugin to check the health of an NTP server. It supports"));
printf(" %s\n", _("checking the offset with the sync peer, the jitter and stratum. This"));
printf(" %s\n", _("plugin will not check the clock offset between the local host and NTP"));
printf(" %s\n\n", _("server; please use check_ntp_time for that purpose."));
printf(" %s\n", _("See:"));
printf(" %s\n", ("http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT"));
printf(" %s\n", _("for THRESHOLD format and examples."));
printf(" %s\n", _("server; please use check_ntp_time for that purpose."));
printf("\n");
printf(_(UT_THRESHOLDS_NOTES));
#ifdef NP_EXTRA_OPTS
printf("\n");
printf(_(UT_EXTRA_OPTS_NOTES));
#endif
printf("\n");
printf("%s\n", _("Examples:"));
printf(" %s\n", _("Simple NTP server check:"));
printf(" %s\n", ("./check_ntp_peer -H ntpserv -w 0.5 -c 1"));
printf("\n");
printf(" %s\n", _("Check jitter too, avoiding critical notifications if jitter isn't available"));
printf(" %s\n", _("(See Notes above for more details on thresholds formats):"));
printf(" %s\n", ("./check_ntp_peer -H ntpserv -w 0.5 -c 1 -j -1:100 -k -1:200"));
printf("\n");
printf(" %s\n", _("Check only stratum:"));
printf(" %s\n", ("./check_ntp_peer -H ntpserv -W 4 -C 6"));

View file

@ -1,48 +1,45 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_ntp_time plugin
*
*
* License: GPL
* Copyright (c) 2006 sean finney <seanius@seanius.net>
* Copyright (c) 2007 nagios-plugins team
*
* Last Modified: $Date: 2007-12-11 05:57:35 +0000 (Tue, 11 Dec 2007) $
*
* Copyright (c) 2006 Sean Finney <seanius@seanius.net>
* Copyright (c) 2006-2008 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_ntp_time plugin
*
* This plugin checks the clock offset between the local host and a
* remote NTP server. It is independent of any commandline programs or
* external libraries.
*
* If you'd rather want to monitor an NTP server, please use
* check_ntp_peer.
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin checks the clock offset between the local host and a
* remote NTP server. It is independent of any commandline programs or
* external libraries.
*
* If you'd rather want to monitor an NTP server, please use
* check_ntp_peer.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: check_ntp_time.c 1861 2007-12-11 05:57:35Z dermoth $
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_ntp_time.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_ntp_time";
const char *revision = "$Revision: 1861 $";
const char *copyright = "2007";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2006-2008";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -247,50 +244,52 @@ void setup_request(ntp_message *p){
* this is done by filtering servers based on stratum, dispersion, and
* finally round-trip delay. */
int best_offset_server(const ntp_server_results *slist, int nservers){
int i=0, j=0, cserver=0, candidates[5], csize=0;
int i=0, cserver=0, best_server=-1;
/* for each server */
for(cserver=0; cserver<nservers; cserver++){
/* sort out servers with error flags */
if ( LI(slist[cserver].flags) != LI_NOWARNING ){
if (verbose) printf("discarding peer id %d: flags=%d\n", cserver, LI(slist[cserver].flags));
break;
/* We don't want any servers that fails these tests */
/* Sort out servers that didn't respond or responede with a 0 stratum;
* stratum 0 is for reference clocks so no NTP server should ever report
* a stratum 0 */
if ( slist[cserver].stratum == 0){
if (verbose) printf("discarding peer %d: stratum=%d\n", cserver, slist[cserver].stratum);
continue;
}
/* Sort out servers with error flags */
if ( LI(slist[cserver].flags) == LI_ALARM ){
if (verbose) printf("discarding peer %d: flags=%d\n", cserver, LI(slist[cserver].flags));
continue;
}
/* compare it to each of the servers already in the candidate list */
for(i=0; i<csize; i++){
/* does it have an equal or better stratum? */
if(slist[cserver].stratum <= slist[i].stratum){
/* does it have an equal or better dispersion? */
if(slist[cserver].rtdisp <= slist[i].rtdisp){
/* does it have a better rtdelay? */
if(slist[cserver].rtdelay < slist[i].rtdelay){
break;
}
/* If we don't have a server yet, use the first one */
if (best_server == -1) {
best_server = cserver;
DBG(printf("using peer %d as our first candidate\n", best_server));
continue;
}
/* compare the server to the best one we've seen so far */
/* does it have an equal or better stratum? */
DBG(printf("comparing peer %d with peer %d\n", cserver, best_server));
if(slist[cserver].stratum <= slist[best_server].stratum){
DBG(printf("stratum for peer %d <= peer %d\n", cserver, best_server));
/* does it have an equal or better dispersion? */
if(slist[cserver].rtdisp <= slist[best_server].rtdisp){
DBG(printf("dispersion for peer %d <= peer %d\n", cserver, best_server));
/* does it have a better rtdelay? */
if(slist[cserver].rtdelay < slist[best_server].rtdelay){
DBG(printf("rtdelay for peer %d < peer %d\n", cserver, best_server));
best_server = cserver;
DBG(printf("peer %d is now our best candidate\n", best_server));
}
}
}
/* if we haven't reached the current list's end, move everyone
* over one to the right, and insert the new candidate */
if(i<csize){
for(j=5; j>i; j--){
candidates[j]=candidates[j-1];
}
}
/* regardless, if they should be on the list... */
if(i<5) {
candidates[i]=cserver;
if(csize<5) csize++;
/* otherwise discard the server */
} else {
DBG(printf("discarding peer id %d\n", cserver));
}
}
if(csize>0) {
DBG(printf("best server selected: peer %d\n", candidates[0]));
return candidates[0];
if(best_server >= 0) {
DBG(printf("best server selected: peer %d\n", best_server));
return best_server;
} else {
DBG(printf("no peers meeting synchronization criteria :(\n"));
return -1;
@ -337,6 +336,7 @@ double offset_request(const char *host, int *status){
servers=(ntp_server_results*)malloc(sizeof(ntp_server_results)*num_hosts);
if(servers==NULL) die(STATE_UNKNOWN, "can not allocate server array");
memset(servers, 0, sizeof(ntp_server_results)*num_hosts);
DBG(printf("Found %d peers to check\n", num_hosts));
/* setup each socket for writing, and the corresponding struct pollfd */
ai_tmp=ai;
@ -540,6 +540,9 @@ int main(int argc, char *argv[]){
result = offset_result = STATE_OK;
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -597,6 +600,7 @@ void print_help(void){
print_usage();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (_(UT_HOST_PORT), 'p', "123");
printf (" %s\n", "-q, --quiet");
printf (" %s\n", _("Returns UNKNOWN instead of CRITICAL if offset cannot be found"));
@ -608,16 +612,20 @@ void print_help(void){
printf (_(UT_VERBOSE));
printf("\n");
printf("%s\n", _("Notes:"));
printf(" %s\n", _("This plugin checks the clock offset between the local host and a"));
printf(" %s\n", _("remote NTP server. It is independent of any commandline programs or"));
printf(" %s\n\n", _("external libraries."));
printf(" %s\n", _("If you'd rather want to monitor an NTP server, please use"));
printf(" %s\n\n", _("check_ntp_peer."));
printf("%s\n", _("This plugin checks the clock offset between the local host and a"));
printf("%s\n", _("remote NTP server. It is independent of any commandline programs or"));
printf("%s\n", _("external libraries."));
printf(" %s\n", _("See:"));
printf(" %s\n", ("http://nagiosplug.sourceforge.net/developer-guidelines.html#THRESHOLDFORMAT"));
printf(" %s\n", _("for THRESHOLD format and examples."));
printf("\n");
printf("%s\n", _("Notes:"));
printf(" %s\n", _("If you'd rather want to monitor an NTP server, please use"));
printf(" %s\n", _("check_ntp_peer."));
printf("\n");
printf(_(UT_THRESHOLDS_NOTES));
#ifdef NP_EXTRA_OPTS
printf("\n");
printf(_(UT_EXTRA_OPTS_NOTES));
#endif
printf("\n");
printf("%s\n", _("Examples:"));
@ -630,7 +638,6 @@ void
print_usage(void)
{
printf (_("Usage:"));
printf(" %s -H <host> [-w <warn>] [-c <crit>] [-W <warn>] [-C <crit>]\n", progname);
printf(" [-j <warn>] [-k <crit>] [-v verbose]\n");
printf(" %s -H <host> [-w <warn>] [-c <crit>] [-v verbose]\n", progname);
}

View file

@ -1,43 +1,40 @@
/******************************************************************************
*
* Nagios check_nwstat plugin
*
* License: GPL
* Copyright (c) 2000-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-01-28 21:46:41 +0000 (Sun, 28 Jan 2007) $
*
* Description:
*
* This file contains the check_nwstat plugin
*
* This plugin attempts to contact the MRTGEXT NLM running on a
* Novell server to gather the requested system information.
/*****************************************************************************
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
* Nagios check_nwstat plugin
*
* License: GPL
* Copyright (c) 2000-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
* This file contains the check_nwstat plugin
*
* This plugin attempts to contact the MRTGEXT NLM running on a
* Novell server to gather the requested system information.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: check_nwstat.c 1590 2007-01-28 21:46:41Z hweiss $
******************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_nwstat.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_nwstat";
const char *revision = "$Revision: 1590 $";
const char *copyright = "2000-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2000-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -173,6 +170,9 @@ main(int argc, char **argv) {
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts(&argc, argv, progname);
if (process_arguments(argc,argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -521,14 +521,14 @@ main(int argc, char **argv) {
result=STATE_OK;
else
result=STATE_WARNING;
close(sd);
my_tcp_connect (server_address, server_port, &sd);
send_buffer = strdup ("S13\r\n");
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
temp_buffer=strtok(recv_buffer,"\r\n");
asprintf (&output_message,_("Directory Services Database is %s (DS version %s)"),(result==STATE_OK)?"open":"closed",temp_buffer);
/* check to see if logins are enabled */
@ -596,7 +596,7 @@ main(int argc, char **argv) {
return result;
max_packet_receive_buffers=atoi(recv_buffer);
percent_used_packet_receive_buffers=(unsigned long)(((double)used_packet_receive_buffers/(double)max_packet_receive_buffers)*100.0);
if (vars_to_check==UPRB) {
@ -610,7 +610,7 @@ main(int argc, char **argv) {
else if (check_warning_value==TRUE && percent_used_packet_receive_buffers >= warning_value)
result=STATE_WARNING;
}
asprintf (&output_message,_("%lu of %lu (%lu%%) packet receive buffers used"),used_packet_receive_buffers,max_packet_receive_buffers,percent_used_packet_receive_buffers);
/* check SAP table entries */
@ -626,9 +626,9 @@ main(int argc, char **argv) {
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
return result;
sap_entries=atoi(recv_buffer);
if (check_critical_value==TRUE && sap_entries >= critical_value)
result=STATE_CRITICAL;
else if (check_warning_value==TRUE && sap_entries >= warning_value)
@ -814,9 +814,9 @@ main(int argc, char **argv) {
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
return result;
open_files=atoi(recv_buffer);
if (check_critical_value==TRUE && open_files >= critical_value)
result=STATE_CRITICAL;
else if (check_warning_value==TRUE && open_files >= warning_value)
@ -839,9 +839,9 @@ main(int argc, char **argv) {
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
return result;
abended_threads=atoi(recv_buffer);
if (check_critical_value==TRUE && abended_threads >= critical_value)
result=STATE_CRITICAL;
else if (check_warning_value==TRUE && abended_threads >= warning_value)
@ -863,9 +863,9 @@ main(int argc, char **argv) {
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
return result;
max_service_processes=atoi(recv_buffer);
close(sd);
my_tcp_connect (server_address, server_port, &sd);
@ -873,9 +873,9 @@ main(int argc, char **argv) {
result=send_tcp_request(sd,send_buffer,recv_buffer,sizeof(recv_buffer));
if (result!=STATE_OK)
return result;
current_service_processes=atoi(recv_buffer);
if (check_critical_value==TRUE && current_service_processes >= critical_value)
result=STATE_CRITICAL;
else if (check_warning_value==TRUE && current_service_processes >= warning_value)
@ -1610,6 +1610,7 @@ void print_help(void)
print_usage();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (_(UT_HOST_PORT), 'p', myport);
@ -1676,7 +1677,10 @@ void print_help(void)
printf (" %s\n", _(" (available from http://www.engr.wisc.edu/~drews/mrtg/)"));
printf (" %s\n", _("- Values for critical thresholds should be lower than warning thresholds"));
printf (" %s\n", _(" when the following variables are checked: VPF, VKF, LTCH, CBUFF, DCB, "));
printf (" %S\n", _(" TCB, LRUS and LRUM.\n"));
printf (" %s\n", _(" TCB, LRUS and LRUM."));
#ifdef NP_EXTRA_OPTS
printf (" -%s", _(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,43 +1,40 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_overcr plugin
*
*
* License: GPL
* Copyright (c) 2000-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-02-06 21:03:21 +0000 (Tue, 06 Feb 2007) $
*
* Copyright (c) 2000-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_overcr plugin
*
* This plugin attempts to contact the Over-CR collector daemon running on the
* remote UNIX server in order to gather the requested system information.
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin attempts to contact the Over-CR collector daemon running on the
* remote UNIX server in order to gather the requested system information.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: check_overcr.c 1611 2007-02-06 21:03:21Z opensides $
******************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_overcr.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_overcr";
const char *revision = "$Revision: 1611 $";
const char *copyright = "2000-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2000-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -102,6 +99,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -428,6 +428,7 @@ print_help (void)
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (_(UT_HOST_PORT), 'p', myport);
@ -448,16 +449,21 @@ print_help (void)
printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
printf (_(UT_VERBOSE));
printf ("\n");
printf ("%s\n", _("This plugin requires that Eric Molitors' Over-CR collector daemon be"));
printf ("%s\n", _("running on the remote server."));
printf ("%s\n", _("Over-CR can be downloaded from http://www.molitor.org/overcr"));
printf ("%s\n", _("This plugin was tested with version 0.99.53 of the Over-CR collector"));
printf ("\n");
printf ("%s\n", _("Notes:"));
printf ("%s\n", _("For the available options, the critical threshold value should always be"));
printf ("%s\n\n", _("higher than the warning threshold value, EXCEPT with the uptime variable"));
printf ("%s\n", _("This plugin requres that Eric Molitors' Over-CR collector daemon be"));
printf ("%s\n", _("running on the remote server."));
printf ("%s\n", " Over-CR can be downloaded from http://www.molitor.org/overcr");
printf ("%s\n", _("This plugin was tested with version 0.99.53 of the Over-CR collector"));
printf (" %s\n", _("For the available options, the critical threshold value should always be"));
printf (" %s\n", _("higher than the warning threshold value, EXCEPT with the uptime variable"));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,42 +1,39 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_pgsql plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-01-28 21:46:41 +0000 (Sun, 28 Jan 2007) $
*
* Copyright (c) 1999-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_pgsql plugin
*
* Test whether a PostgreSQL Database is accepting connections.
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* Test whether a PostgreSQL Database is accepting connections.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: check_pgsql.c 1590 2007-01-28 21:46:41Z hweiss $
*****************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_pgsql.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_pgsql";
const char *revision = "$Revision: 1590 $";
const char *copyright = "1999-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "1999-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -44,6 +41,7 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "netutils.h"
#include <libpq-fe.h>
#include <pg_config_manual.h>
#define DEFAULT_DB "template1"
#define DEFAULT_HOST "127.0.0.1"
@ -152,6 +150,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -414,6 +415,7 @@ print_help (void)
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (_(UT_HOST_PORT), 'P', myport);
@ -440,13 +442,21 @@ print_help (void)
printf (" %s\n", _("specified database, and then disconnects. If no database is specified, it"));
printf (" %s\n", _("connects to the template1 database, which is present in every functioning"));
printf (" %s\n\n", _("PostgreSQL DBMS."));
printf (" %s\n", _("The plugin will connect to a local postmaster if no host is specified. To"));
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", _("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."));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,42 +1,39 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_ping plugin
*
*
* License: GPL
* Copyright (c) 2000-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-10-25 21:43:04 +0100 (Thu, 25 Oct 2007) $
*
* Copyright (c) 2000-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_ping plugin
*
* Use the ping program to check connection statistics for a remote host.
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* Use the ping program to check connection statistics for a remote host.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: check_ping.c 1810 2007-10-25 20:43:04Z tonvoon $
******************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_ping.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_ping";
const char *revision = "$Revision: 1810 $";
const char *copyright = "2000-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2000-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -95,6 +92,9 @@ main (int argc, char **argv)
addresses = malloc (sizeof(char*) * max_addr);
addresses[0] = NULL;
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -165,7 +165,16 @@ main (int argc, char **argv)
state_text (this_result), warn_text, pl, rta);
if (display_html == TRUE)
printf ("</A>");
printf ("\n");
/* Print performance data */
printf("|%s", fperfdata ("rta", (double) rta, "ms",
wrta>0?TRUE:FALSE, wrta,
crta>0?TRUE:FALSE, crta,
TRUE, 0, FALSE, 0));
printf(" %s\n", perfdata ("pl", (long) pl, "%",
wpl>0?TRUE:FALSE, wpl,
cpl>0?TRUE:FALSE, cpl,
TRUE, 0, FALSE, 0));
if (verbose >= 2)
printf ("%f:%d%% %f:%d%%\n", wrta, wpl, crta, cpl);
@ -558,6 +567,7 @@ print_help (void)
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (_(UT_IPv46));
@ -575,18 +585,22 @@ print_help (void)
printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
printf ("\n");
printf ("%s\n", _("THRESHOLD is <rta>,<pl>% where <rta> is the round trip average travel"));
printf ("%s\n", _("time (ms) which triggers a WARNING or CRITICAL state, and <pl> is the"));
printf ("%s\n", _("percentage of packet loss to trigger an alarm state."));
printf ("\n\n");
printf ("\n");
printf ("%s\n", _("This plugin uses the ping command to probe the specified host for packet loss"));
printf ("%s\n", _("(percentage) and round trip average (milliseconds). It can produce HTML output"));
printf ("%s\n", _("linking to a traceroute CGI contributed by Ian Cass. The CGI can be found in"));
printf ("%s\n", _("the contrib area of the downloads section at http://www.nagios.org/"));
printf ("\n\n");
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,49 +1,49 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_procs plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-07-15 16:21:51 +0100 (Sun, 15 Jul 2007) $
*
* Copyright (c) 2000-2008 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_procs plugin
*
* Checks all processes and generates WARNING or CRITICAL states if the specified
* metric is outside the required threshold ranges. The metric defaults to number
* of processes. Search filters can be applied to limit the processes to check.
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* Checks all processes and generates WARNING or CRITICAL states if the
* specified metric is outside the required threshold ranges. The metric
* defaults to number of processes. Search filters can be applied to limit
* the processes to check.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: check_procs.c 1758 2007-07-15 15:21:51Z psychotrahe $
*
******************************************************************************/
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_procs.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_procs";
const char *program_name = "check_procs"; /* Required for coreutils libs */
const char *revision = "$Revision: 1758 $";
const char *copyright = "2000-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2000-2008";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
#include "popen.h"
#include "utils.h"
#include "regex.h"
#include <pwd.h>
@ -70,6 +70,7 @@ int options = 0; /* bitmask of filter criteria to test against */
#define RSS 128
#define PCPU 256
#define ELAPSED 512
#define EREG_ARGS 1024
/* Different metrics */
char *metric_name;
enum metric {
@ -90,10 +91,13 @@ float pcpu;
char *statopts;
char *prog;
char *args;
char *input_filename = NULL;
regex_t re_args;
char *fmt;
char *fails;
char tmp[MAX_INPUT_BUFFER];
FILE *ps_input = NULL;
int
@ -139,6 +143,9 @@ main (int argc, char **argv)
asprintf (&metric_name, "PROCS");
metric = METRIC_PROCS;
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -154,25 +161,31 @@ main (int argc, char **argv)
if (verbose >= 2)
printf (_("CMD: %s\n"), PS_COMMAND);
child_process = spopen (PS_COMMAND);
if (child_process == NULL) {
printf (_("Could not open pipe: %s\n"), PS_COMMAND);
return STATE_UNKNOWN;
if (input_filename == NULL) {
ps_input = spopen (PS_COMMAND);
if (ps_input == NULL) {
printf (_("Could not open pipe: %s\n"), PS_COMMAND);
return STATE_UNKNOWN;
}
child_stderr = fdopen (child_stderr_array[fileno (ps_input)], "r");
if (child_stderr == NULL)
printf (_("Could not open stderr for %s\n"), PS_COMMAND);
} else {
ps_input = fopen(input_filename, "r");
if (ps_input == NULL) {
die( STATE_UNKNOWN, _("Error opening %s\n"), input_filename );
}
}
child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
if (child_stderr == NULL)
printf (_("Could not open stderr for %s\n"), PS_COMMAND);
/* flush first line */
fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process);
fgets (input_buffer, MAX_INPUT_BUFFER - 1, ps_input);
while ( input_buffer[strlen(input_buffer)-1] != '\n' )
fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process);
fgets (input_buffer, MAX_INPUT_BUFFER - 1, ps_input);
while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, ps_input)) {
asprintf (&input_line, "%s", input_buffer);
while ( input_buffer[strlen(input_buffer)-1] != '\n' ) {
fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process);
fgets (input_buffer, MAX_INPUT_BUFFER - 1, ps_input);
asprintf (&input_line, "%s%s", input_line, input_buffer);
}
@ -212,6 +225,8 @@ main (int argc, char **argv)
resultsum |= STAT;
if ((options & ARGS) && procargs && (strstr (procargs, args) != NULL))
resultsum |= ARGS;
if ((options & EREG_ARGS) && procargs && (regexec(&re_args, procargs, (size_t) 0, NULL, 0) == 0))
resultsum |= EREG_ARGS;
if ((options & PROG) && procprog && (strcmp (prog, procprog) == 0))
resultsum |= PROG;
if ((options & PPID) && (procppid == ppid))
@ -232,6 +247,12 @@ main (int argc, char **argv)
continue;
procs++;
if (verbose >= 2) {
printf ("Matched: uid=%d vsz=%d rss=%d pid=%d ppid=%d pcpu=%.2f stat=%s etime=%s prog=%s args=%s\n",
procuid, procvsz, procrss,
procpid, procppid, procpcpu, procstat,
procetime, procprog, procargs);
}
if (metric == METRIC_VSZ)
i = check_thresholds (procvsz);
@ -263,19 +284,21 @@ main (int argc, char **argv)
}
/* If we get anything on STDERR, at least set warning */
while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) {
if (verbose)
printf ("STDERR: %s", input_buffer);
result = max_state (result, STATE_WARNING);
printf (_("System call sent warnings to stderr\n"));
}
if (input_filename == NULL) {
while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) {
if (verbose)
printf ("STDERR: %s", input_buffer);
result = max_state (result, STATE_WARNING);
printf (_("System call sent warnings to stderr\n"));
}
(void) fclose (child_stderr);
(void) fclose (child_stderr);
/* close the pipe */
if (spclose (child_process)) {
printf (_("System call returned nonzero status\n"));
result = max_state (result, STATE_WARNING);
/* close the pipe */
if (spclose (ps_input)) {
printf (_("System call returned nonzero status\n"));
result = max_state (result, STATE_WARNING);
}
}
if (found == 0) { /* no process lines parsed so return STATE_UNKNOWN */
@ -327,6 +350,9 @@ process_arguments (int argc, char **argv)
char *user;
struct passwd *pw;
int option = 0;
int err;
int cflags = REG_NOSUB | REG_EXTENDED;
char errbuf[MAX_INPUT_BUFFER];
static struct option longopts[] = {
{"warning", required_argument, 0, 'w'},
{"critical", required_argument, 0, 'c'},
@ -343,6 +369,8 @@ process_arguments (int argc, char **argv)
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'},
{"verbose", no_argument, 0, 'v'},
{"ereg-argument-array", required_argument, 0, CHAR_MAX+1},
{"input-file", required_argument, 0, CHAR_MAX+2},
{0, 0, 0, 0}
};
@ -417,13 +445,13 @@ process_arguments (int argc, char **argv)
pw = getpwuid ((uid_t) uid);
/* check to be sure user exists */
if (pw == NULL)
usage2 (_("UID %s was not found"), optarg);
usage2 (_("UID was not found"), optarg);
}
else {
pw = getpwnam (optarg);
/* check to be sure user exists */
if (pw == NULL)
usage2 (_("User name %s was not found"), optarg);
usage2 (_("User name was not found"), optarg);
/* then get uid */
uid = pw->pw_uid;
}
@ -451,6 +479,15 @@ process_arguments (int argc, char **argv)
asprintf (&fmt, "%s%sargs '%s'", (fmt ? fmt : ""), (options ? ", " : ""), args);
options |= ARGS;
break;
case CHAR_MAX+1:
err = regcomp(&re_args, optarg, cflags);
if (err != 0) {
regerror (err, &re_args, errbuf, MAX_INPUT_BUFFER);
die (STATE_UNKNOWN, "PROCS %s: %s - %s\n", _("UNKNOWN"), _("Could not compile regular expression"), errbuf);
}
asprintf (&fmt, "%s%sregex args '%s'", (fmt ? fmt : ""), (options ? ", " : ""), optarg);
options |= EREG_ARGS;
break;
case 'r': /* RSS */
if (sscanf (optarg, "%d%[^0-9]", &rss, tmp) == 1) {
asprintf (&fmt, "%s%sRSS >= %d", (fmt ? fmt : ""), (options ? ", " : ""), rss);
@ -500,6 +537,9 @@ process_arguments (int argc, char **argv)
case 'v': /* command */
verbose++;
break;
case CHAR_MAX+2:
input_filename = optarg;
break;
}
}
@ -667,7 +707,7 @@ print_help (void)
{
print_revision (progname, revision);
printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>");
printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
printf (COPYRIGHT, copyright, email);
printf ("%s\n", _("Checks all processes and generates WARNING or CRITICAL states if the specified"));
@ -675,16 +715,15 @@ print_help (void)
printf ("%s\n", _("of processes. Search filters can be applied to limit the processes to check."));
printf ("\n\n");
print_usage ();
printf ("%s\n", _("Required Arguments:"));
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (" %s\n", "-w, --warning=RANGE");
printf (" %s\n", _("Generate warning state if metric is outside this range"));
printf (" %s\n", "-c, --critical=RANGE");
printf (" %s\n", _("Generate critical state if metric is outside this range"));
printf ("%s\n", _("Optional Arguments:"));
printf (" %s\n", "-m, --metric=TYPE");
printf (" %s\n", _("Check thresholds against metric. Valid types:"));
printf (" %s\n", _("PROCS - number of processes (default)"));
@ -700,7 +739,8 @@ print_help (void)
printf (" %s\n", "-v, --verbose");
printf (" %s\n", _("Extra information. Up to 3 verbosity levels"));
printf ("%s\n", "Optional Filters:");
printf ("\n");
printf ("%s\n", "Filters:");
printf (" %s\n", "-s, --state=STATUSFLAGS");
printf (" %s\n", _("Only scan for processes that have, in the output of `ps`, one or"));
printf (" %s\n", _("more of the status flags you specify (for example R, Z, S, RS,"));
@ -717,6 +757,8 @@ print_help (void)
printf (" %s\n", _("Only scan for processes with user name or ID indicated."));
printf (" %s\n", "-a, --argument-array=STRING");
printf (" %s\n", _("Only scan for processes with args that contain STRING."));
printf (" %s\n", "--ereg-argument-array=STRING");
printf (" %s\n", _("Only scan for processes with args that contain the regex STRING."));
printf (" %s\n", "-C, --command=COMMAND");
printf (" %s\n", _("Only scan for exact matches of COMMAND (without path)."));
@ -732,6 +774,12 @@ the specified threshold ranges. The process count can be filtered by\n\
process owner, parent process PID, current state (e.g., 'Z'), or may\n\
be the total number of running processes\n\n"));
#ifdef NP_EXTRA_OPTS
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
printf ("\n");
#endif
printf ("%s\n", _("Examples:"));
printf (" %s\n", "check_procs -w 2:2 -c 2:1024 -C portsentry");
printf (" %s\n", _("Warning if not two processes with command name portsentry."));
@ -742,7 +790,7 @@ be the total number of running processes\n\n"));
printf (" %s\n", "check_procs -w 50000 -c 100000 --metric=VSZ");
printf (" %s\n\n", _("Alert if vsz of any processes over 50K or 100K"));
printf (" %s\n", "check_procs -w 10 -c 20 --metric=CPU");
printf (" %s\n\n", _("Alert if cpu of any processes over 10%% or 20%%"));
printf (" %s\n", _("Alert if cpu of any processes over 10%% or 20%%"));
printf (_(UT_SUPPORT));
}
@ -750,7 +798,7 @@ be the total number of running processes\n\n"));
void
print_usage (void)
{
printf (_("Usage:"));
printf (_("Usage: "));
printf ("%s -w <range> -c <range> [-m metric] [-s state] [-p ppid]\n", progname);
printf (" [-u user] [-r rss] [-z vsz] [-P %%cpu] [-a argument-array]\n");
printf (" [-C command] [-t timeout] [-v]\n");

View file

@ -1,42 +1,39 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_radius plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-12-10 07:52:00 +0000 (Mon, 10 Dec 2007) $
*
* Copyright (c) 1999-2008 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-20 08:57:13 +0100 (Tue, 20 May 2008) $
*
* Description:
*
*
* This file contains the check_radius plugin
*
* Tests to see if a radius server is accepting connections.
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* Tests to see if a radius server is accepting connections.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: check_radius.c 1859 2007-12-10 07:52:00Z dermoth $
*
*******************************************************************************/
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_radius.c 1994 2008-05-20 07:57:13Z dermoth $
*
*****************************************************************************/
const char *progname = "check_radius";
const char *revision = "$Revision: 1859 $";
const char *copyright = "2000-2006";
const char *revision = "$Revision: 1994 $";
const char *copyright = "2000-2008";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -152,6 +149,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -260,7 +260,13 @@ process_arguments (int argc, char **argv)
username = optarg;
break;
case 'p': /* password */
password = optarg;
password = strdup(optarg);
/* Delete the password from process list */
while (*optarg != '\0') {
*optarg = 'X';
optarg++;
}
break;
case 'n': /* nas id */
nasid = optarg;
@ -318,6 +324,7 @@ print_help (void)
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (_(UT_HOST_PORT), 'P', myport);
@ -336,16 +343,22 @@ print_help (void)
printf (_(UT_TIMEOUT), timeout_interval);
printf ("%s\n", _("This plugin tests a radius server to see if it is accepting connections."));
printf ("\n");
printf ("%s\n", _("This plugin tests a radius server to see if it is accepting connections."));
printf ("%s\n", _("The server to test must be specified in the invocation, as well as a user"));
printf ("%s\n", _("name and password. A configuration file may also be present. The format of"));
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 be determined by careful watching of the command line in"));
printf ("%s\n", _("a process listing. This risk is exacerbated because nagios will"));
printf ("%s\n", _("run the plugin at regular prdictable intervals. Please be sure that"));
printf ("%s\n", _("the password used does not allow access to sensitive system resources,"));
printf ("%s\n", _("otherwise compormise could occur."));
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", _("the password used does not allow access to sensitive system resources."));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,43 +1,39 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_real plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-01-28 21:46:41 +0000 (Sun, 28 Jan 2007) $
*
* Copyright (c) 2000-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_real plugin
*
* This plugin tests the REAL service on the specified host.
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin tests the REAL service on the specified host.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
* $Id: check_real.c 1590 2007-01-28 21:46:41Z hweiss $
*
******************************************************************************/
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_real.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_real";
const char *revision = "$Revision: 1590 $";
const char *copyright = "2000-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2000-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -81,6 +77,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -422,6 +421,7 @@ print_help (void)
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (_(UT_HOST_PORT), 'p', myport);
@ -437,12 +437,19 @@ print_help (void)
printf (_(UT_VERBOSE));
printf ("\n");
printf ("%s\n", _("This plugin will attempt to open an RTSP connection with the host."));
printf ("%s\n", _("Successul connects return STATE_OK, refusals and timeouts return"));
printf ("%s\n", _("STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful connects,"));
printf ("%s\n", _("but incorrect reponse messages from the host result in STATE_WARNING return"));
printf ("%s\n", _("values."));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,52 +1,48 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_smtp plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-11-09 21:17:03 +0000 (Fri, 09 Nov 2007) $
*
* Copyright (c) 2000-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_smtp plugin
*
* This plugin will attempt to open an SMTP connection with the host.
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin will attempt to open an SMTP connection with the host.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
* $Id: check_smtp.c 1817 2007-11-09 21:17:03Z dermoth $
*
******************************************************************************/
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_smtp.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_smtp";
const char *revision = "$Revision: 1817 $";
const char *copyright = "2000-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2000-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include <ctype.h>
#include "common.h"
#include "netutils.h"
#include "utils.h"
#include "base64.h"
#include <ctype.h>
#ifdef HAVE_SSL
int check_cert = FALSE;
int days_till_exp;
@ -141,6 +137,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -198,10 +197,10 @@ main (int argc, char **argv)
/* make sure we find the response we are looking for */
if (!strstr (buffer, server_expect)) {
if (server_port == SMTP_PORT)
printf (_("Invalid SMTP response received from host\n"));
printf (_("Invalid SMTP response received from host: %s\n"), buffer);
else
printf (_("Invalid SMTP response received from host on port %d\n"),
server_port);
printf (_("Invalid SMTP response received from host on port %d: %s\n"),
server_port, buffer);
result = STATE_WARNING;
}
}
@ -370,7 +369,8 @@ main (int argc, char **argv)
}
/* encode authuser with base64 */
abuf = base64 (authuser, strlen(authuser));
base64_encode_alloc (authuser, strlen(authuser), &abuf);
/* FIXME: abuf shouldn't have enough space to strcat a '\r\n' into it. */
strcat (abuf, "\r\n");
my_send(abuf, strlen(abuf));
if (verbose)
@ -390,7 +390,8 @@ main (int argc, char **argv)
break;
}
/* encode authpass with base64 */
abuf = base64 (authpass, strlen(authpass));
base64_encode_alloc (authpass, strlen(authpass), &abuf);
/* FIXME: abuf shouldn't have enough space to strcat a '\r\n' into it. */
strcat (abuf, "\r\n");
my_send(abuf, strlen(abuf));
if (verbose) {
@ -773,6 +774,7 @@ print_help (void)
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (_(UT_HOST_PORT), 'p', myport);
@ -814,6 +816,12 @@ print_help (void)
printf ("%s\n", _("connects, but incorrect reponse messages from the host result in"));
printf ("%s\n", _("STATE_WARNING return values."));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,41 +1,38 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_snmp plugin
*
*
* License: GPL
* Copyright (c) 1999-2007 nagios-plugins team
*
* Last Modified: $Date: 2007-12-10 07:52:00 +0000 (Mon, 10 Dec 2007) $
*
* Copyright (c) 1999-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_snmp plugin
*
* Check status of remote machines and obtain system information via SNMP
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* Check status of remote machines and obtain system information via SNMP
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: check_snmp.c 1859 2007-12-10 07:52:00Z dermoth $
*
******************************************************************************/
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_snmp.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_snmp";
const char *revision = "$Revision: 1859 $";
const char *revision = "$Revision: 1991 $";
const char *copyright = "1999-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
@ -179,6 +176,9 @@ main (int argc, char **argv)
timeout_interval = DEFAULT_TIMEOUT;
retries = DEFAULT_RETRIES;
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -935,6 +935,7 @@ print_help (void)
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (_(UT_HOST_PORT), 'p', DEFAULT_PORT);
@ -996,27 +997,33 @@ print_help (void)
printf (_(UT_VERBOSE));
printf ("%s\n", _("This plugin uses the 'snmpget' command included with the NET-SNMP package."));
printf ("\n");
printf ("%s\n", _("This plugin uses the 'snmpget' command included with the NET-SNMP package."));
printf ("%s\n", _("if you don't have the package installed, you will need to download it from"));
printf ("%s\n", _("http://net-snmp.sourceforge.net before you can use this plugin."));
printf ("%s\n", _("- Multiple OIDs may be indicated by a comma- or space-delimited list (lists with"));
printf ("%s\n", _(" internal spaces must be quoted) [max 8 OIDs]"));
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (" %s\n", _("- Multiple OIDs may be indicated by a comma- or space-delimited list (lists with"));
printf (" %s\n", _("internal spaces must be quoted) [max 8 OIDs]"));
printf ("%s\n", _("- Ranges are inclusive and are indicated with colons. When specified as"));
printf ("%s\n", _(" 'min:max' a STATE_OK will be returned if the result is within the indicated"));
printf ("%s\n", _(" range or is equal to the upper or lower bound. A non-OK state will be"));
printf ("%s\n", _(" returned if the result is outside the specified range."));
printf (" %s\n", _("- Ranges are inclusive and are indicated with colons. When specified as"));
printf (" %s\n", _("'min:max' a STATE_OK will be returned if the result is within the indicated"));
printf (" %s\n", _("range or is equal to the upper or lower bound. A non-OK state will be"));
printf (" %s\n", _("returned if the result is outside the specified range."));
printf ("%s\n", _("- If specified in the order 'max:min' a non-OK state will be returned if the"));
printf ("%s\n", _(" result is within the (inclusive) range."));
printf (" %s\n", _("- If specified in the order 'max:min' a non-OK state will be returned if the"));
printf (" %s\n", _("result is within the (inclusive) range."));
printf ("%s\n", _("- Upper or lower bounds may be omitted to skip checking the respective limit."));
printf ("%s\n", _("- Bare integers are interpreted as upper limits."));
printf ("%s\n", _("- When checking multiple OIDs, separate ranges by commas like '-w 1:10,1:,:20'"));
printf ("%s\n", _("- Note that only one string and one regex may be checked at present"));
printf ("%s\n", _("- All evaluation methods other than PR, STR, and SUBSTR expect that the value"));
printf ("%s\n", _(" returned from the SNMP query is an unsigned integer."));
printf (" %s\n", _("- Upper or lower bounds may be omitted to skip checking the respective limit."));
printf (" %s\n", _("- Bare integers are interpreted as upper limits."));
printf (" %s\n", _("- When checking multiple OIDs, separate ranges by commas like '-w 1:10,1:,:20'"));
printf (" %s\n", _("- Note that only one string and one regex may be checked at present"));
printf (" %s\n", _("- All evaluation methods other than PR, STR, and SUBSTR expect that the value"));
printf (" %s\n", _("returned from the SNMP query is an unsigned integer."));
#ifdef NP_EXTRA_OPTS
printf (" -%s", _(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,43 +1,39 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_ssh plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-11-09 13:08:43 +0000 (Fri, 09 Nov 2007) $
*
* Copyright (c) 2000-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_ssh plugin
*
*
* Try to connect to an SSH server at specified server and port
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* Try to connect to an SSH server at specified server and port
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: check_ssh.c 1813 2007-11-09 13:08:43Z dermoth $
*
******************************************************************************/
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_ssh.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_ssh";
const char *revision = "$Revision: 1813 $";
const char *copyright = "2000-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2000-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -74,6 +70,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -221,7 +220,7 @@ ssh_connect (char *haddr, int hport, char *remote_version)
char *ssh_server = NULL;
char rev_no[20];
sscanf ("$Revision: 1813 $", "$Revision: %[0123456789.]", rev_no);
sscanf ("$Revision: 1991 $", "$Revision: %[0123456789.]", rev_no);
result = my_tcp_connect (haddr, hport, &sd);
@ -285,6 +284,7 @@ print_help (void)
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (_(UT_HOST_PORT), 'p', myport);
@ -297,6 +297,12 @@ print_help (void)
printf (_(UT_VERBOSE));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,40 +1,38 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_disk plugin
*
*
* License: GPL
* Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net)
* Copyright (c) 2000-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-12-10 07:52:00 +0000 (Mon, 10 Dec 2007) $
*
* Copyright (c) 2000-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_disk plugin
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: check_swap.c 1859 2007-12-10 07:52:00Z dermoth $
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_swap.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_swap";
const char *revision = "$Revision: 1859 $";
const char *copyright = "2000-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2000-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -109,6 +107,9 @@ main (int argc, char **argv)
status = strdup ("");
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -528,10 +529,11 @@ print_help (void)
printf ("%s\n", _("Check swap space on local machine."));
printf ("\n\n");
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (" %s\n", "-w, --warning=INTEGER");
printf (" %s\n", _("Exit with WARNING status if less than INTEGER bytes of swap space are free"));
@ -544,9 +546,15 @@ print_help (void)
printf (" %s\n", "-a, --allswaps");
printf (" %s\n", _("Conduct comparisons for all swap partitions, one by one"));
printf (_(UT_VERBOSE));
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (" %s\n", _("On AIX, if -a is specified, uses lsps -a, otherwise uses lsps -s.\n"));
printf (" %s\n", _("On AIX, if -a is specified, uses lsps -a, otherwise uses lsps -s."));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,40 +1,38 @@
/*****************************************************************************
*
*
* Nagios check_tcp plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-06-03 15:40:13 +0100 (Sun, 03 Jun 2007) $
*
* Copyright (c) 1999-2008 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_tcp plugin
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: check_tcp.c 1729 2007-06-03 14:40:13Z psychotrahe $
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_tcp.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
/* progname "check_tcp" changes depending on symlink called */
char *progname;
const char *revision = "$Revision: 1729 $";
const char *copyright = "1999-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "1999-2008";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -207,6 +205,9 @@ main (int argc, char **argv)
server_quit = QUIT;
status = NULL;
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -604,6 +605,7 @@ print_help (void)
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (_(UT_HOST_PORT), 'p', "none");
@ -644,6 +646,12 @@ print_help (void)
printf (_(UT_VERBOSE));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,42 +1,39 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_time plugin
*
*
* License: GPL
* Copyright (c) 1999-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-05-02 06:22:31 +0100 (Wed, 02 May 2007) $
*
* Copyright (c) 1999-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_time plugin
*
* This plugin will check the time on the specified host.
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin will check the time difference with the specified host.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
* $Id: check_time.c 1703 2007-05-02 05:22:31Z dermoth $
*
******************************************************************************/
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_time.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_time";
const char *revision = "$Revision: 1703 $";
const char *copyright = "1999-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "1999-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -78,6 +75,9 @@ main (int argc, char **argv)
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -347,6 +347,7 @@ print_help (void)
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (_(UT_HOST_PORT), 'p', myport);
@ -362,6 +363,13 @@ print_help (void)
printf (" %s\n", _("Response time (sec.) necessary to result in critical status"));
printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,45 +1,43 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios 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-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-10-25 21:43:04 +0100 (Thu, 25 Oct 2007) $
*
* Copyright (c) 2002-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains Network UPS Tools plugin for Nagios
*
* This plugin tests the UPS service on the specified host.Network UPS Tools
* from www.networkupstools.org must be running for thisplugin to work.
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin tests the UPS service on the specified host.Network UPS Tools
* from www.networkupstools.org must be running for thisplugin to work.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: check_ups.c 1810 2007-10-25 20:43:04Z tonvoon $
*
******************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_ups.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_ups";
const char *revision = "$Revision: 1810 $";
const char *copyright = "2002-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2000-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -121,6 +119,9 @@ main (int argc, char **argv)
data = strdup ("");
message = strdup ("");
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -603,7 +604,7 @@ print_help (void)
printf ("Copyright (c) 2004 Arnaud Quette <arnaud.quette@mgeups.com>\n");
printf (COPYRIGHT, copyright, email);
printf ("%s\n", _("This plugin tests the UPS service on the specified host.Network UPS Tools "));
printf ("%s\n", _("This plugin tests the UPS service on the specified host. Network UPS Tools"));
printf ("%s\n", _("from www.networkupstools.org must be running for thisplugin to work."));
printf ("\n\n");
@ -611,6 +612,7 @@ print_help (void)
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (_(UT_HOST_PORT), 'p', myport);
@ -630,22 +632,27 @@ print_help (void)
/* printf (_(UT_VERBOSE)); */
printf ("\n");
printf ("%s\n", _("Notes:"));
printf ("%s\n", _("This plugin attempts to determine the status of a UPS (Uninterruptible Power"));
printf ("%s\n", _("Supply) on a local or remote host. If the UPS is online or calibrating, the"));
printf ("%s\n", _("plugin will return an OK state. If the battery is on it will return a WARNING"));
printf ("%s\n", _("state.If the UPS is off or has a low battery the plugin will return a CRITICAL"));
printf ("%s\n\n", _("state."));
printf ("%s\n", _("state."));
printf ("%s\n", _("You may also specify a variable to check [such as temperature, utility voltage,"));
printf ("%s\n", _("battery load, etc.] as well as warning and critical thresholds for the value of"));
printf ("%s\n", _("that variable. If the remote host has multiple UPS that are being monitored you"));
printf ("%s\n", _("will have to use the [ups] option to specify which UPS to check."));
printf ("%s\n", _("This plugin requires that the UPSD daemon distributed with Russel Kroll's"));
printf ("%s\n", _("Smart UPS Tools be installed on the remote host. If you do not have the"));
printf ("%s\n", _("package installed on your system, you can download it from http://www.networkupstools.org"));
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (" %s\n", _("You may also specify a variable to check (such as temperature, utility voltage,"));
printf (" %s\n", _("battery load, etc.) as well as warning and critical thresholds for the value"));
printf (" %s\n", _("of that variable. If the remote host has multiple UPS that are being monitored"));
printf (" %s\n", _("you will have to use the --ups option to specify which UPS to check."));
printf ("\n");
printf (" %s\n", _("This plugin requires that the UPSD daemon distributed with Russel Kroll's"));
printf (" %s\n", _("Smart UPS Tools be installed on the remote host. If you do not have the"));
printf (" %s\n", _("package installed on your system, you can download it from"));
printf (" %s\n", _("http://www.networkupstools.org"));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,42 +1,41 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios check_users plugin
*
*
* License: GPL
* Copyright (c) 2000-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-01-28 21:46:41 +0000 (Sun, 28 Jan 2007) $
*
* Copyright (c) 2000-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-07 11:02:42 +0100 (Wed, 07 May 2008) $
*
* Description:
*
*
* This file contains the check_users plugin
*
* This plugin checks the number of users currently logged in on the local
* system and generates an error if the number exceeds the thresholds specified.
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin checks the number of users currently logged in on the local
* system and generates an error if the number exceeds the thresholds
* specified.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: check_users.c 1590 2007-01-28 21:46:41Z hweiss $
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: check_users.c 1991 2008-05-07 10:02:42Z dermoth $
*
*****************************************************************************/
const char *progname = "check_users";
const char *revision = "$Revision: 1590 $";
const char *copyright = "2000-2006";
const char *revision = "$Revision: 1991 $";
const char *copyright = "2000-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#include "common.h"
@ -66,6 +65,9 @@ main (int argc, char **argv)
perf = strdup("");
/* Parse extra opts if any */
argv=np_extra_opts (&argc, argv, progname);
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -214,12 +216,19 @@ print_help (void)
print_usage ();
printf (_(UT_HELP_VRSN));
printf (_(UT_EXTRA_OPTS));
printf (" %s\n", "-w, --warning=INTEGER");
printf (" %s\n", _("Set WARNING status if more than INTEGER users are logged in"));
printf (" %s\n", "-c, --critical=INTEGER");
printf (" %s\n", _("Set CRITICAL status if more than INTEGER users are logged in"));
#ifdef NP_EXTRA_OPTS
printf ("\n");
printf ("%s\n", _("Notes:"));
printf (_(UT_EXTRA_OPTS_NOTES));
#endif
printf (_(UT_SUPPORT));
}

View file

@ -1,47 +1,40 @@
/******************************************************************************
*
* Nagios plugins common include file
*
* License: GPL
* Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)
*
* Last Modified: 11-05-1999
*
* Description:
*
* This file contains common include files and defines used in many of
* the plugins.
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: common.h 1700 2007-04-25 22:10:13Z tonvoon $
*
*****************************************************************************/
/*****************************************************************************
*
* Nagios plugins common include file
*
* License: GPL
* Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)
* Copyright (c) 2003-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-03-11 00:10:23 +0000 (Tue, 11 Mar 2008) $
*
* Description:
*
* This file contains common include files and defines used in many of
* the plugins.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: common.h 1938 2008-03-11 00:10:23Z tonvoon $
*
*****************************************************************************/
#ifndef _COMMON_H_
#define _COMMON_H_
#include "config.h"
/* This needs to be removed for Solaris servers, where 64 bit files, but 32 bit architecture
This needs to be done early on because subsequent system includes use _FILE_OFFSET_BITS
Cannot remove from config.h because is included by regex.c from lib/ */
#if __sun__ && !defined(_LP64) && _FILE_OFFSET_BITS == 64
#undef _FILE_OFFSET_BITS
#endif
#ifdef HAVE_FEATURES_H
#include <features.h>
@ -118,9 +111,6 @@
/* GNU Libraries */
#include <getopt.h>
#include "dirname.h"
#include "vasprintf.h"
#include "snprintf.h"
#include "vsnprintf.h"
#ifdef HAVE_LOCALE_H
#include <locale.h>
@ -186,11 +176,6 @@ enum {
};
#endif
/* Solaris does not have floorf, but floor works. Should probably be in configure */
#if defined(__sun) || defined(__sun__)
static inline float floorf (float x) { return floor(x); }
#endif
enum {
STATE_OK,
STATE_WARNING,

View file

@ -1,79 +1,43 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios negate plugin
*
*
* License: GPL
* Copyright (c) 2002-2007 nagios-plugins team
*
* Last Modified: $Date: 2007-12-10 07:52:00 +0000 (Mon, 10 Dec 2007) $
*
* Copyright (c) 2002-2008 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-05-02 10:28:15 +0100 (Fri, 02 May 2008) $
*
* Description:
*
*
* This file contains the negate plugin
*
* Negates the status of a plugin (returns OK for CRITICAL, and vice-versa)
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* Negates the status of a plugin (returns OK for CRITICAL, and vice-versa).
* Can also perform custom state switching.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: negate.c 1859 2007-12-10 07:52:00Z dermoth $
@@-<article>
<sect1>
<title>Quick Reference</title>
<refentry>
<refmeta><manvolnum>5<manvolnum></refmeta>
<refnamdiv>
<refname>&progname;</refname>
<refpurpose>&SUMMARY;</refpurpose>
</refnamdiv>
</refentry>
</sect1>
<sect1>
<title>FAQ</title>
</sect1>
<sect1>
<title>Theory, Installation, and Operation</title>
<sect2>
<title>General Description</title>
<para>
&DESCRIPTION;
</para>
</sect2>
<sect2>
<title>Future Enhancements</title>
<para>ToDo List</para>
<itemizedlist>
<listitem>Add option to do regex substitution in output text</listitem>
</itemizedlist>
</sect2>-@@
******************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: negate.c 1989 2008-05-02 09:28:15Z dermoth $
*
*****************************************************************************/
const char *progname = "negate";
const char *revision = "$Revision: 1859 $";
const char *copyright = "2002-2007";
const char *revision = "$Revision: 1989 $";
const char *copyright = "2002-2008";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
#define DEFAULT_TIMEOUT 9
#define DEFAULT_TIMEOUT 11
#include "common.h"
#include "utils.h"
@ -85,6 +49,7 @@ static const char **process_arguments (int, char **);
int validate_arguments (char **);
void print_help (void);
void print_usage (void);
int subst_text = FALSE;
static int state[4] = {
STATE_OK,
@ -97,7 +62,7 @@ int
main (int argc, char **argv)
{
int found = 0, result = STATE_UNKNOWN;
char *buf;
char *buf, *sub;
char **command_line;
output chld_out, chld_err;
int i;
@ -128,10 +93,22 @@ main (int argc, char **argv)
exit (STATE_WARNING);
}
/* Return UNKNOWN or worse if no output is returned */
if (chld_out.lines == 0)
die (STATE_UNKNOWN, _("No data returned from command\n"));
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) {
/* 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 */
*sub = '\0';
sub += strlen (state_text (result));
/* then put everything back together */
asprintf (&chld_out.line[i], "%s%s%s", chld_out.line[i], state_text (state[result]), sub);
}
}
printf ("%s\n", chld_out.line[i]);
}
@ -142,25 +119,6 @@ main (int argc, char **argv)
}
}
/******************************************************************************
@@-
<sect2>
<title>Functions</title>
<sect3>
<title>process_arguments</title>
<para>This function parses the command line into the needed
variables.</para>
<para>Aside from the standard 'help' and 'version' options, there
is a only a 'timeout' option.</para>
</sect3>
-@@
******************************************************************************/
/* process command-line arguments */
static const char **
@ -178,11 +136,12 @@ process_arguments (int argc, char **argv)
{"warning", required_argument, 0, 'w'},
{"critical", required_argument, 0, 'c'},
{"unknown", required_argument, 0, 'u'},
{"substitute", no_argument, 0, 's'},
{0, 0, 0, 0}
};
while (1) {
c = getopt_long (argc, argv, "+hVt:o:w:c:u:", longopts, &option);
c = getopt_long (argc, argv, "+hVt:o:w:c:u:s", longopts, &option);
if (c == -1 || c == EOF)
break;
@ -225,6 +184,9 @@ process_arguments (int argc, char **argv)
usage4 (_("Unknown must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3)."));
permute = FALSE;
break;
case 's': /* Substitute status text */
subst_text = TRUE;
break;
}
}
@ -239,19 +201,6 @@ process_arguments (int argc, char **argv)
}
/******************************************************************************
@@-
<sect3>
<title>validate_arguments</title>
<para>No validation is currently done.</para>
</sect3>
-@@
******************************************************************************/
int
validate_arguments (char **command_line)
{
@ -262,13 +211,6 @@ validate_arguments (char **command_line)
usage4 (_("Require path to command"));
}
/******************************************************************************
@@-
</sect2>
</sect1>
</article>
-@@
******************************************************************************/
int
translate_state (char *state_text)
@ -307,13 +249,15 @@ print_help (void)
printf (_(UT_TIMEOUT), DEFAULT_TIMEOUT);
printf (" %s\n", _("Keep timeout longer than the plugin timeout to retain CRITICAL status."));
printf(" -o,--ok=STATUS\n");
printf(" -w,--warning=STATUS\n");
printf(" -c,--critical=STATUS\n");
printf(" -u,--unknown=STATUS\n");
printf(" -o, --ok=STATUS\n");
printf(" -w, --warning=STATUS\n");
printf(" -c, --critical=STATUS\n");
printf(" -u, --unknown=STATUS\n");
printf(_(" STATUS can be 'OK', 'WARNING', 'CRITICAL' or 'UNKNOWN' without single\n"));
printf(_(" quotes. Numeric values are accepted. If nothing is specified, permutes\n"));
printf(_(" OK and CRITICAL.\n"));
printf(" -s, --substitute\n");
printf(_(" Substitute output text as well. Will only substitute text in CAPITALS\n"));
printf ("\n");
printf ("%s\n", _("Examples:"));
@ -323,11 +267,11 @@ print_help (void)
printf (" %s\n", _("This will return OK instead of WARNING and UNKNOWN instead of CRITICAL"));
printf ("\n");
printf ("%s\n", _("Notes:"));
printf ("%s\n", _("This plugin is a wrapper to take the output of another plugin and invert it."));
printf ("%s\n", _("The full path of the plugin must be provided."));
printf ("%s\n", _("If the wrapped plugin returns OK, the wrapper will return CRITICAL."));
printf ("%s\n", _("If the wrapped plugin returns CRITICAL, the wrapper will return OK."));
printf ("%s\n", _("Otherwise, the output state of the wrapped plugin is unchanged."));
printf (" %s\n", _("This plugin is a wrapper to take the output of another plugin and invert it."));
printf (" %s\n", _("The full path of the plugin must be provided."));
printf (" %s\n", _("If the wrapped plugin returns OK, the wrapper will return CRITICAL."));
printf (" %s\n", _("If the wrapped plugin returns CRITICAL, the wrapper will return OK."));
printf (" %s\n", _("Otherwise, the output state of the wrapped plugin is unchanged."));
printf (_(UT_SUPPORT));
}
@ -338,5 +282,5 @@ void
print_usage (void)
{
printf (_("Usage:"));
printf ("%s [-t timeout] [-owcu STATE] <definition of wrapped plugin>\n", progname);
printf ("%s [-t timeout] [-owcu STATE] [-s] <definition of wrapped plugin>\n", progname);
}

View file

@ -1,35 +1,34 @@
/****************************************************************************
*
/*****************************************************************************
*
* Nagios plugins network utilities
*
*
* License: GPL
* Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)
*
* Last Modified: $Date: 2007-09-24 01:30:14 +0100 (Mon, 24 Sep 2007) $
*
* Copyright (c) 2003-2008 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-01-31 11:27:22 +0000 (Thu, 31 Jan 2008) $
*
* Description:
*
*
* This file contains commons functions used in many of the plugins.
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: netutils.c 1794 2007-09-24 00:30:14Z hweiss $
*
****************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: netutils.c 1918 2008-01-31 11:27:22Z dermoth $
*
*****************************************************************************/
#define LOCAL_TIMEOUT_ALARM_HANDLER
@ -168,7 +167,8 @@ np_net_connect (const char *host_name, int port, int *sd, int proto)
struct addrinfo hints;
struct addrinfo *r, *res;
struct sockaddr_un su;
char port_str[6];
char port_str[6], host[MAX_HOST_ADDRESS_LENGTH];
size_t len;
int socktype, result;
socktype = (proto == IPPROTO_UDP) ? SOCK_DGRAM : SOCK_STREAM;
@ -180,8 +180,18 @@ np_net_connect (const char *host_name, int port, int *sd, int proto)
hints.ai_protocol = proto;
hints.ai_socktype = socktype;
len = strlen (host_name);
/* check for an [IPv6] address (and strip the brackets) */
if (len >= 2 && host_name[0] == '[' && host_name[len - 1] == ']') {
host_name++;
len -= 2;
}
if (len >= sizeof(host))
return STATE_UNKNOWN;
memcpy (host, host_name, len);
host[len] = '\0';
snprintf (port_str, sizeof (port_str), "%d", port);
result = getaddrinfo (host_name, port_str, &hints, &res);
result = getaddrinfo (host, port_str, &hints, &res);
if (result != 0) {
printf ("%s\n", gai_strerror (result));

View file

@ -1,36 +1,35 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios plugins net utilities include file
*
*
* License: GPL
* Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)
*
* Last Modified: $Date: 2007-01-24 22:47:25 +0000 (Wed, 24 Jan 2007) $
*
* Copyright (c) 2003-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-01-31 11:45:28 +0000 (Thu, 31 Jan 2008) $
*
* Description:
*
*
* This file contains common include files and function definitions
* used in many of the plugins.
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: netutils.h 1580 2007-01-24 22:47:25Z tonvoon $
*
******************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: netutils.h 1919 2008-01-31 11:45:28Z dermoth $
*
*****************************************************************************/
#ifndef _NETUTILS_H_
#define _NETUTILS_H_

View file

@ -1,48 +1,45 @@
/****************************************************************************
*
* Nagios plugins popen
*
* License: GPL
* Copyright (c) 2005 nagios-plugins team
*
* Last Modified: $Date: 2007-06-12 08:13:02 +0100 (Tue, 12 Jun 2007) $
*
* Description:
*
* A safe alternative to popen
*
* Provides spopen and spclose
*
* FILE * spopen(const char *);
* int spclose(FILE *);
*
*
* Code taken with liitle modification from "Advanced Programming for the Unix
* Environment" by W. Richard Stevens
*
* This is considered safe in that no shell is spawned, and the environment and
* path passed to the exec'd program are esstially empty. (popen create a shell
* and passes the environment to it).
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: popen.c 1737 2007-06-12 07:13:02Z psychotrahe $
*
******************************************************************************/
/*****************************************************************************
*
* Nagios plugins popen
*
* License: GPL
* Copyright (c) 2005-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-01-31 11:27:22 +0000 (Thu, 31 Jan 2008) $
*
* Description:
*
* A safe alternative to popen
*
* Provides spopen and spclose
*
* FILE * spopen(const char *);
* int spclose(FILE *);
*
* Code taken with liitle modification from "Advanced Programming for the Unix
* Environment" by W. Richard Stevens
*
* This is considered safe in that no shell is spawned, and the environment
* and path passed to the exec'd program are essentially empty. (popen create
* a shell and passes the environment to it).
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: popen.c 1918 2008-01-31 11:27:22Z dermoth $
*
*****************************************************************************/
#include "common.h"

View file

@ -1,8 +1,8 @@
/******************************************************************************
*
* $Id: popen.h 1169 2005-05-01 20:12:03Z seanius $
*
******************************************************************************/
*
* $Id: popen.h 1919 2008-01-31 11:45:28Z dermoth $
*
*****************************************************************************/
FILE *spopen (const char *);
int spclose (FILE *);

View file

@ -1,42 +1,43 @@
/****************************************************************************
* Nagios run command utilities
*
* License: GPL
* Copyright (c) 2005 nagios-plugins team
*
* $Id: runcmd.c 1434 2006-06-18 19:36:48Z opensides $
*
* Description :
*
* A simple interface to executing programs from other programs, using an
* optimized and safe popen()-like implementation. It is considered safe
* in that no shell needs to be spawned and the environment passed to the
* execve()'d program is essentially empty.
*
*
* The code in this file is a derivative of popen.c which in turn was taken
* from "Advanced Programming for the Unix Environment" by W. Richard Stevens.
*
* Care has been taken to make sure the functions are async-safe. The one
* function which isn't is np_runcmd_init() which it doesn't make sense to
* call twice anyway, so the api as a whole should be considered async-safe.
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*****************************************************************************
*
* Nagios run command utilities
*
* License: GPL
* Copyright (c) 2005-2006 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-01-31 11:27:22 +0000 (Thu, 31 Jan 2008) $
*
* Description :
*
* A simple interface to executing programs from other programs, using an
* optimized and safe popen()-like implementation. It is considered safe
* in that no shell needs to be spawned and the environment passed to the
* execve()'d program is essentially empty.
*
* The code in this file is a derivative of popen.c which in turn was taken
* from "Advanced Programming for the Unix Environment" by W. Richard Stevens.
*
* Care has been taken to make sure the functions are async-safe. The one
* function which isn't is np_runcmd_init() which it doesn't make sense to
* call twice anyway, so the api as a whole should be considered async-safe.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: runcmd.c 1918 2008-01-31 11:27:22Z dermoth $
*
*****************************************************************************/
#define NAGIOSPLUG_API_C 1

View file

@ -1,11 +1,26 @@
/*
* $Id: runcmd.h 1260 2005-10-24 11:10:29Z seanius $
*
* Author: Andreas Ericsson <ae@op5.se>
*
* Copyright: GNU GPL v2 or any later version.
*
*/
/****************************************************************************
*
* License: GPL
* Copyright (c) 2005 Nagios Plugins Development Team
* Author: Andreas Ericsson <ae@op5.se>
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: runcmd.h 1919 2008-01-31 11:45:28Z dermoth $
*
*****************************************************************************/
#ifndef NAGIOSPLUG_RUNCMD_H
#define NAGIOSPLUG_RUNCMD_H

View file

@ -1,35 +1,33 @@
/****************************************************************************
*
/*****************************************************************************
*
* Nagios plugins SSL utilities
*
*
* License: GPL
* Copyright (c) 2005 nagios-plugins team
*
* Last Modified: $Date: 2007-06-01 23:57:31 +0100 (Fri, 01 Jun 2007) $
*
* Copyright (c) 2005-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-01-31 11:27:22 +0000 (Thu, 31 Jan 2008) $
*
* Description:
*
*
* This file contains common functions for plugins that require SSL.
*
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: sslutils.c 1726 2007-06-01 22:57:31Z hweiss $
*
****************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: sslutils.c 1918 2008-01-31 11:27:22Z dermoth $
*
*****************************************************************************/
#define LOCAL_TIMEOUT_ALARM_HANDLER
#include "common.h"

147
plugins/t/check_by_ssh.t Normal file
View file

@ -0,0 +1,147 @@
#! /usr/bin/perl -w -I ..
#
# check_by_ssh tests
#
# $Id$
#
use strict;
use Test::More;
use NPTest;
# Required parameters
my $ssh_service = getTestParameter( "NP_SSH_HOST",
"A host providing SSH service",
"localhost");
my $ssh_key = getTestParameter( "NP_SSH_IDENTITY",
"A key allowing access to NP_SSH_HOST",
"~/.ssh/id_dsa");
plan skip_all => "SSH_HOST and SSH_IDENTITY must be defined" unless ($ssh_service && $ssh_key);
plan tests => 40;
# Some random check strings/response
my @responce = ('OK: Everything is fine!',
'WARNING: Hey, pick me, pick me!',
'CRITICAL: Shit happens...',
'UNKNOWN: What can I do for ya?',
'WOOPS: What did I smoke?',
);
my @responce_re;
my @check;
for (@responce) {
push(@check, "echo $_");
my $re_str = $_;
$re_str =~ s{(.)} { "\Q$1" }ge;
push(@responce_re, $re_str);
}
my $result;
## Single active checks
for (my $i=0; $i<4; $i++) {
$result = NPTest->testCmd(
"./check_by_ssh -i $ssh_key -H $ssh_service -C '$check[$i]; exit $i'"
);
cmp_ok($result->return_code, '==', $i, "Exit with return code $i");
is($result->output, $responce[$i], "Status text is correct for check $i");
}
$result = NPTest->testCmd(
"./check_by_ssh -i $ssh_key -H $ssh_service -C 'exit 0'"
);
cmp_ok($result->return_code, '==', 0, "Exit with return code 0 (OK)");
is($result->output, 'OK - check_by_ssh: Remote command \'exit 0\' returned status 0', "Status text if command returned none (OK)");
$result = NPTest->testCmd(
"./check_by_ssh -i $ssh_key -H $ssh_service -C 'exit 1'"
);
cmp_ok($result->return_code, '==', 1, "Exit with return code 1 (WARNING)");
is($result->output, 'WARNING - check_by_ssh: Remote command \'exit 1\' returned status 1', "Status text if command returned none (WARNING)");
$result = NPTest->testCmd(
"./check_by_ssh -i $ssh_key -H $ssh_service -C 'exit 2'"
);
cmp_ok($result->return_code, '==', 2, "Exit with return code 2 (CRITICAL)");
is($result->output, 'CRITICAL - check_by_ssh: Remote command \'exit 2\' returned status 2', "Status text if command returned none (CRITICAL)");
$result = NPTest->testCmd(
"./check_by_ssh -i $ssh_key -H $ssh_service -C 'exit 3'"
);
cmp_ok($result->return_code, '==', 3, "Exit with return code 3 (UNKNOWN)");
is($result->output, 'UNKNOWN - check_by_ssh: Remote command \'exit 3\' returned status 3', "Status text if command returned none (UNKNOWN)");
$result = NPTest->testCmd(
"./check_by_ssh -i $ssh_key -H $ssh_service -C 'exit 7'"
);
cmp_ok($result->return_code, '==', 7, "Exit with return code 7 (out of bounds)");
is($result->output, 'UNKNOWN - check_by_ssh: Remote command \'exit 7\' returned status 7', "Status text if command returned none (out of bounds)");
$result = NPTest->testCmd(
"./check_by_ssh -i $ssh_key -H $ssh_service -C '$check[4]; exit 8'"
);
cmp_ok($result->return_code, '==', 8, "Exit with return code 8 (out of bounds)");
is($result->output, $responce[4], "Return proper status text even with unknown status codes");
# Multiple active checks
$result = NPTest->testCmd(
"./check_by_ssh -i $ssh_key -H $ssh_service -C '$check[1]; sh -c exit\\ 1' -C '$check[0]; sh -c exit\\ 0' -C '$check[3]; sh -c exit\\ 3' -C '$check[2]; sh -c exit\\ 2'"
);
cmp_ok($result->return_code, '==', 0, "Multiple checks always return OK");
my @lines = split(/\n/, $result->output);
cmp_ok(scalar(@lines), '==', 8, "Correct number of output lined for multiple checks");
my %linemap = (
'0' => '1',
'2' => '0',
'4' => '3',
'6' => '2',
);
foreach my $line (0, 2, 4, 6) {
my $code = $linemap{$line};
my $statline = $line+1;
is($lines[$line], "$responce[$code]", "multiple checks status text is correct for line $line");
is($lines[$statline], "STATUS CODE: $code", "multiple check status code is correct for line $line");
}
# Passive checks
unlink("/tmp/check_by_ssh.$$");
$result = NPTest->testCmd(
"./check_by_ssh -i $ssh_key -H $ssh_service -n flint -s serv -C '$check[2]; sh -c exit\\ 2' -O /tmp/check_by_ssh.$$"
);
cmp_ok($result->return_code, '==', 0, "Exit always ok on passive checks");
open(PASV, "/tmp/check_by_ssh.$$") or die("Unable to open '/tmp/check_by_ssh.$$': $!");
my @pasv = <PASV>;
close(PASV) or die("Unable to close '/tmp/check_by_ssh.$$': $!");
cmp_ok(scalar(@pasv), '==', 1, 'One passive result for one check performed');
for (0) {
if ($pasv[$_]) {
like($pasv[$_], '/^\[\d+\] PROCESS_SERVICE_CHECK_RESULT;flint;serv;2;' . $responce_re[2] . '$/', 'proper result for passive check');
} else {
fail('proper result for passive check');
}
}
unlink("/tmp/check_by_ssh.$$") or die("Unable to unlink '/tmp/check_by_ssh.$$': $!");
undef @pasv;
$result = NPTest->testCmd(
"./check_by_ssh -i $ssh_key -H $ssh_service -n flint -s c0:c1:c2:c3:c4 -C '$check[0];sh -c exit\\ 0' -C '$check[1];sh -c exit\\ 1' -C '$check[2];sh -c exit\\ 2' -C '$check[3];sh -c exit\\ 3' -C '$check[4];sh -c exit\\ 9' -O /tmp/check_by_ssh.$$"
);
cmp_ok($result->return_code, '==', 0, "Exit always ok on passive checks");
open(PASV, "/tmp/check_by_ssh.$$") or die("Unable to open '/tmp/check_by_ssh.$$': $!");
@pasv = <PASV>;
close(PASV) or die("Unable to close '/tmp/check_by_ssh.$$': $!");
cmp_ok(scalar(@pasv), '==', 5, 'Five passive result for five checks performed');
for (0, 1, 2, 3, 4) {
if ($pasv[$_]) {
my $ret = $_;
$ret = 9 if ($_ == 4);
like($pasv[$_], '/^\[\d+\] PROCESS_SERVICE_CHECK_RESULT;flint;c' . $_ . ';' . $ret . ';' . $responce_re[$_] . '$/', "proper result for passive check $_");
} else {
fail("proper result for passive check $_");
}
}
unlink("/tmp/check_by_ssh.$$") or die("Unable to unlink '/tmp/check_by_ssh.$$': $!");

View file

@ -2,7 +2,7 @@
#
# Domain Name Server (DNS) Tests via check_dns
#
# $Id: check_dns.t 1361 2006-03-29 08:13:29Z tonvoon $
# $Id: check_dns.t 1902 2008-01-08 16:05:36Z tonvoon $
#
use strict;
@ -18,19 +18,19 @@ my $successOutput = '/DNS OK: [\.0-9]+ seconds? response time/';
my $hostname_valid = getTestParameter(
"NP_HOSTNAME_VALID",
"A valid (known to DNS) hostname",
"apple.com"
"nagios.com"
);
my $hostname_valid_ip = getTestParameter(
"NP_HOSTNAME_VALID_IP",
"The IP address of the valid hostname $hostname_valid",
"17.254.3.183"
"66.118.156.50",
);
my $hostname_valid_reverse = getTestParameter(
"NP_HOSTNAME_VALID_REVERSE",
"The hostname of $hostname_valid_ip",
$hostname_valid."."
"66-118-156-50.static.sagonet.net.",
);
my $hostname_invalid = getTestParameter(

View file

@ -2,7 +2,7 @@
#
# File Transfer Protocol (FTP) Test via check_ftp
#
# $Id: check_ftp.t 1207 2005-07-25 01:47:15Z illumino $
# $Id: check_ftp.t 1901 2008-01-08 11:57:24Z tonvoon $
#
use strict;

View file

@ -2,7 +2,7 @@
#
# Internet Mail Access Protocol (IMAP) Server Tests via check_imap
#
# $Id: check_imap.t 1279 2005-11-09 16:40:12Z tonvoon $
# $Id: check_imap.t 1901 2008-01-08 11:57:24Z tonvoon $
#
use strict;

View file

@ -2,7 +2,7 @@
#
# Jabber Server Tests via check_jabber
#
# $Id: check_jabber.t 1604 2007-02-01 06:53:12Z dermoth $
# $Id: check_jabber.t 1901 2008-01-08 11:57:24Z tonvoon $
#
use strict;

View file

@ -2,7 +2,7 @@
#
# MySQL Database Server Tests via check_mysql
#
# $Id: check_mysql.t 1327 2006-03-17 14:07:34Z tonvoon $
# $Id: check_mysql.t 1988 2008-04-30 12:50:52Z dermoth $
#
#
# These are the database permissions required for this test:
@ -19,12 +19,16 @@ use vars qw($tests);
plan skip_all => "check_mysql not compiled" unless (-x "check_mysql");
plan tests => 10;
plan tests => 15;
my $bad_login_output = '/Access denied for user /';
my $mysqlserver = getTestParameter(
"NP_MYSQL_SERVER",
"A MySQL Server with no slaves setup"
"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 $mysql_login_details = getTestParameter(
"MYSQL_LOGIN_DETAILS",
@ -57,6 +61,20 @@ SKIP: {
like( $result->output, "/No slaves defined/", "Correct error message");
}
SKIP: {
skip "No mysql socket defined", 5 unless $mysqlsocket;
$result = NPTest->testCmd("./check_mysql -s $mysqlsocket $mysql_login_details");
cmp_ok( $result->return_code, '==', 0, "Login okay");
$result = NPTest->testCmd("./check_mysql -s $mysqlsocket -u dummy -pdummy");
cmp_ok( $result->return_code, '==', 2, "Login failure");
like( $result->output, $bad_login_output, "Expected login failure message");
$result = NPTest->testCmd("./check_mysql -S -s $mysqlsocket $mysql_login_details");
cmp_ok( $result->return_code, "==", 1, "No slaves defined" );
like( $result->output, "/No slaves defined/", "Correct error message");
}
SKIP: {
skip "No mysql server with slaves defined", 5 unless $with_slave;
$result = NPTest->testCmd("./check_mysql -H $with_slave $with_slave_login");

View file

@ -2,13 +2,19 @@
#
# check_nagios tests
#
# $Id: check_nagios.t 1382 2006-04-19 09:33:44Z tonvoon $
# $Id: check_nagios.t 1953 2008-03-17 23:08:21Z tonvoon $
#
use strict;
use Test::More tests => 13;
use Test::More;
use NPTest;
if (`uname -s` eq "SunOS\n") {
plan skip_all => "Ignoring tests on solaris because of pst3";
} else {
plan tests => 13;
}
my $successOutput = '/^NAGIOS OK: /';
my $warningOutput = '/^NAGIOS WARNING: /';
my $failureOutput = '/^NAGIOS CRITICAL: /';

View file

@ -2,7 +2,7 @@
#
# Post Office Protocol (POP) Server Tests via check_pop
#
# $Id: check_pop.t 1345 2006-03-22 15:45:49Z tonvoon $
# $Id: check_pop.t 1901 2008-01-08 11:57:24Z tonvoon $
#
use strict;

View file

@ -2,24 +2,44 @@
#
# Process Tests via check_procs
#
# $Id: check_procs.t 1271 2005-11-03 15:13:13Z tonvoon $
# $Id: check_procs.t 1937 2008-02-28 16:21:59Z tonvoon $
#
use strict;
use Test;
use Test::More;
use NPTest;
use vars qw($tests);
BEGIN {$tests = 12; plan tests => $tests}
my $t;
$t += checkCmd( "./check_procs -w 100000 -c 100000", 0, '/^PROCS OK: [0-9]+ process(es)?$/' );
$t += checkCmd( "./check_procs -w 100000 -c 100000 -s Z", 0, '/^PROCS OK: [0-9]+ process(es)? with /' );
$t += checkCmd( "./check_procs -w 0 -c 10000000", 1, '/^PROCS WARNING: [0-9]+ process(es)?$/' );
$t += checkCmd( "./check_procs -w 0 -c 0", 2, '/^PROCS CRITICAL: [0-9]+ process(es)?$/' );
$t += checkCmd( "./check_procs -w 0 -c 0 -s S", 2, '/^PROCS CRITICAL: [0-9]+ process(es)? with /' );
$t += checkCmd( "./check_procs -w 0 -c 10000000 -p 1", 1, '/^PROCS WARNING: [0-9]+ process(es)? with PPID = 1/' );
if (`uname -s` eq "SunOS\n") {
plan skip_all => "Ignoring tests on solaris because of pst3";
} else {
plan tests => 12;
}
my $result;
$result = NPTest->testCmd( "./check_procs -w 100000 -c 100000" );
is( $result->return_code, 0, "Checking less than 10000 processes" );
like( $result->output, '/^PROCS OK: [0-9]+ process(es)?$/', "Output correct" );
$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" );
$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)?$/', "Output correct" );
$result = NPTest->testCmd( "./check_procs -w 0 -c 0" );
is( $result->return_code, 2, "Checking critical if processes > 0" );
like( $result->output, '/^PROCS CRITICAL: [0-9]+ process(es)?$/', "Output correct" );
$result = NPTest->testCmd( "./check_procs -w 0 -c 0 -s S" );
is( $result->return_code, 2, "Checking critical if sleeping processes" );
like( $result->output, '/^PROCS CRITICAL: [0-9]+ process(es)? with /', "Output correct" );
$result = NPTest->testCmd( "./check_procs -w 0 -c 100000 -p 1" );
is( $result->return_code, 1, "Checking warning for processes by parentid = 1" );
like( $result->output, '/^PROCS WARNING: [0-9]+ process(es)? with PPID = 1/', "Output correct" );
exit(0) if defined($Test::Harness::VERSION);
exit($tests - $t);

View file

@ -2,7 +2,7 @@
#
# TCP Connection Based Tests via check_tcp
#
# $Id: check_tcp.t 1714 2007-05-18 07:17:59Z dermoth $
# $Id: check_tcp.t 1901 2008-01-08 11:57:24Z tonvoon $
#
use strict;

View file

@ -1,43 +1,40 @@
/******************************************************************************
*
/*****************************************************************************
*
* Nagios urlize plugin
*
*
* License: GPL
* Copyright (c) 2000-2006 nagios-plugins team
*
* Last Modified: $Date: 2007-01-28 21:46:41 +0000 (Sun, 28 Jan 2007) $
*
* Copyright (c) 2000-2007 Nagios Plugins Development Team
*
* Last Modified: $Date: 2008-01-31 11:27:22 +0000 (Thu, 31 Jan 2008) $
*
* Description:
*
*
* This file contains the urlize plugin
*
* This plugin wraps the text output of another command (plugin)
* in HTML <A> tags, thus displaying the plugin output in as a clickable link in
* the Nagios status screen. The return status is the same as the invoked plugin.
*
* License Information:
*
* This program is free software; you can redistribute it and/or modify
*
* This plugin wraps the text output of another command (plugin) in HTML <A>
* tags, thus displaying the plugin output in as a clickable link in the
* Nagios status screen. The return status is the same as the invoked plugin.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
$Id: urlize.c 1590 2007-01-28 21:46:41Z hweiss $
******************************************************************************/
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: urlize.c 1918 2008-01-31 11:27:22Z dermoth $
*
*****************************************************************************/
const char *progname = "urlize";
const char *revision = "$Revision: 1590 $";
const char *revision = "$Revision: 1918 $";
const char *copyright = "2000-2006";
const char *email = "nagiosplug-devel@lists.sourceforge.net";

View file

@ -1,16 +1,30 @@
/*****************************************************************************
*
* utils.c
*
* Library of useful functions for plugins
*
* Copyright (c) 2000 Karl DeBisschop (karl@debisschop.net)
* Copyright (c) 2006 Nagios Plugin Development Team
* License: GPL
*
* $Revision: 1829 $
* $Date: 2007-11-23 04:18:16 +0000 (Fri, 23 Nov 2007) $
****************************************************************************/
*
* Library of useful functions for plugins
*
* License: GPL
* Copyright (c) 2000 Karl DeBisschop (karl@debisschop.net)
* Copyright (c) 2002-2007 Nagios Plugin Development Team
*
* Last Modified: $Date: 2008-01-31 11:27:22 +0000 (Thu, 31 Jan 2008) $
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Id: utils.c 1918 2008-01-31 11:27:22Z dermoth $
*
*****************************************************************************/
#define LOCAL_TIMEOUT_ALARM_HANDLER

View file

@ -16,9 +16,17 @@ suite of plugins. */
/* now some functions etc are being defined in ../lib/utils_base.c */
#include "utils_base.h"
#ifdef NP_EXTRA_OPTS
/* Include extra-opts functions if compiled in */
#include "extra_opts.h"
#else
/* else, fake np_extra_opts */
#define np_extra_opts(acptr,av,pr) av
#endif
/* Standardize version information, termination */
/* $Id: utils.h 1829 2007-11-23 04:18:16Z dermoth $ */
/* $Id: utils.h 1991 2008-05-07 10:02:42Z dermoth $ */
void support (void);
char *clean_revstring (const char *);
@ -173,10 +181,26 @@ char *fperfdata (const char *,
-t, --timeout=INTEGER\n\
Seconds before connection times out (default: %d)\n"
#ifdef NP_EXTRA_OPTS
#define UT_EXTRA_OPTS "\
--extra-opts=[section][@file]\n\
Read additionnal options from ini file\n"
#define UT_EXTRA_OPTS_NOTES "\
See: http://nagiosplugins.org/extra-opts for --extra-opts usage and examples.\n"
#else
#define UT_EXTRA_OPTS ""
#define UT_EXTRA_OPTS_NOTES ""
#endif
#define UT_THRESHOLDS_NOTES "\
See:\n\
http://nagiosplug.sourceforge.net/developer-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"
send email to nagiosplug-devel@lists.sourceforge.net\n\n"
#define UT_NOWARRANTY "\n\
The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n\