Imported Upstream version 1.4.13+git200906171200
This commit is contained in:
parent
4ab9f0d24c
commit
d0b8ab8112
362 changed files with 34110 additions and 10773 deletions
|
@ -1,5 +1,16 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
if RELEASE_PRESENT
|
||||
NP_VERSION = $(PACKAGE_VERSION)
|
||||
else
|
||||
NP-VERSION-FILE: .FORCE-NP-VERSION-FILE
|
||||
@$(SHELL_PATH) $(top_srcdir)/NP-VERSION-GEN
|
||||
.FORCE-NP-VERSION-FILE:
|
||||
-include NP-VERSION-FILE
|
||||
endif
|
||||
|
||||
AM_CFLAGS = -DNP_VERSION='"$(NP_VERSION)"'
|
||||
|
||||
VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plugins/t
|
||||
|
||||
INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl @LDAPINCLUDE@ @PGINCLUDE@ @SSLINCLUDE@
|
||||
|
@ -65,10 +76,10 @@ check_ldap_LDADD = $(NETLIBS) $(LDAPLIBS)
|
|||
check_load_LDADD = $(BASEOBJS) popen.o
|
||||
check_mrtg_LDADD = $(BASEOBJS)
|
||||
check_mrtgtraf_LDADD = $(BASEOBJS)
|
||||
check_mysql_CFLAGS = $(MYSQLCFLAGS)
|
||||
check_mysql_CFLAGS = $(MYSQLCFLAGS) -DNP_VERSION='"$(NP_VERSION)"'
|
||||
check_mysql_CPPFLAGS = $(MYSQLINCLUDE)
|
||||
check_mysql_LDADD = $(NETLIBS) $(MYSQLLIBS)
|
||||
check_mysql_query_CFLAGS = $(MYSQLCFLAGS)
|
||||
check_mysql_query_CFLAGS = $(MYSQLCFLAGS) -DNP_VERSION='"$(NP_VERSION)"'
|
||||
check_mysql_query_CPPFLAGS = $(MYSQLINCLUDE)
|
||||
check_mysql_query_LDADD = $(NETLIBS) $(MYSQLLIBS)
|
||||
check_nagios_LDADD = $(BASEOBJS) runcmd.o
|
||||
|
@ -79,10 +90,10 @@ check_nwstat_LDADD = $(NETLIBS)
|
|||
check_overcr_LDADD = $(NETLIBS)
|
||||
check_pgsql_LDADD = $(NETLIBS) $(PGLIBS)
|
||||
check_ping_LDADD = $(NETLIBS) popen.o
|
||||
check_procs_LDADD = $(BASEOBJS) popen.o
|
||||
check_procs_LDADD = $(BASEOBJS)
|
||||
check_radius_LDADD = $(NETLIBS) $(RADIUSLIBS)
|
||||
check_real_LDADD = $(NETLIBS)
|
||||
check_snmp_LDADD = $(BASEOBJS) popen.o
|
||||
check_snmp_LDADD = $(BASEOBJS)
|
||||
check_smtp_LDADD = $(SSLOBJS) $(NETLIBS) $(SSLLIBS)
|
||||
check_ssh_LDADD = $(NETLIBS)
|
||||
check_swap_LDADD = $(MATHLIBS) $(BASEOBJS) popen.o
|
||||
|
@ -91,7 +102,7 @@ check_time_LDADD = $(NETLIBS)
|
|||
check_ntp_time_LDADD = $(NETLIBS) $(MATHLIBS)
|
||||
check_ups_LDADD = $(NETLIBS)
|
||||
check_users_LDADD = $(BASEOBJS) popen.o
|
||||
check_by_ssh_LDADD = $(NETLIBS) runcmd.o
|
||||
check_by_ssh_LDADD = $(NETLIBS)
|
||||
check_ide_smart_LDADD = $(BASEOBJS)
|
||||
negate_LDADD = $(BASEOBJS)
|
||||
urlize_LDADD = $(BASEOBJS) popen.o
|
||||
|
@ -124,7 +135,7 @@ check_ping_DEPENDENCIES = check_ping.c $(NETOBJS) popen.o $(DEPLIBS)
|
|||
check_procs_DEPENDENCIES = check_procs.c $(BASEOBJS) popen.o $(DEPLIBS)
|
||||
check_radius_DEPENDENCIES = check_radius.c $(NETOBJS) $(DEPLIBS)
|
||||
check_real_DEPENDENCIES = check_real.c $(NETOBJS) $(DEPLIBS)
|
||||
check_snmp_DEPENDENCIES = check_snmp.c $(BASEOBJS) popen.o $(DEPLIBS)
|
||||
check_snmp_DEPENDENCIES = check_snmp.c $(BASEOBJS) $(DEPLIBS)
|
||||
check_smtp_DEPENDENCIES = check_smtp.c $(SSLOBJS) $(NETOBJS) $(DEPLIBS)
|
||||
check_ssh_DEPENDENCIES = check_ssh.c $(NETOBJS) $(DEPLIBS)
|
||||
check_swap_DEPENDENCIES = check_swap.c $(BASEOBJS) popen.o $(DEPLIBS)
|
||||
|
@ -133,7 +144,7 @@ check_time_DEPENDENCIES = check_time.c $(NETOBJS) $(DEPLIBS)
|
|||
check_ntp_time_DEPENDENCIES = check_ntp_time.c $(NETOBJS) $(DEPLIBS)
|
||||
check_ups_DEPENDENCIES = check_ups.c $(NETOBJS) $(DEPLIBS)
|
||||
check_users_DEPENDENCIES = check_users.c $(BASEOBJS) popen.o $(DEPLIBS)
|
||||
check_by_ssh_DEPENDENCIES = check_by_ssh.c $(NETOBJS) runcmd.o $(DEPLIBS)
|
||||
check_by_ssh_DEPENDENCIES = check_by_ssh.c $(NETOBJS) $(DEPLIBS)
|
||||
negate_DEPENDENCIES = negate.c $(BASEOBJS) $(DEPLIBS)
|
||||
urlize_DEPENDENCIES = urlize.c $(BASEOBJS) popen.o $(DEPLIBS)
|
||||
|
||||
|
@ -149,10 +160,6 @@ utils.o: utils.c utils.h $(PLUGINHDRS)
|
|||
netutils.o: netutils.c netutils.h $(PLUGINHDRS)
|
||||
sslutils.o: sslutils.c netutils.h $(PLUGINHDRS)
|
||||
|
||||
getaddrinfo.o: getaddrinfo.h $(PLUGINHDRS)
|
||||
|
||||
gethostbyname.o: gethostbyname.h $(PLUGINHDRS)
|
||||
|
||||
all-local: $(check_tcp_programs)
|
||||
|
||||
$(check_tcp_programs): check_tcp
|
||||
|
@ -166,6 +173,8 @@ install-exec-hook:
|
|||
|
||||
clean-local:
|
||||
rm -f $(check_tcp_programs)
|
||||
rm -f NP-VERSION-FILE
|
||||
|
||||
uninstall-local:
|
||||
cd $(DESTDIR)$(libexecdir) && rm -f $(check_tcp_programs)
|
||||
|
||||
|
|
|
@ -54,17 +54,19 @@ 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/alloca.m4 \
|
||||
$(top_srcdir)/gl/m4/00gnulib.m4 $(top_srcdir)/gl/m4/alloca.m4 \
|
||||
$(top_srcdir)/gl/m4/arpa_inet_h.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/base64.m4 $(top_srcdir)/gl/m4/btowc.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/errno_h.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/fcntl_h.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 \
|
||||
|
@ -74,7 +76,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/np_mysqlclient.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/hostent.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 \
|
||||
|
@ -83,17 +85,24 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/np_mysqlclient.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/localcharset.m4 \
|
||||
$(top_srcdir)/gl/m4/locale-fr.m4 \
|
||||
$(top_srcdir)/gl/m4/locale-ja.m4 \
|
||||
$(top_srcdir)/gl/m4/locale-zh.m4 \
|
||||
$(top_srcdir)/gl/m4/longlong.m4 \
|
||||
$(top_srcdir)/gl/m4/ls-mntd-fs.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/mbrtowc.m4 $(top_srcdir)/gl/m4/mbsinit.m4 \
|
||||
$(top_srcdir)/gl/m4/mbstate_t.m4 $(top_srcdir)/gl/m4/mktime.m4 \
|
||||
$(top_srcdir)/gl/m4/mountlist.m4 \
|
||||
$(top_srcdir)/gl/m4/multiarch.m4 \
|
||||
$(top_srcdir)/gl/m4/netdb_h.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/onceonly.m4 $(top_srcdir)/gl/m4/open.m4 \
|
||||
$(top_srcdir)/gl/m4/po.m4 $(top_srcdir)/gl/m4/printf.m4 \
|
||||
$(top_srcdir)/gl/m4/progtest.m4 $(top_srcdir)/gl/m4/regex.m4 \
|
||||
$(top_srcdir)/gl/m4/safe-read.m4 \
|
||||
$(top_srcdir)/gl/m4/safe-write.m4 \
|
||||
$(top_srcdir)/gl/m4/size_max.m4 \
|
||||
$(top_srcdir)/gl/m4/servent.m4 $(top_srcdir)/gl/m4/size_max.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 \
|
||||
|
@ -103,13 +112,16 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/np_mysqlclient.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/time_h.m4 $(top_srcdir)/gl/m4/time_r.m4 \
|
||||
$(top_srcdir)/gl/m4/timegm.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/wint_t.m4 $(top_srcdir)/gl/m4/xalloc.m4 \
|
||||
$(top_srcdir)/gl/m4/wchar_t.m4 $(top_srcdir)/gl/m4/wcrtomb.m4 \
|
||||
$(top_srcdir)/gl/m4/wctype.m4 $(top_srcdir)/gl/m4/wint_t.m4 \
|
||||
$(top_srcdir)/gl/m4/write.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) \
|
||||
|
@ -249,6 +261,7 @@ ALLOCA_H = @ALLOCA_H@
|
|||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@
|
||||
AR = @AR@
|
||||
ARPA_INET_H = @ARPA_INET_H@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
|
@ -280,16 +293,24 @@ ECHO_C = @ECHO_C@
|
|||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EOVERFLOW = @EOVERFLOW@
|
||||
EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@
|
||||
EMULTIHOP_VALUE = @EMULTIHOP_VALUE@
|
||||
ENOLINK_HIDDEN = @ENOLINK_HIDDEN@
|
||||
ENOLINK_VALUE = @ENOLINK_VALUE@
|
||||
EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@
|
||||
EOVERFLOW_VALUE = @EOVERFLOW_VALUE@
|
||||
ERRNO_H = @ERRNO_H@
|
||||
EXEEXT = @EXEEXT@
|
||||
EXTRAS = @EXTRAS@
|
||||
EXTRAS_ROOT = @EXTRAS_ROOT@
|
||||
EXTRA_NETOBJS = @EXTRA_NETOBJS@
|
||||
EXTRA_TEST = @EXTRA_TEST@
|
||||
F77 = @F77@
|
||||
FCNTL_H = @FCNTL_H@
|
||||
FFLAGS = @FFLAGS@
|
||||
FLOAT_H = @FLOAT_H@
|
||||
FLOORF_LIBM = @FLOORF_LIBM@
|
||||
GETADDRINFO_LIB = @GETADDRINFO_LIB@
|
||||
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
|
||||
GETOPT_H = @GETOPT_H@
|
||||
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
|
||||
|
@ -298,47 +319,85 @@ GL_COND_LIBTOOL_FALSE = @GL_COND_LIBTOOL_FALSE@
|
|||
GL_COND_LIBTOOL_TRUE = @GL_COND_LIBTOOL_TRUE@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GMSGFMT_015 = @GMSGFMT_015@
|
||||
GNULIB_ACCEPT = @GNULIB_ACCEPT@
|
||||
GNULIB_ATOLL = @GNULIB_ATOLL@
|
||||
GNULIB_BIND = @GNULIB_BIND@
|
||||
GNULIB_BTOWC = @GNULIB_BTOWC@
|
||||
GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
|
||||
GNULIB_CEILF = @GNULIB_CEILF@
|
||||
GNULIB_CEILL = @GNULIB_CEILL@
|
||||
GNULIB_CHOWN = @GNULIB_CHOWN@
|
||||
GNULIB_CLOSE = @GNULIB_CLOSE@
|
||||
GNULIB_CONNECT = @GNULIB_CONNECT@
|
||||
GNULIB_DPRINTF = @GNULIB_DPRINTF@
|
||||
GNULIB_DUP2 = @GNULIB_DUP2@
|
||||
GNULIB_ENVIRON = @GNULIB_ENVIRON@
|
||||
GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@
|
||||
GNULIB_FCHDIR = @GNULIB_FCHDIR@
|
||||
GNULIB_FCLOSE = @GNULIB_FCLOSE@
|
||||
GNULIB_FFLUSH = @GNULIB_FFLUSH@
|
||||
GNULIB_FLOORF = @GNULIB_FLOORF@
|
||||
GNULIB_FLOORL = @GNULIB_FLOORL@
|
||||
GNULIB_FOPEN = @GNULIB_FOPEN@
|
||||
GNULIB_FPRINTF = @GNULIB_FPRINTF@
|
||||
GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
|
||||
GNULIB_FPUTC = @GNULIB_FPUTC@
|
||||
GNULIB_FPUTS = @GNULIB_FPUTS@
|
||||
GNULIB_FREOPEN = @GNULIB_FREOPEN@
|
||||
GNULIB_FREXP = @GNULIB_FREXP@
|
||||
GNULIB_FREXPL = @GNULIB_FREXPL@
|
||||
GNULIB_FSEEK = @GNULIB_FSEEK@
|
||||
GNULIB_FSEEKO = @GNULIB_FSEEKO@
|
||||
GNULIB_FSYNC = @GNULIB_FSYNC@
|
||||
GNULIB_FTELL = @GNULIB_FTELL@
|
||||
GNULIB_FTELLO = @GNULIB_FTELLO@
|
||||
GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@
|
||||
GNULIB_FWRITE = @GNULIB_FWRITE@
|
||||
GNULIB_GETADDRINFO = @GNULIB_GETADDRINFO@
|
||||
GNULIB_GETCWD = @GNULIB_GETCWD@
|
||||
GNULIB_GETDELIM = @GNULIB_GETDELIM@
|
||||
GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@
|
||||
GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@
|
||||
GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@
|
||||
GNULIB_GETLINE = @GNULIB_GETLINE@
|
||||
GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@
|
||||
GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
|
||||
GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
|
||||
GNULIB_GETPEERNAME = @GNULIB_GETPEERNAME@
|
||||
GNULIB_GETSOCKNAME = @GNULIB_GETSOCKNAME@
|
||||
GNULIB_GETSOCKOPT = @GNULIB_GETSOCKOPT@
|
||||
GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
|
||||
GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@
|
||||
GNULIB_INET_NTOP = @GNULIB_INET_NTOP@
|
||||
GNULIB_INET_PTON = @GNULIB_INET_PTON@
|
||||
GNULIB_ISFINITE = @GNULIB_ISFINITE@
|
||||
GNULIB_ISINF = @GNULIB_ISINF@
|
||||
GNULIB_ISNAN = @GNULIB_ISNAN@
|
||||
GNULIB_ISNAND = @GNULIB_ISNAND@
|
||||
GNULIB_ISNANF = @GNULIB_ISNANF@
|
||||
GNULIB_ISNANL = @GNULIB_ISNANL@
|
||||
GNULIB_LCHOWN = @GNULIB_LCHOWN@
|
||||
GNULIB_LDEXPL = @GNULIB_LDEXPL@
|
||||
GNULIB_LINK = @GNULIB_LINK@
|
||||
GNULIB_LISTEN = @GNULIB_LISTEN@
|
||||
GNULIB_LSEEK = @GNULIB_LSEEK@
|
||||
GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@
|
||||
GNULIB_MATHL = @GNULIB_MATHL@
|
||||
GNULIB_MBRLEN = @GNULIB_MBRLEN@
|
||||
GNULIB_MBRTOWC = @GNULIB_MBRTOWC@
|
||||
GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@
|
||||
GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@
|
||||
GNULIB_MBSCHR = @GNULIB_MBSCHR@
|
||||
GNULIB_MBSCSPN = @GNULIB_MBSCSPN@
|
||||
GNULIB_MBSINIT = @GNULIB_MBSINIT@
|
||||
GNULIB_MBSLEN = @GNULIB_MBSLEN@
|
||||
GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@
|
||||
GNULIB_MBSNLEN = @GNULIB_MBSNLEN@
|
||||
GNULIB_MBSNRTOWCS = @GNULIB_MBSNRTOWCS@
|
||||
GNULIB_MBSPBRK = @GNULIB_MBSPBRK@
|
||||
GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@
|
||||
GNULIB_MBSRCHR = @GNULIB_MBSRCHR@
|
||||
GNULIB_MBSRTOWCS = @GNULIB_MBSRTOWCS@
|
||||
GNULIB_MBSSEP = @GNULIB_MBSSEP@
|
||||
GNULIB_MBSSPN = @GNULIB_MBSSPN@
|
||||
GNULIB_MBSSTR = @GNULIB_MBSSTR@
|
||||
|
@ -348,18 +407,37 @@ GNULIB_MEMPCPY = @GNULIB_MEMPCPY@
|
|||
GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
|
||||
GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
|
||||
GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
|
||||
GNULIB_OBSTACK_PRINTF = @GNULIB_OBSTACK_PRINTF@
|
||||
GNULIB_OBSTACK_PRINTF_POSIX = @GNULIB_OBSTACK_PRINTF_POSIX@
|
||||
GNULIB_OPEN = @GNULIB_OPEN@
|
||||
GNULIB_PERROR = @GNULIB_PERROR@
|
||||
GNULIB_PRINTF = @GNULIB_PRINTF@
|
||||
GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
|
||||
GNULIB_PUTC = @GNULIB_PUTC@
|
||||
GNULIB_PUTCHAR = @GNULIB_PUTCHAR@
|
||||
GNULIB_PUTENV = @GNULIB_PUTENV@
|
||||
GNULIB_PUTS = @GNULIB_PUTS@
|
||||
GNULIB_RANDOM_R = @GNULIB_RANDOM_R@
|
||||
GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@
|
||||
GNULIB_READLINK = @GNULIB_READLINK@
|
||||
GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
|
||||
GNULIB_RECV = @GNULIB_RECV@
|
||||
GNULIB_RECVFROM = @GNULIB_RECVFROM@
|
||||
GNULIB_ROUND = @GNULIB_ROUND@
|
||||
GNULIB_ROUNDF = @GNULIB_ROUNDF@
|
||||
GNULIB_ROUNDL = @GNULIB_ROUNDL@
|
||||
GNULIB_RPMATCH = @GNULIB_RPMATCH@
|
||||
GNULIB_SEND = @GNULIB_SEND@
|
||||
GNULIB_SENDTO = @GNULIB_SENDTO@
|
||||
GNULIB_SETENV = @GNULIB_SETENV@
|
||||
GNULIB_SETSOCKOPT = @GNULIB_SETSOCKOPT@
|
||||
GNULIB_SHUTDOWN = @GNULIB_SHUTDOWN@
|
||||
GNULIB_SIGNBIT = @GNULIB_SIGNBIT@
|
||||
GNULIB_SLEEP = @GNULIB_SLEEP@
|
||||
GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
|
||||
GNULIB_SOCKET = @GNULIB_SOCKET@
|
||||
GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
|
||||
GNULIB_STDIO_H_SIGPIPE = @GNULIB_STDIO_H_SIGPIPE@
|
||||
GNULIB_STPCPY = @GNULIB_STPCPY@
|
||||
GNULIB_STPNCPY = @GNULIB_STPNCPY@
|
||||
GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
|
||||
|
@ -372,32 +450,57 @@ GNULIB_STRPBRK = @GNULIB_STRPBRK@
|
|||
GNULIB_STRSEP = @GNULIB_STRSEP@
|
||||
GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
|
||||
GNULIB_STRSTR = @GNULIB_STRSTR@
|
||||
GNULIB_STRTOD = @GNULIB_STRTOD@
|
||||
GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
|
||||
GNULIB_STRTOLL = @GNULIB_STRTOLL@
|
||||
GNULIB_STRTOULL = @GNULIB_STRTOULL@
|
||||
GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@
|
||||
GNULIB_TRUNC = @GNULIB_TRUNC@
|
||||
GNULIB_TRUNCF = @GNULIB_TRUNCF@
|
||||
GNULIB_TRUNCL = @GNULIB_TRUNCL@
|
||||
GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@
|
||||
GNULIB_UNSETENV = @GNULIB_UNSETENV@
|
||||
GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
|
||||
GNULIB_VDPRINTF = @GNULIB_VDPRINTF@
|
||||
GNULIB_VFPRINTF = @GNULIB_VFPRINTF@
|
||||
GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
|
||||
GNULIB_VPRINTF = @GNULIB_VPRINTF@
|
||||
GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
|
||||
GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@
|
||||
GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@
|
||||
GNULIB_WCRTOMB = @GNULIB_WCRTOMB@
|
||||
GNULIB_WCSNRTOMBS = @GNULIB_WCSNRTOMBS@
|
||||
GNULIB_WCSRTOMBS = @GNULIB_WCSRTOMBS@
|
||||
GNULIB_WCTOB = @GNULIB_WCTOB@
|
||||
GNULIB_WCWIDTH = @GNULIB_WCWIDTH@
|
||||
GNULIB_WRITE = @GNULIB_WRITE@
|
||||
GREP = @GREP@
|
||||
HAVE_ARPA_INET_H = @HAVE_ARPA_INET_H@
|
||||
HAVE_ATOLL = @HAVE_ATOLL@
|
||||
HAVE_BTOWC = @HAVE_BTOWC@
|
||||
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_ENVIRON = @HAVE_DECL_ENVIRON@
|
||||
HAVE_DECL_EXPL = @HAVE_DECL_EXPL@
|
||||
HAVE_DECL_FREEADDRINFO = @HAVE_DECL_FREEADDRINFO@
|
||||
HAVE_DECL_FREXPL = @HAVE_DECL_FREXPL@
|
||||
HAVE_DECL_GAI_STRERROR = @HAVE_DECL_GAI_STRERROR@
|
||||
HAVE_DECL_GETADDRINFO = @HAVE_DECL_GETADDRINFO@
|
||||
HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
|
||||
HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
|
||||
HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@
|
||||
HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
|
||||
HAVE_DECL_GETNAMEINFO = @HAVE_DECL_GETNAMEINFO@
|
||||
HAVE_DECL_INET_NTOP = @HAVE_DECL_INET_NTOP@
|
||||
HAVE_DECL_INET_PTON = @HAVE_DECL_INET_PTON@
|
||||
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_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@
|
||||
HAVE_DECL_SINL = @HAVE_DECL_SINL@
|
||||
HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
|
||||
HAVE_DECL_SQRTL = @HAVE_DECL_SQRTL@
|
||||
|
@ -410,25 +513,46 @@ 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_WCTOB = @HAVE_DECL_WCTOB@
|
||||
HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
|
||||
HAVE_DPRINTF = @HAVE_DPRINTF@
|
||||
HAVE_DUP2 = @HAVE_DUP2@
|
||||
HAVE_EUIDACCESS = @HAVE_EUIDACCESS@
|
||||
HAVE_FSEEKO = @HAVE_FSEEKO@
|
||||
HAVE_FSYNC = @HAVE_FSYNC@
|
||||
HAVE_FTELLO = @HAVE_FTELLO@
|
||||
HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
|
||||
HAVE_GETDOMAINNAME = @HAVE_GETDOMAINNAME@
|
||||
HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@
|
||||
HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@
|
||||
HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
|
||||
HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
|
||||
HAVE_GETUSERSHELL = @HAVE_GETUSERSHELL@
|
||||
HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
|
||||
HAVE_ISNAND = @HAVE_ISNAND@
|
||||
HAVE_ISNANF = @HAVE_ISNANF@
|
||||
HAVE_ISNANL = @HAVE_ISNANL@
|
||||
HAVE_ISWCNTRL = @HAVE_ISWCNTRL@
|
||||
HAVE_LINK = @HAVE_LINK@
|
||||
HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
|
||||
HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
|
||||
HAVE_MBRLEN = @HAVE_MBRLEN@
|
||||
HAVE_MBRTOWC = @HAVE_MBRTOWC@
|
||||
HAVE_MBSINIT = @HAVE_MBSINIT@
|
||||
HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@
|
||||
HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@
|
||||
HAVE_MEMPCPY = @HAVE_MEMPCPY@
|
||||
HAVE_MKDTEMP = @HAVE_MKDTEMP@
|
||||
HAVE_NETDB_H = @HAVE_NETDB_H@
|
||||
HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
|
||||
HAVE_OS_H = @HAVE_OS_H@
|
||||
HAVE_RANDOM_H = @HAVE_RANDOM_H@
|
||||
HAVE_RANDOM_R = @HAVE_RANDOM_R@
|
||||
HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@
|
||||
HAVE_READLINK = @HAVE_READLINK@
|
||||
HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
|
||||
HAVE_RPMATCH = @HAVE_RPMATCH@
|
||||
HAVE_SETENV = @HAVE_SETENV@
|
||||
HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
|
||||
HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
|
||||
|
@ -442,8 +566,16 @@ HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
|
|||
HAVE_STRNDUP = @HAVE_STRNDUP@
|
||||
HAVE_STRPBRK = @HAVE_STRPBRK@
|
||||
HAVE_STRSEP = @HAVE_STRSEP@
|
||||
HAVE_STRTOD = @HAVE_STRTOD@
|
||||
HAVE_STRTOLL = @HAVE_STRTOLL@
|
||||
HAVE_STRTOULL = @HAVE_STRTOULL@
|
||||
HAVE_STRUCT_ADDRINFO = @HAVE_STRUCT_ADDRINFO@
|
||||
HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@
|
||||
HAVE_STRUCT_SOCKADDR_STORAGE = @HAVE_STRUCT_SOCKADDR_STORAGE@
|
||||
HAVE_STRVERSCMP = @HAVE_STRVERSCMP@
|
||||
HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
|
||||
HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
|
||||
HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_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@
|
||||
|
@ -451,14 +583,20 @@ 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_VDPRINTF = @HAVE_VDPRINTF@
|
||||
HAVE_WCHAR_H = @HAVE_WCHAR_H@
|
||||
HAVE_WCRTOMB = @HAVE_WCRTOMB@
|
||||
HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@
|
||||
HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@
|
||||
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@
|
||||
HOSTENT_LIB = @HOSTENT_LIB@
|
||||
HOSTNAME = @HOSTNAME@
|
||||
INCLUDE_NEXT = @INCLUDE_NEXT@
|
||||
INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
|
@ -481,6 +619,10 @@ LIBS = @LTLIBINTL@ @LIBS@
|
|||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@
|
||||
LOCALE_FR = @LOCALE_FR@
|
||||
LOCALE_FR_UTF8 = @LOCALE_FR_UTF8@
|
||||
LOCALE_JA = @LOCALE_JA@
|
||||
LOCALE_ZH_CN = @LOCALE_ZH_CN@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
|
@ -493,15 +635,21 @@ MYSQLCFLAGS = @MYSQLCFLAGS@
|
|||
MYSQLINCLUDE = @MYSQLINCLUDE@
|
||||
MYSQLLIBS = @MYSQLLIBS@
|
||||
NEED_SETGID = @NEED_SETGID@
|
||||
NETDB_H = @NETDB_H@
|
||||
NETINET_IN_H = @NETINET_IN_H@
|
||||
NEXT_ARPA_INET_H = @NEXT_ARPA_INET_H@
|
||||
NEXT_ERRNO_H = @NEXT_ERRNO_H@
|
||||
NEXT_FCNTL_H = @NEXT_FCNTL_H@
|
||||
NEXT_FLOAT_H = @NEXT_FLOAT_H@
|
||||
NEXT_MATH_H = @NEXT_MATH_H@
|
||||
NEXT_NETDB_H = @NEXT_NETDB_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_TIME_H = @NEXT_TIME_H@
|
||||
NEXT_UNISTD_H = @NEXT_UNISTD_H@
|
||||
NEXT_WCHAR_H = @NEXT_WCHAR_H@
|
||||
NEXT_WCTYPE_H = @NEXT_WCTYPE_H@
|
||||
|
@ -543,16 +691,23 @@ PKG_ARCH = @PKG_ARCH@
|
|||
PLUGIN_TEST = @PLUGIN_TEST@
|
||||
POSUB = @POSUB@
|
||||
POW_LIB = @POW_LIB@
|
||||
PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@
|
||||
PST3CFLAGS = @PST3CFLAGS@
|
||||
PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
|
||||
PYTHON = @PYTHON@
|
||||
RADIUSLIBS = @RADIUSLIBS@
|
||||
RANLIB = @RANLIB@
|
||||
RELEASE = @RELEASE@
|
||||
RELEASE_PRESENT_FALSE = @RELEASE_PRESENT_FALSE@
|
||||
RELEASE_PRESENT_TRUE = @RELEASE_PRESENT_TRUE@
|
||||
REPLACE_BTOWC = @REPLACE_BTOWC@
|
||||
REPLACE_CEILF = @REPLACE_CEILF@
|
||||
REPLACE_CEILL = @REPLACE_CEILL@
|
||||
REPLACE_CHOWN = @REPLACE_CHOWN@
|
||||
REPLACE_CLOSE = @REPLACE_CLOSE@
|
||||
REPLACE_DPRINTF = @REPLACE_DPRINTF@
|
||||
REPLACE_FCHDIR = @REPLACE_FCHDIR@
|
||||
REPLACE_FCLOSE = @REPLACE_FCLOSE@
|
||||
REPLACE_FFLUSH = @REPLACE_FFLUSH@
|
||||
REPLACE_FLOORF = @REPLACE_FLOORF@
|
||||
REPLACE_FLOORL = @REPLACE_FLOORL@
|
||||
|
@ -568,12 +723,28 @@ REPLACE_FTELLO = @REPLACE_FTELLO@
|
|||
REPLACE_GETCWD = @REPLACE_GETCWD@
|
||||
REPLACE_GETLINE = @REPLACE_GETLINE@
|
||||
REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
|
||||
REPLACE_HUGE_VAL = @REPLACE_HUGE_VAL@
|
||||
REPLACE_ISFINITE = @REPLACE_ISFINITE@
|
||||
REPLACE_ISINF = @REPLACE_ISINF@
|
||||
REPLACE_ISNAN = @REPLACE_ISNAN@
|
||||
REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@
|
||||
REPLACE_LCHOWN = @REPLACE_LCHOWN@
|
||||
REPLACE_LDEXPL = @REPLACE_LDEXPL@
|
||||
REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@
|
||||
REPLACE_LSEEK = @REPLACE_LSEEK@
|
||||
REPLACE_MBRLEN = @REPLACE_MBRLEN@
|
||||
REPLACE_MBRTOWC = @REPLACE_MBRTOWC@
|
||||
REPLACE_MBSINIT = @REPLACE_MBSINIT@
|
||||
REPLACE_MBSNRTOWCS = @REPLACE_MBSNRTOWCS@
|
||||
REPLACE_MBSRTOWCS = @REPLACE_MBSRTOWCS@
|
||||
REPLACE_MBSTATE_T = @REPLACE_MBSTATE_T@
|
||||
REPLACE_MEMMEM = @REPLACE_MEMMEM@
|
||||
REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
|
||||
REPLACE_NAN = @REPLACE_NAN@
|
||||
REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@
|
||||
REPLACE_OBSTACK_PRINTF = @REPLACE_OBSTACK_PRINTF@
|
||||
REPLACE_OPEN = @REPLACE_OPEN@
|
||||
REPLACE_PERROR = @REPLACE_PERROR@
|
||||
REPLACE_PRINTF = @REPLACE_PRINTF@
|
||||
REPLACE_PUTENV = @REPLACE_PUTENV@
|
||||
REPLACE_ROUND = @REPLACE_ROUND@
|
||||
|
@ -583,19 +754,32 @@ REPLACE_SIGNBIT = @REPLACE_SIGNBIT@
|
|||
REPLACE_SIGNBIT_USING_GCC = @REPLACE_SIGNBIT_USING_GCC@
|
||||
REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
|
||||
REPLACE_SPRINTF = @REPLACE_SPRINTF@
|
||||
REPLACE_STDIO_WRITE_FUNCS = @REPLACE_STDIO_WRITE_FUNCS@
|
||||
REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
|
||||
REPLACE_STRDUP = @REPLACE_STRDUP@
|
||||
REPLACE_STRERROR = @REPLACE_STRERROR@
|
||||
REPLACE_STRPTIME = @REPLACE_STRPTIME@
|
||||
REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
|
||||
REPLACE_STRSTR = @REPLACE_STRSTR@
|
||||
REPLACE_STRTOD = @REPLACE_STRTOD@
|
||||
REPLACE_TIMEGM = @REPLACE_TIMEGM@
|
||||
REPLACE_TRUNCL = @REPLACE_TRUNCL@
|
||||
REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
|
||||
REPLACE_VDPRINTF = @REPLACE_VDPRINTF@
|
||||
REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
|
||||
REPLACE_VPRINTF = @REPLACE_VPRINTF@
|
||||
REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
|
||||
REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
|
||||
REPLACE_WCRTOMB = @REPLACE_WCRTOMB@
|
||||
REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@
|
||||
REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@
|
||||
REPLACE_WCTOB = @REPLACE_WCTOB@
|
||||
REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
|
||||
REPLACE_WRITE = @REPLACE_WRITE@
|
||||
REV_DATESTAMP = @REV_DATESTAMP@
|
||||
REV_TIMESTAMP = @REV_TIMESTAMP@
|
||||
SCRIPT_TEST = @SCRIPT_TEST@
|
||||
SERVENT_LIB = @SERVENT_LIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SH = @SH@
|
||||
SHELL = @SHELL@
|
||||
|
@ -609,6 +793,11 @@ STDINT_H = @STDINT_H@
|
|||
STRIP = @STRIP@
|
||||
SUPPORT = @SUPPORT@
|
||||
SYS_SOCKET_H = @SYS_SOCKET_H@
|
||||
SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
|
||||
TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@
|
||||
UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@
|
||||
USE_LIBTAP_LOCAL_FALSE = @USE_LIBTAP_LOCAL_FALSE@
|
||||
USE_LIBTAP_LOCAL_TRUE = @USE_LIBTAP_LOCAL_TRUE@
|
||||
USE_NLS = @USE_NLS@
|
||||
USE_PARSE_INI_FALSE = @USE_PARSE_INI_FALSE@
|
||||
USE_PARSE_INI_TRUE = @USE_PARSE_INI_TRUE@
|
||||
|
@ -676,6 +865,8 @@ sharedstatedir = @sharedstatedir@
|
|||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
with_trusted_path = @with_trusted_path@
|
||||
@RELEASE_PRESENT_TRUE@NP_VERSION = $(PACKAGE_VERSION)
|
||||
AM_CFLAGS = -DNP_VERSION='"$(NP_VERSION)"'
|
||||
INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl @LDAPINCLUDE@ @PGINCLUDE@ @SSLINCLUDE@
|
||||
check_tcp_programs = check_ftp check_imap check_nntp check_pop \
|
||||
check_udp check_clamd @check_tcp_ssl@
|
||||
|
@ -707,10 +898,10 @@ check_ldap_LDADD = $(NETLIBS) $(LDAPLIBS)
|
|||
check_load_LDADD = $(BASEOBJS) popen.o
|
||||
check_mrtg_LDADD = $(BASEOBJS)
|
||||
check_mrtgtraf_LDADD = $(BASEOBJS)
|
||||
check_mysql_CFLAGS = $(MYSQLCFLAGS)
|
||||
check_mysql_CFLAGS = $(MYSQLCFLAGS) -DNP_VERSION='"$(NP_VERSION)"'
|
||||
check_mysql_CPPFLAGS = $(MYSQLINCLUDE)
|
||||
check_mysql_LDADD = $(NETLIBS) $(MYSQLLIBS)
|
||||
check_mysql_query_CFLAGS = $(MYSQLCFLAGS)
|
||||
check_mysql_query_CFLAGS = $(MYSQLCFLAGS) -DNP_VERSION='"$(NP_VERSION)"'
|
||||
check_mysql_query_CPPFLAGS = $(MYSQLINCLUDE)
|
||||
check_mysql_query_LDADD = $(NETLIBS) $(MYSQLLIBS)
|
||||
check_nagios_LDADD = $(BASEOBJS) runcmd.o
|
||||
|
@ -721,10 +912,10 @@ check_nwstat_LDADD = $(NETLIBS)
|
|||
check_overcr_LDADD = $(NETLIBS)
|
||||
check_pgsql_LDADD = $(NETLIBS) $(PGLIBS)
|
||||
check_ping_LDADD = $(NETLIBS) popen.o
|
||||
check_procs_LDADD = $(BASEOBJS) popen.o
|
||||
check_procs_LDADD = $(BASEOBJS)
|
||||
check_radius_LDADD = $(NETLIBS) $(RADIUSLIBS)
|
||||
check_real_LDADD = $(NETLIBS)
|
||||
check_snmp_LDADD = $(BASEOBJS) popen.o
|
||||
check_snmp_LDADD = $(BASEOBJS)
|
||||
check_smtp_LDADD = $(SSLOBJS) $(NETLIBS) $(SSLLIBS)
|
||||
check_ssh_LDADD = $(NETLIBS)
|
||||
check_swap_LDADD = $(MATHLIBS) $(BASEOBJS) popen.o
|
||||
|
@ -733,7 +924,7 @@ check_time_LDADD = $(NETLIBS)
|
|||
check_ntp_time_LDADD = $(NETLIBS) $(MATHLIBS)
|
||||
check_ups_LDADD = $(NETLIBS)
|
||||
check_users_LDADD = $(BASEOBJS) popen.o
|
||||
check_by_ssh_LDADD = $(NETLIBS) runcmd.o
|
||||
check_by_ssh_LDADD = $(NETLIBS)
|
||||
check_ide_smart_LDADD = $(BASEOBJS)
|
||||
negate_LDADD = $(BASEOBJS)
|
||||
urlize_LDADD = $(BASEOBJS) popen.o
|
||||
|
@ -765,7 +956,7 @@ check_ping_DEPENDENCIES = check_ping.c $(NETOBJS) popen.o $(DEPLIBS)
|
|||
check_procs_DEPENDENCIES = check_procs.c $(BASEOBJS) popen.o $(DEPLIBS)
|
||||
check_radius_DEPENDENCIES = check_radius.c $(NETOBJS) $(DEPLIBS)
|
||||
check_real_DEPENDENCIES = check_real.c $(NETOBJS) $(DEPLIBS)
|
||||
check_snmp_DEPENDENCIES = check_snmp.c $(BASEOBJS) popen.o $(DEPLIBS)
|
||||
check_snmp_DEPENDENCIES = check_snmp.c $(BASEOBJS) $(DEPLIBS)
|
||||
check_smtp_DEPENDENCIES = check_smtp.c $(SSLOBJS) $(NETOBJS) $(DEPLIBS)
|
||||
check_ssh_DEPENDENCIES = check_ssh.c $(NETOBJS) $(DEPLIBS)
|
||||
check_swap_DEPENDENCIES = check_swap.c $(BASEOBJS) popen.o $(DEPLIBS)
|
||||
|
@ -774,7 +965,7 @@ check_time_DEPENDENCIES = check_time.c $(NETOBJS) $(DEPLIBS)
|
|||
check_ntp_time_DEPENDENCIES = check_ntp_time.c $(NETOBJS) $(DEPLIBS)
|
||||
check_ups_DEPENDENCIES = check_ups.c $(NETOBJS) $(DEPLIBS)
|
||||
check_users_DEPENDENCIES = check_users.c $(BASEOBJS) popen.o $(DEPLIBS)
|
||||
check_by_ssh_DEPENDENCIES = check_by_ssh.c $(NETOBJS) runcmd.o $(DEPLIBS)
|
||||
check_by_ssh_DEPENDENCIES = check_by_ssh.c $(NETOBJS) $(DEPLIBS)
|
||||
negate_DEPENDENCIES = negate.c $(BASEOBJS) $(DEPLIBS)
|
||||
urlize_DEPENDENCIES = urlize.c $(BASEOBJS) popen.o $(DEPLIBS)
|
||||
all: all-am
|
||||
|
@ -1313,6 +1504,10 @@ uninstall-am: uninstall-info-am uninstall-libexecPROGRAMS \
|
|||
tags uninstall uninstall-am uninstall-info-am \
|
||||
uninstall-libexecPROGRAMS uninstall-local
|
||||
|
||||
@RELEASE_PRESENT_FALSE@NP-VERSION-FILE: .FORCE-NP-VERSION-FILE
|
||||
@RELEASE_PRESENT_FALSE@ @$(SHELL_PATH) $(top_srcdir)/NP-VERSION-GEN
|
||||
@RELEASE_PRESENT_FALSE@.FORCE-NP-VERSION-FILE:
|
||||
@RELEASE_PRESENT_FALSE@-include NP-VERSION-FILE
|
||||
|
||||
test:
|
||||
perl -I $(top_builddir) -I $(top_srcdir) ../test.pl
|
||||
|
@ -1332,10 +1527,6 @@ utils.o: utils.c utils.h $(PLUGINHDRS)
|
|||
netutils.o: netutils.c netutils.h $(PLUGINHDRS)
|
||||
sslutils.o: sslutils.c netutils.h $(PLUGINHDRS)
|
||||
|
||||
getaddrinfo.o: getaddrinfo.h $(PLUGINHDRS)
|
||||
|
||||
gethostbyname.o: gethostbyname.h $(PLUGINHDRS)
|
||||
|
||||
all-local: $(check_tcp_programs)
|
||||
|
||||
$(check_tcp_programs): check_tcp
|
||||
|
@ -1349,6 +1540,7 @@ install-exec-hook:
|
|||
|
||||
clean-local:
|
||||
rm -f $(check_tcp_programs)
|
||||
rm -f NP-VERSION-FILE
|
||||
|
||||
uninstall-local:
|
||||
cd $(DESTDIR)$(libexecdir) && rm -f $(check_tcp_programs)
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
*
|
||||
* 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
|
||||
|
@ -29,12 +27,9 @@
|
|||
* 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: 1991 $";
|
||||
const char *copyright = "2006-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -116,7 +111,7 @@ int main (int argc, char **argv) {
|
|||
result = max_state(result, STATE_OK);
|
||||
}
|
||||
|
||||
printf(_("APT %s: %d packages available for %s (%d critical updates). %s%s%s%s\n"),
|
||||
printf(_("APT %s: %d packages available for %s (%d critical updates). %s%s%s%s\n"),
|
||||
state_text(result),
|
||||
packages_available,
|
||||
(upgrade==DIST_UPGRADE)?"dist-upgrade":"upgrade",
|
||||
|
@ -159,7 +154,7 @@ int process_arguments (int argc, char **argv) {
|
|||
print_help();
|
||||
exit(STATE_OK);
|
||||
case 'V':
|
||||
print_revision(progname, revision);
|
||||
print_revision(progname, NP_VERSION);
|
||||
exit(STATE_OK);
|
||||
case 'v':
|
||||
verbose++;
|
||||
|
@ -305,7 +300,7 @@ int run_upgrade(int *pkgcount, int *secpkgcount){
|
|||
}
|
||||
regfree(&ireg);
|
||||
regfree(&sreg);
|
||||
if(do_exclude!=NULL) regfree(&ereg);
|
||||
if(do_exclude!=NULL) regfree(&ereg);
|
||||
free(cmdline);
|
||||
return result;
|
||||
}
|
||||
|
@ -364,7 +359,7 @@ char* add_to_regexp(char *expr, const char *next){
|
|||
sprintf((char*)(re+strlen(re)-2), "|%s) ", next);
|
||||
}
|
||||
|
||||
return re;
|
||||
return re;
|
||||
}
|
||||
|
||||
char* construct_cmdline(upgrade_type u, const char *opts){
|
||||
|
@ -404,7 +399,7 @@ char* construct_cmdline(upgrade_type u, const char *opts){
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision(progname, revision);
|
||||
print_revision(progname, NP_VERSION);
|
||||
|
||||
printf(_(COPYRIGHT), copyright, email);
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* License: GPL
|
||||
* 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
|
||||
|
@ -25,22 +23,25 @@
|
|||
* 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: 2002 $";
|
||||
const char *copyright = "2000-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
#include "utils.h"
|
||||
#include "runcmd.h"
|
||||
#include "netutils.h"
|
||||
#include "utils_cmd.h"
|
||||
|
||||
#ifndef NP_MAXARGS
|
||||
#define NP_MAXARGS 1024
|
||||
#endif
|
||||
|
||||
int process_arguments (int, char **);
|
||||
int validate_arguments (void);
|
||||
void comm_append (const char *);
|
||||
void print_help (void);
|
||||
void print_usage (void);
|
||||
|
||||
|
@ -49,7 +50,8 @@ unsigned int services = 0;
|
|||
int skip_stdout = 0;
|
||||
int skip_stderr = 0;
|
||||
char *remotecmd = NULL;
|
||||
char *comm = NULL;
|
||||
char **commargv = NULL;
|
||||
int commargc = 0;
|
||||
char *hostname = NULL;
|
||||
char *outputfile = NULL;
|
||||
char *host_shortname = NULL;
|
||||
|
@ -67,10 +69,10 @@ main (int argc, char **argv)
|
|||
int i;
|
||||
time_t local_time;
|
||||
FILE *fp = NULL;
|
||||
struct output chld_out, chld_err;
|
||||
output chld_out, chld_err;
|
||||
|
||||
remotecmd = "";
|
||||
comm = strdup (SSH_COMMAND);
|
||||
comm_append(SSH_COMMAND);
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
|
@ -84,16 +86,19 @@ main (int argc, char **argv)
|
|||
usage_va(_("Could not parse arguments"));
|
||||
|
||||
/* Set signal handling and alarm timeout */
|
||||
if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) {
|
||||
if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) {
|
||||
usage_va(_("Cannot catch SIGALRM"));
|
||||
}
|
||||
alarm (timeout_interval);
|
||||
|
||||
/* run the command */
|
||||
if (verbose)
|
||||
printf ("%s\n", comm);
|
||||
if (verbose) {
|
||||
printf ("Command: %s\n", commargv[0]);
|
||||
for (i=1; i<commargc; i++)
|
||||
printf ("Argument %i: %s\n", i, commargv[i]);
|
||||
}
|
||||
|
||||
result = np_runcmd(comm, &chld_out, &chld_err, 0);
|
||||
result = cmd_run_array (commargv, &chld_out, &chld_err, 0);
|
||||
|
||||
if (skip_stdout == -1) /* --skip-stdout specified without argument */
|
||||
skip_stdout = chld_out.lines;
|
||||
|
@ -201,7 +206,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
|
@ -222,7 +227,8 @@ process_arguments (int argc, char **argv)
|
|||
case 'p': /* port number */
|
||||
if (!is_integer (optarg))
|
||||
usage_va(_("Port must be a positive integer"));
|
||||
asprintf (&comm,"%s -p %s", comm, optarg);
|
||||
comm_append("-p");
|
||||
comm_append(optarg);
|
||||
break;
|
||||
case 'O': /* output file */
|
||||
outputfile = optarg;
|
||||
|
@ -244,18 +250,32 @@ process_arguments (int argc, char **argv)
|
|||
break;
|
||||
|
||||
case 'u':
|
||||
c = 'l';
|
||||
comm_append("-l");
|
||||
comm_append(optarg);
|
||||
break;
|
||||
case 'l': /* login name */
|
||||
comm_append("-l");
|
||||
comm_append(optarg);
|
||||
break;
|
||||
case 'i': /* identity */
|
||||
asprintf (&comm, "%s -%c %s", comm, c, optarg);
|
||||
comm_append("-i");
|
||||
comm_append(optarg);
|
||||
break;
|
||||
|
||||
case '1': /* Pass these switches directly to ssh */
|
||||
comm_append("-1");
|
||||
break;
|
||||
case '2': /* 1 to force version 1, 2 to force version 2 */
|
||||
comm_append("-2");
|
||||
break;
|
||||
case '4': /* -4 for IPv4 */
|
||||
comm_append("-4");
|
||||
break;
|
||||
case '6': /* -6 for IPv6 */
|
||||
comm_append("-6");
|
||||
break;
|
||||
case 'f': /* fork to background */
|
||||
asprintf (&comm, "%s -%c", comm, c);
|
||||
comm_append("-f");
|
||||
break;
|
||||
case 'C': /* Command for remote machine */
|
||||
commands++;
|
||||
|
@ -280,10 +300,11 @@ process_arguments (int argc, char **argv)
|
|||
skip_stderr = atoi (optarg);
|
||||
break;
|
||||
case 'o': /* Extra options for the ssh command */
|
||||
asprintf (&comm, "%s -%c '%s'", comm, c, optarg);
|
||||
comm_append("-o");
|
||||
comm_append(optarg);
|
||||
break;
|
||||
case 'q': /* Tell the ssh command to be quiet */
|
||||
asprintf (&comm, "%s -%c", comm, c);
|
||||
comm_append("-q");
|
||||
break;
|
||||
default: /* help */
|
||||
usage5();
|
||||
|
@ -313,12 +334,27 @@ process_arguments (int argc, char **argv)
|
|||
if (remotecmd == NULL || strlen (remotecmd) <= 1)
|
||||
usage_va(_("No remotecmd"));
|
||||
|
||||
asprintf (&comm, "%s %s '%s'", comm, hostname, remotecmd);
|
||||
comm_append(hostname);
|
||||
comm_append(remotecmd);
|
||||
|
||||
return validate_arguments ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
comm_append (const char *str)
|
||||
{
|
||||
|
||||
if (++commargc > NP_MAXARGS)
|
||||
die(STATE_UNKNOWN, _("%s: Argument limit of %d exceeded\n"), progname, NP_MAXARGS);
|
||||
|
||||
if ((commargv = (char **)realloc(commargv, (commargc+1) * sizeof(char *))) == NULL)
|
||||
die(STATE_UNKNOWN, _("Can not (re)allocate 'commargv' buffer\n"));
|
||||
|
||||
commargv[commargc-1] = strdup(str);
|
||||
commargv[commargc] = NULL;
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
validate_arguments (void)
|
||||
|
@ -339,7 +375,7 @@ validate_arguments (void)
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Karl DeBisschop <kdebisschop@users.sourceforge.net>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
|
|
@ -6,9 +6,6 @@
|
|||
* 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
|
||||
|
@ -22,12 +19,10 @@
|
|||
* 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: 1991 $";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -124,7 +119,7 @@ int main(int argc, char **argv){
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* return the status of the cluster */
|
||||
if(check_type==CHECK_SERVICES){
|
||||
|
@ -149,7 +144,7 @@ int main(int argc, char **argv){
|
|||
int process_arguments(int argc, char **argv){
|
||||
int c;
|
||||
int option=0;
|
||||
static struct option longopts[]={
|
||||
static struct option longopts[]={
|
||||
{"data", required_argument,0,'d'},
|
||||
{"warning", required_argument,0,'w'},
|
||||
{"critical", required_argument,0,'c'},
|
||||
|
@ -204,7 +199,7 @@ int process_arguments(int argc, char **argv){
|
|||
break;
|
||||
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
break;
|
||||
|
||||
|
@ -228,7 +223,7 @@ int process_arguments(int argc, char **argv){
|
|||
void
|
||||
print_help(void)
|
||||
{
|
||||
print_revision(progname, revision);
|
||||
print_revision(progname, NP_VERSION);
|
||||
printf ("Copyright (c) 2000-2004 Ethan Galstad (nagios@nagios.org)\n");
|
||||
printf(COPYRIGHT, copyright, email);
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* License: GPL
|
||||
* 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
|
||||
|
@ -25,7 +23,6 @@
|
|||
* 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_dig.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
@ -36,7 +33,6 @@
|
|||
* because on some architectures those strings are in non-writable memory */
|
||||
|
||||
const char *progname = "check_dig";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "2002-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -143,8 +139,10 @@ main (int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
if (result == STATE_UNKNOWN)
|
||||
if (result == STATE_UNKNOWN) {
|
||||
msg = (char *)_("No ANSWER SECTION found");
|
||||
result = STATE_CRITICAL;
|
||||
}
|
||||
|
||||
/* If we get anything on STDERR, at least set warning */
|
||||
if(chld_err.buflen > 0) {
|
||||
|
@ -218,7 +216,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'H': /* hostname */
|
||||
host_or_die(optarg);
|
||||
|
@ -295,7 +293,10 @@ process_arguments (int argc, char **argv)
|
|||
int
|
||||
validate_arguments (void)
|
||||
{
|
||||
return OK;
|
||||
if (query_address != NULL)
|
||||
return OK;
|
||||
else
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
@ -307,7 +308,7 @@ print_help (void)
|
|||
|
||||
asprintf (&myport, "%d", DEFAULT_PORT);
|
||||
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 2000 Karl DeBisschop <kdebisschop@users.sourceforge.net>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
@ -357,7 +358,7 @@ void
|
|||
print_usage (void)
|
||||
{
|
||||
printf (_("Usage:"));
|
||||
printf ("%s -H <host> -l <query_address> [-p <server port>]\n", progname);
|
||||
printf ("%s -l <query_address> [-H <host>] [-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");
|
||||
}
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* License: GPL
|
||||
* 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
|
||||
|
@ -25,13 +23,11 @@
|
|||
* 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_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: 1991 $";
|
||||
const char *copyright = "1999-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -118,9 +114,6 @@ enum
|
|||
#pragma alloca
|
||||
#endif
|
||||
|
||||
/* Linked list of mounted filesystems. */
|
||||
static struct mount_entry *mount_list;
|
||||
|
||||
int process_arguments (int, char **);
|
||||
void print_path (const char *mypath);
|
||||
void set_all_thresholds (struct parameter_list *path);
|
||||
|
@ -201,7 +194,7 @@ main (int argc, char **argv)
|
|||
/* If a list of paths has not been selected, find entire
|
||||
mount list and create list of paths
|
||||
*/
|
||||
if (path_selected == FALSE) {
|
||||
if (path_selected == FALSE) {
|
||||
for (me = mount_list; me; me = me->me_next) {
|
||||
if (! (path = np_find_parameter(path_select_list, me->me_mountdir))) {
|
||||
path = np_add_parameter(&path_select_list, me->me_mountdir);
|
||||
|
@ -227,11 +220,11 @@ main (int argc, char **argv)
|
|||
/* Process for every path in list */
|
||||
for (path = path_select_list; path; path=path->name_next) {
|
||||
|
||||
if (verbose > 3 && path->freespace_percent->warning != NULL && path->freespace_percent->critical != NULL)
|
||||
if (verbose >= 3 && path->freespace_percent->warning != NULL && path->freespace_percent->critical != NULL)
|
||||
printf("Thresholds(pct) for %s warn: %f crit %f\n",path->name, path->freespace_percent->warning->end,
|
||||
path->freespace_percent->critical->end);
|
||||
|
||||
if (verbose > 3 && path->group != NULL)
|
||||
if (verbose >= 3 && path->group != NULL)
|
||||
printf("Group of %s: %s\n",path->name,path->group);
|
||||
|
||||
/* reset disk result */
|
||||
|
@ -271,7 +264,7 @@ main (int argc, char **argv)
|
|||
fsp.fsu_files += tmpfsp.fsu_files; /* Total file nodes. */
|
||||
fsp.fsu_ffree += tmpfsp.fsu_ffree; /* Free file nodes. */
|
||||
|
||||
if (verbose > 3)
|
||||
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); */
|
||||
|
||||
|
@ -296,8 +289,8 @@ main (int argc, char **argv)
|
|||
/* Skip excluded fstypes */
|
||||
} else if (fs_exclude_list && np_find_name (fs_exclude_list, me->me_type)) {
|
||||
continue;
|
||||
/* Skip excluded fs's */
|
||||
} else if (dp_exclude_list &&
|
||||
/* Skip excluded fs's */
|
||||
} else if (dp_exclude_list &&
|
||||
(np_find_name (dp_exclude_list, me->me_devname) ||
|
||||
np_find_name (dp_exclude_list, me->me_mountdir))) {
|
||||
continue;
|
||||
|
@ -330,7 +323,7 @@ main (int argc, char **argv)
|
|||
dfree_inodes_percent = 100 - dused_inodes_percent;
|
||||
|
||||
if (verbose >= 3) {
|
||||
printf ("For %s, used_pct=%g free_pct=%g used_units=%g free_units=%g total_units=%g used_inodes_pct=%g free_inodes_pct=%g fsp.fsu_blocksize=%llu mult=%llu\n",
|
||||
printf ("For %s, used_pct=%g free_pct=%g used_units=%g free_units=%g total_units=%g used_inodes_pct=%g free_inodes_pct=%g fsp.fsu_blocksize=%llu mult=%llu\n",
|
||||
me->me_mountdir, dused_pct, dfree_pct, dused_units, dfree_units, dtotal_units, dused_inodes_percent, dfree_inodes_percent, fsp.fsu_blocksize, mult);
|
||||
}
|
||||
|
||||
|
@ -420,7 +413,7 @@ main (int argc, char **argv)
|
|||
|
||||
}
|
||||
|
||||
if (verbose > 2)
|
||||
if (verbose >= 2)
|
||||
asprintf (&output, "%s%s", output, details);
|
||||
|
||||
|
||||
|
@ -433,7 +426,7 @@ double calculate_percent(uintmax_t value, uintmax_t total) {
|
|||
double pct = -1;
|
||||
/* I don't understand the below, but it is taken from coreutils' df */
|
||||
/* Seems to be calculating pct, in the best possible way */
|
||||
if (value <= TYPE_MAXIMUM(uintmax_t) / 100
|
||||
if (value <= TYPE_MAXIMUM(uintmax_t) / 100
|
||||
&& total != 0) {
|
||||
uintmax_t u100 = value * 100;
|
||||
pct = u100 / total + (u100 % total != 0);
|
||||
|
@ -477,8 +470,8 @@ 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'},
|
||||
{"kilobytes", required_argument, 0, 'k'},
|
||||
{"megabytes", required_argument, 0, 'm'},
|
||||
{"kilobytes", no_argument, 0, 'k'},
|
||||
{"megabytes", no_argument, 0, 'm'},
|
||||
{"units", required_argument, 0, 'u'},
|
||||
{"path", required_argument, 0, 'p'},
|
||||
{"partition", required_argument, 0, 'p'},
|
||||
|
@ -549,7 +542,7 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
break;
|
||||
|
||||
/* Awful mistake where the range values do not make sense. Normally,
|
||||
/* Awful mistake where the range values do not make sense. Normally,
|
||||
you alert if the value is within the range, but since we are using
|
||||
freespace, we have to alert if outside the range. Thus we artifically
|
||||
force @ at the beginning of the range, so that it is backwards compatible
|
||||
|
@ -623,10 +616,10 @@ process_arguments (int argc, char **argv)
|
|||
case 'L':
|
||||
stat_remote_fs = 1;
|
||||
case 'l':
|
||||
show_local_fs = 1;
|
||||
show_local_fs = 1;
|
||||
break;
|
||||
case 'p': /* select path */
|
||||
if (! (warn_freespace_units || crit_freespace_units || warn_freespace_percent ||
|
||||
if (! (warn_freespace_units || crit_freespace_units || warn_freespace_percent ||
|
||||
crit_freespace_percent || warn_usedspace_units || crit_usedspace_units ||
|
||||
warn_usedspace_percent || crit_usedspace_percent || warn_usedinodes_percent ||
|
||||
crit_usedinodes_percent || warn_freeinodes_percent || crit_freeinodes_percent )) {
|
||||
|
@ -639,8 +632,15 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
se->group = group;
|
||||
set_all_thresholds(se);
|
||||
np_set_best_match(se, mount_list, exact_match);
|
||||
|
||||
/* With autofs, it is required to stat() the path before re-populating the mount_list */
|
||||
stat_path(se);
|
||||
/* NB: We can't free the old mount_list "just like that": both list pointers and struct
|
||||
* pointers are copied around. One of the reason it wasn't done yet is that other parts
|
||||
* of check_disk need the same kind of cleanup so it'd better be done as a whole */
|
||||
mount_list = read_file_system_list (0);
|
||||
np_set_best_match(se, mount_list, exact_match);
|
||||
|
||||
path_selected = TRUE;
|
||||
break;
|
||||
case 'x': /* exclude path or partition */
|
||||
|
@ -661,19 +661,19 @@ process_arguments (int argc, char **argv)
|
|||
break;
|
||||
case 'E':
|
||||
if (path_selected)
|
||||
die (STATE_UNKNOWN, "DISK %s: %s", _("UNKNOWN"), _("Must set -E before selecting pathes\n"));
|
||||
die (STATE_UNKNOWN, "DISK %s: %s", _("UNKNOWN"), _("Must set -E before selecting paths\n"));
|
||||
exact_match = TRUE;
|
||||
break;
|
||||
case 'g':
|
||||
if (path_selected)
|
||||
die (STATE_UNKNOWN, "DISK %s: %s", _("UNKNOWN"), _("Must set group value before selecting pathes \n"));
|
||||
die (STATE_UNKNOWN, "DISK %s: %s", _("UNKNOWN"), _("Must set group value before selecting paths\n"));
|
||||
group = optarg;
|
||||
break;
|
||||
case 'I':
|
||||
cflags |= REG_ICASE;
|
||||
case 'i':
|
||||
if (!path_selected)
|
||||
die (STATE_UNKNOWN, "DISK %s: %s\n", _("UNKNOWN"), _("Pathes need to be selected before using -i/-I. Use -A to select all pathes explicitly"));
|
||||
die (STATE_UNKNOWN, "DISK %s: %s\n", _("UNKNOWN"), _("Paths need to be selected before using -i/-I. Use -A to select all paths explicitly"));
|
||||
err = regcomp(&re, optarg, cflags);
|
||||
if (err != 0) {
|
||||
regerror (err, &re, errbuf, MAX_INPUT_BUFFER);
|
||||
|
@ -713,7 +713,7 @@ process_arguments (int argc, char **argv)
|
|||
case 'R':
|
||||
cflags |= REG_ICASE;
|
||||
case 'r':
|
||||
if (! (warn_freespace_units || crit_freespace_units || warn_freespace_percent ||
|
||||
if (! (warn_freespace_units || crit_freespace_units || warn_freespace_percent ||
|
||||
crit_freespace_percent || warn_usedspace_units || crit_usedspace_units ||
|
||||
warn_usedspace_percent || crit_usedspace_percent || warn_usedinodes_percent ||
|
||||
crit_usedinodes_percent || warn_freeinodes_percent || crit_freeinodes_percent )) {
|
||||
|
@ -729,7 +729,7 @@ process_arguments (int argc, char **argv)
|
|||
for (me = mount_list; me; me = me->me_next) {
|
||||
if (np_regex_match_mount_entry(me, &re)) {
|
||||
fnd = TRUE;
|
||||
if (verbose > 3)
|
||||
if (verbose >= 3)
|
||||
printf("%s %s matching expression %s\n", me->me_devname, me->me_mountdir, optarg);
|
||||
|
||||
/* add parameter if not found. overwrite thresholds if path has already been added */
|
||||
|
@ -757,10 +757,9 @@ process_arguments (int argc, char **argv)
|
|||
case 'C':
|
||||
/* add all mount entries to path_select list if no partitions have been explicitly defined using -p */
|
||||
if (path_selected == FALSE) {
|
||||
struct mount_entry *me;
|
||||
struct parameter_list *path;
|
||||
for (me = mount_list; me; me = me->me_next) {
|
||||
if (! (path = np_find_parameter(path_select_list, me->me_mountdir)))
|
||||
if (! (path = np_find_parameter(path_select_list, me->me_mountdir)))
|
||||
path = np_add_parameter(&path_select_list, me->me_mountdir);
|
||||
path->best_match = me;
|
||||
path->group = group;
|
||||
|
@ -784,7 +783,7 @@ process_arguments (int argc, char **argv)
|
|||
group = NULL;
|
||||
break;
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
|
@ -819,7 +818,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
|
||||
void
|
||||
print_path (const char *mypath)
|
||||
print_path (const char *mypath)
|
||||
{
|
||||
if (mypath == NULL)
|
||||
printf ("\n");
|
||||
|
@ -829,7 +828,7 @@ print_path (const char *mypath)
|
|||
|
||||
|
||||
void
|
||||
set_all_thresholds (struct parameter_list *path)
|
||||
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);
|
||||
|
@ -893,7 +892,7 @@ INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greate
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
@ -931,7 +930,7 @@ print_help (void)
|
|||
printf (" %s\n", "-e, --errors-only");
|
||||
printf (" %s\n", _("Display only devices/mountpoints with errors"));
|
||||
printf (" %s\n", "-g, --group=NAME");
|
||||
printf (" %s\n", _("Group pathes. Thresholds apply to (free-)space of all partitions together"));
|
||||
printf (" %s\n", _("Group paths. Thresholds apply to (free-)space of all partitions together"));
|
||||
printf (" %s\n", "-k, --kilobytes");
|
||||
printf (" %s\n", _("Same as '--units kB'"));
|
||||
printf (" %s\n", "-l, --local");
|
||||
|
@ -944,7 +943,7 @@ print_help (void)
|
|||
printf (" %s\n", "-m, --megabytes");
|
||||
printf (" %s\n", _("Same as '--units MB'"));
|
||||
printf (" %s\n", "-A, --all");
|
||||
printf (" %s\n", _("Explicitly select all pathes. This is equivalent to -R '.*'"));
|
||||
printf (" %s\n", _("Explicitly select all paths. This is equivalent to -R '.*'"));
|
||||
printf (" %s\n", "-R, --eregi-path=PATH, --eregi-partition=PARTITION");
|
||||
printf (" %s\n", _("Case insensitive regular expression for path/partition (may be repeated)"));
|
||||
printf (" %s\n", "-r, --ereg-path=PATH, --ereg-partition=PARTITION");
|
||||
|
@ -994,10 +993,10 @@ void
|
|||
stat_path (struct parameter_list *p)
|
||||
{
|
||||
/* Stat entry to check that dir exists and is accessible */
|
||||
if (verbose > 3)
|
||||
if (verbose >= 3)
|
||||
printf("calling stat on %s\n", p->name);
|
||||
if (stat (p->name, &stat_buf[0])) {
|
||||
if (verbose > 3)
|
||||
if (verbose >= 3)
|
||||
printf("stat failed on %s\n", p->name);
|
||||
printf("DISK %s - ", _("CRITICAL"));
|
||||
die (STATE_CRITICAL, _("%s %s: %s\n"), p->name, _("is not accessible"), strerror(errno));
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* License: GPL
|
||||
* 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
|
||||
|
@ -28,12 +26,10 @@
|
|||
* 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_dns.c 1992 2008-05-13 09:14:45Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_dns";
|
||||
const char *revision = "$Revision: 1992 $";
|
||||
const char *copyright = "2000-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -123,7 +119,7 @@ main (int argc, char **argv)
|
|||
|
||||
/* scan stdout */
|
||||
for(i = 0; i < chld_out.lines; i++) {
|
||||
if (addresses == NULL)
|
||||
if (addresses == NULL)
|
||||
addresses = malloc(sizeof(*addresses)*10);
|
||||
else if (!(n_addresses % 10))
|
||||
addresses = realloc(addresses,sizeof(*addresses) * (n_addresses + 10));
|
||||
|
@ -255,7 +251,7 @@ main (int argc, char **argv)
|
|||
printf (_("DNS CRITICAL - %s\n"),
|
||||
!strcmp (msg, "") ? _(" Probably a non-existent host/domain") : msg);
|
||||
else
|
||||
printf (_("DNS UNKNOW - %s\n"),
|
||||
printf (_("DNS UNKNOWN - %s\n"),
|
||||
!strcmp (msg, "") ? _(" Probably a non-existent host/domain") : msg);
|
||||
|
||||
return result;
|
||||
|
@ -289,7 +285,7 @@ error_scan (char *input_buffer)
|
|||
strstr (input_buffer, ": REFUSED")))
|
||||
die (STATE_CRITICAL, _("Connection to DNS %s was refused\n"), dns_server);
|
||||
|
||||
/* Query refused (usually by an ACL in the namserver) */
|
||||
/* Query refused (usually by an ACL in the namserver) */
|
||||
else if (strstr (input_buffer, "Query refused"))
|
||||
die (STATE_CRITICAL, _("Query was refused by DNS server at %s\n"), dns_server);
|
||||
|
||||
|
@ -340,8 +336,8 @@ process_arguments (int argc, char **argv)
|
|||
{"reverse-server", required_argument, 0, 'r'},
|
||||
{"expected-address", required_argument, 0, 'a'},
|
||||
{"expect-authority", no_argument, 0, 'A'},
|
||||
{"warning", no_argument, 0, 'w'},
|
||||
{"critical", no_argument, 0, 'c'},
|
||||
{"warning", required_argument, 0, 'w'},
|
||||
{"critical", required_argument, 0, 'c'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
@ -363,7 +359,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'v': /* version */
|
||||
verbose = TRUE;
|
||||
|
@ -446,7 +442,7 @@ validate_arguments ()
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* License: GPL
|
||||
* 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
|
||||
|
@ -27,12 +25,10 @@
|
|||
* 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_dummy.c 1984 2008-04-27 14:35:26Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_dummy";
|
||||
const char *revision = "$Revision: 1984 $";
|
||||
const char *copyright = "1999-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -55,7 +51,7 @@ main (int argc, char **argv)
|
|||
if (argc < 2)
|
||||
usage4 (_("Could not parse arguments"));
|
||||
else if (strcmp (argv[1], "-V") == 0 || strcmp (argv[1], "--version") == 0) {
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
}
|
||||
else if (strcmp (argv[1], "-h") == 0 || strcmp (argv[1], "--help") == 0) {
|
||||
|
@ -87,7 +83,7 @@ main (int argc, char **argv)
|
|||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
if (argc >= 3)
|
||||
if (argc >= 3)
|
||||
printf (": %s", argv[2]);
|
||||
|
||||
printf("\n");
|
||||
|
@ -100,7 +96,7 @@ main (int argc, char **argv)
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* 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_disk plugin
|
||||
|
@ -28,12 +26,10 @@
|
|||
* 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_fping.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_fping";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -58,6 +54,8 @@ void print_usage (void);
|
|||
char *server_name = NULL;
|
||||
int packet_size = PACKET_SIZE;
|
||||
int packet_count = PACKET_COUNT;
|
||||
int target_timeout = 0;
|
||||
int packet_interval = 0;
|
||||
int verbose = FALSE;
|
||||
int cpl;
|
||||
int wpl;
|
||||
|
@ -77,6 +75,7 @@ main (int argc, char **argv)
|
|||
char *server = NULL;
|
||||
char *command_line = NULL;
|
||||
char *input_buffer = NULL;
|
||||
char *option_string = "";
|
||||
input_buffer = malloc (MAX_INPUT_BUFFER);
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
|
@ -92,8 +91,13 @@ main (int argc, char **argv)
|
|||
server = strscpy (server, server_name);
|
||||
|
||||
/* compose the command */
|
||||
asprintf (&command_line, "%s -b %d -c %d %s", PATH_TO_FPING,
|
||||
packet_size, packet_count, server);
|
||||
if (target_timeout)
|
||||
asprintf(&option_string, "%s-t %d ", option_string, target_timeout);
|
||||
if (packet_interval)
|
||||
asprintf(&option_string, "%s-p %d ", option_string, packet_interval);
|
||||
|
||||
asprintf (&command_line, "%s %s-b %d -c %d %s", PATH_TO_FPING,
|
||||
option_string, packet_size, packet_count, server);
|
||||
|
||||
if (verbose)
|
||||
printf ("%s\n", command_line);
|
||||
|
@ -232,6 +236,8 @@ process_arguments (int argc, char **argv)
|
|||
{"warning", required_argument, 0, 'w'},
|
||||
{"bytes", required_argument, 0, 'b'},
|
||||
{"number", required_argument, 0, 'n'},
|
||||
{"target-timeout", required_argument, 0, 'T'},
|
||||
{"interval", required_argument, 0, 'i'},
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
|
@ -252,7 +258,7 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "+hVvH:c:w:b:n:", longopts, &option);
|
||||
c = getopt_long (argc, argv, "+hVvH:c:w:b:n:T:i:", longopts, &option);
|
||||
|
||||
if (c == -1 || c == EOF || c == 1)
|
||||
break;
|
||||
|
@ -264,7 +270,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'v': /* verbose mode */
|
||||
verbose = TRUE;
|
||||
|
@ -313,6 +319,18 @@ process_arguments (int argc, char **argv)
|
|||
else
|
||||
usage (_("Packet count must be a positive integer"));
|
||||
break;
|
||||
case 'T': /* timeout in msec */
|
||||
if (is_intpos (optarg))
|
||||
target_timeout = atoi (optarg);
|
||||
else
|
||||
usage (_("Target timeout must be a positive integer"));
|
||||
break;
|
||||
case 'i': /* interval in msec */
|
||||
if (is_intpos (optarg))
|
||||
packet_interval = atoi (optarg);
|
||||
else
|
||||
usage (_("Interval must be a positive integer"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -368,7 +386,7 @@ void
|
|||
print_help (void)
|
||||
{
|
||||
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Didi Rieder <adrieder@sbox.tu-graz.ac.at>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
@ -391,9 +409,13 @@ print_help (void)
|
|||
printf (" %s\n", "-c, --critical=THRESHOLD");
|
||||
printf (" %s\n", _("critical threshold pair"));
|
||||
printf (" %s\n", "-b, --bytes=INTEGER");
|
||||
printf (" %s\n", _("size of ICMP packet (default: %d)"),PACKET_SIZE);
|
||||
printf (" %s (default: %d)\n", _("size of ICMP packet"),PACKET_SIZE);
|
||||
printf (" %s\n", "-n, --number=INTEGER");
|
||||
printf (" %s\n", _("number of ICMP packets to send (default: %d)"),PACKET_COUNT);
|
||||
printf (" %s (default: %d)\n", _("number of ICMP packets to send"),PACKET_COUNT);
|
||||
printf (" %s\n", "-T, --target-timeout=INTEGER");
|
||||
printf (" %s (default: fping's default for -t)\n", _("Target timeout (ms)"),PACKET_COUNT);
|
||||
printf (" %s\n", "-i, --interval=INTEGER");
|
||||
printf (" %s (default: fping's default for -p)\n", _("Interval (ms) between sending packets"),PACKET_COUNT);
|
||||
printf (_(UT_VERBOSE));
|
||||
printf ("\n");
|
||||
printf (" %s\n", _("THRESHOLD is <rta>,<pl>%% where <rta> is the round trip average travel time (ms)"));
|
||||
|
@ -414,5 +436,5 @@ void
|
|||
print_usage (void)
|
||||
{
|
||||
printf (_("Usage:"));
|
||||
printf (" %s <host_address> -w limit -c limit [-b size] [-n number]\n", progname);
|
||||
printf (" %s <host_address> -w limit -c limit [-b size] [-n number] [-T number] [-i number]\n", progname);
|
||||
}
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* License: GPL
|
||||
* 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
|
||||
|
@ -28,12 +26,10 @@
|
|||
* 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_game.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_game";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "2002-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -105,7 +101,7 @@ main (int argc, char **argv)
|
|||
/* was thinking about running qstat without any options, capturing the
|
||||
-default line, parsing it & making an array of all know server types
|
||||
but thought this would be too much hassle considering this is a tool
|
||||
for intelligent sysadmins (ha). Could put a static array of known
|
||||
for intelligent sysadmins (ha). Could put a static array of known
|
||||
server types in a header file but then we'd be limiting ourselves
|
||||
|
||||
In the end, I figured I'd simply let an error occur & then trap it
|
||||
|
@ -139,10 +135,10 @@ main (int argc, char **argv)
|
|||
result = STATE_CRITICAL;
|
||||
}
|
||||
else {
|
||||
printf ("OK: %s/%s %s (%s), Ping: %s ms|%s %s\n",
|
||||
printf ("OK: %s/%s %s (%s), Ping: %s ms|%s %s\n",
|
||||
ret[qstat_game_players],
|
||||
ret[qstat_game_players_max],
|
||||
ret[qstat_game_field],
|
||||
ret[qstat_game_field],
|
||||
ret[qstat_map_field],
|
||||
ret[qstat_ping_field],
|
||||
perfdata ("players", atol(ret[qstat_game_players]), "",
|
||||
|
@ -202,7 +198,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'v': /* version */
|
||||
verbose = TRUE;
|
||||
|
@ -293,7 +289,7 @@ validate_arguments (void)
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Ian Cass, Knowledge Matters Limited\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
@ -345,7 +341,7 @@ print_usage (void)
|
|||
* Test Cases:
|
||||
*
|
||||
* ./check_game --players 7 -p 8 --map 5 qs 67.20.190.61 26000
|
||||
*
|
||||
*
|
||||
* qstat -raw , -qs 67.20.190.61
|
||||
* ==> QS,67.20.190.61,Nightmare.fintek.ca,67.20.190.61:26000,3,e2m1,6,0,83,0
|
||||
*
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* 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_hpjd plugin
|
||||
|
@ -28,12 +26,10 @@
|
|||
* 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_hpjd.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_hpjd";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -123,7 +119,7 @@ main (int argc, char **argv)
|
|||
HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY);
|
||||
|
||||
/* get the command to run */
|
||||
sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET, community,
|
||||
sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET, community,
|
||||
address, query_string);
|
||||
|
||||
/* run the command */
|
||||
|
@ -198,7 +194,7 @@ main (int argc, char **argv)
|
|||
strcpy (display_message, temp_buffer + 1);
|
||||
break;
|
||||
default: /* fold multiline message */
|
||||
strncat (display_message, input_buffer,
|
||||
strncat (display_message, input_buffer,
|
||||
sizeof (display_message) - strlen (display_message) - 1);
|
||||
}
|
||||
|
||||
|
@ -218,7 +214,7 @@ main (int argc, char **argv)
|
|||
sprintf (errmsg, "%s", input_buffer );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* close stderr */
|
||||
(void) fclose (child_stderr);
|
||||
|
||||
|
@ -232,7 +228,7 @@ main (int argc, char **argv)
|
|||
/* might not be the problem, but most likely is. */
|
||||
result = STATE_UNKNOWN ;
|
||||
asprintf (&errmsg, "%s : Timeout from host %s\n", errmsg, address );
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* if we had no read errors, check the printer status results... */
|
||||
|
@ -326,7 +322,7 @@ process_arguments (int argc, char **argv)
|
|||
if (argc < 2)
|
||||
return ERROR;
|
||||
|
||||
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "+hVH:C:", longopts, &option);
|
||||
|
||||
|
@ -346,7 +342,7 @@ process_arguments (int argc, char **argv)
|
|||
community = strscpy (community, optarg);
|
||||
break;
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
|
@ -365,7 +361,7 @@ process_arguments (int argc, char **argv)
|
|||
usage2 (_("Invalid hostname/address"), argv[c]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (community == NULL) {
|
||||
if (argv[c] != NULL )
|
||||
community = argv[c];
|
||||
|
@ -387,7 +383,7 @@ validate_arguments (void)
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* License: GPL
|
||||
* 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
|
||||
|
@ -30,14 +28,12 @@
|
|||
* 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_http.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/* splint -I. -I../../plugins -I../../lib/ -I/usr/kerberos/include/ ../../plugins/check_http.c */
|
||||
|
||||
const char *progname = "check_http";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "1999-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -48,6 +44,9 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
|||
#include <ctype.h>
|
||||
|
||||
#define INPUT_DELIMITER ";"
|
||||
#define STICKY_NONE 0
|
||||
#define STICKY_HOST 1
|
||||
#define STICKY_PORT 2
|
||||
|
||||
#define HTTP_EXPECT "HTTP/1."
|
||||
enum {
|
||||
|
@ -110,6 +109,7 @@ int display_html = FALSE;
|
|||
char **http_opt_headers;
|
||||
int http_opt_headers_count = 0;
|
||||
int onredirect = STATE_OK;
|
||||
int followsticky = STICKY_NONE;
|
||||
int use_ssl = FALSE;
|
||||
int verbose = FALSE;
|
||||
int sd;
|
||||
|
@ -137,24 +137,24 @@ main (int argc, char **argv)
|
|||
{
|
||||
int result = STATE_UNKNOWN;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
/* Set default URL. Must be malloced for subsequent realloc if --onredirect=follow */
|
||||
server_url = strdup(HTTP_URL);
|
||||
server_url_length = strlen(server_url);
|
||||
asprintf (&user_agent, "User-Agent: check_http/%s (nagios-plugins %s)",
|
||||
clean_revstring (revision), VERSION);
|
||||
asprintf (&user_agent, "User-Agent: check_http/v%s (nagios-plugins %s)",
|
||||
NP_VERSION, VERSION);
|
||||
|
||||
/* Parse extra opts if any */
|
||||
argv=np_extra_opts (&argc, argv, progname);
|
||||
/* Parse extra opts if any */
|
||||
argv=np_extra_opts (&argc, argv, progname);
|
||||
|
||||
if (process_arguments (argc, argv) == ERROR)
|
||||
usage4 (_("Could not parse arguments"));
|
||||
|
||||
if (display_html == TRUE)
|
||||
printf ("<A HREF=\"%s://%s:%d%s\" target=\"_blank\">",
|
||||
printf ("<A HREF=\"%s://%s:%d%s\" target=\"_blank\">",
|
||||
use_ssl ? "https" : "http", host_name ? host_name : server_address,
|
||||
server_port, server_url);
|
||||
|
||||
|
@ -187,6 +187,7 @@ process_arguments (int argc, char **argv)
|
|||
{"nohtml", no_argument, 0, 'n'},
|
||||
{"ssl", no_argument, 0, 'S'},
|
||||
{"post", required_argument, 0, 'P'},
|
||||
{"method", required_argument, 0, 'j'},
|
||||
{"IP-address", required_argument, 0, 'I'},
|
||||
{"url", required_argument, 0, 'u'},
|
||||
{"port", required_argument, 0, 'p'},
|
||||
|
@ -228,7 +229,7 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:T:I:a:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option);
|
||||
c = getopt_long (argc, argv, "Vvh46t:c:w:A:k:H:P:j:T:I:a:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, &option);
|
||||
if (c == -1 || c == EOF)
|
||||
break;
|
||||
|
||||
|
@ -241,7 +242,7 @@ process_arguments (int argc, char **argv)
|
|||
exit (STATE_OK);
|
||||
break;
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
break;
|
||||
case 't': /* timeout period */
|
||||
|
@ -302,18 +303,23 @@ process_arguments (int argc, char **argv)
|
|||
server_port = HTTPS_PORT;
|
||||
break;
|
||||
case 'f': /* onredirect */
|
||||
if (!strcmp (optarg, "follow"))
|
||||
onredirect = STATE_DEPENDENT;
|
||||
if (!strcmp (optarg, "unknown"))
|
||||
if (!strcmp (optarg, "stickyport"))
|
||||
onredirect = STATE_DEPENDENT, followsticky = STICKY_HOST|STICKY_PORT;
|
||||
else if (!strcmp (optarg, "sticky"))
|
||||
onredirect = STATE_DEPENDENT, followsticky = STICKY_HOST;
|
||||
else if (!strcmp (optarg, "follow"))
|
||||
onredirect = STATE_DEPENDENT, followsticky = STICKY_NONE;
|
||||
else if (!strcmp (optarg, "unknown"))
|
||||
onredirect = STATE_UNKNOWN;
|
||||
if (!strcmp (optarg, "ok"))
|
||||
else if (!strcmp (optarg, "ok"))
|
||||
onredirect = STATE_OK;
|
||||
if (!strcmp (optarg, "warning"))
|
||||
else if (!strcmp (optarg, "warning"))
|
||||
onredirect = STATE_WARNING;
|
||||
if (!strcmp (optarg, "critical"))
|
||||
else if (!strcmp (optarg, "critical"))
|
||||
onredirect = STATE_CRITICAL;
|
||||
else usage2 (_("Invalid onredirect option"), optarg);
|
||||
if (verbose)
|
||||
printf(_("option f:%d \n"), onredirect);
|
||||
printf(_("option f:%d \n"), onredirect);
|
||||
break;
|
||||
/* Note: H, I, and u must be malloc'd or will fail on redirects */
|
||||
case 'H': /* Host Name (virtual host) */
|
||||
|
@ -344,10 +350,16 @@ process_arguments (int argc, char **argv)
|
|||
strncpy (user_auth, optarg, MAX_INPUT_BUFFER - 1);
|
||||
user_auth[MAX_INPUT_BUFFER - 1] = 0;
|
||||
break;
|
||||
case 'P': /* HTTP POST data in URL encoded format */
|
||||
if (http_method || http_post_data) break;
|
||||
http_method = strdup("POST");
|
||||
http_post_data = strdup (optarg);
|
||||
case 'P': /* HTTP POST data in URL encoded format; ignored if settings already */
|
||||
if (! http_post_data)
|
||||
http_post_data = strdup (optarg);
|
||||
if (! http_method)
|
||||
http_method = strdup("POST");
|
||||
break;
|
||||
case 'j': /* Set HTTP method */
|
||||
if (http_method)
|
||||
free(http_method);
|
||||
http_method = strdup (optarg);
|
||||
break;
|
||||
case 's': /* string or substring */
|
||||
strncpy (string_expect, optarg, MAX_INPUT_BUFFER - 1);
|
||||
|
@ -410,7 +422,7 @@ process_arguments (int argc, char **argv)
|
|||
exit (STATE_WARNING);
|
||||
} else
|
||||
max_page_len = atoi(tmp);
|
||||
} else
|
||||
} else
|
||||
min_page_len = atoi (optarg);
|
||||
break;
|
||||
}
|
||||
|
@ -549,7 +561,7 @@ parse_time_string (const char *string)
|
|||
if (tm.tm_mon < 0 || tm.tm_mday < 1 || tm.tm_mday > 31)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
/*
|
||||
This is actually wrong: we need to subtract the local timezone
|
||||
offset from GMT from this value. But, that's ok in this usage,
|
||||
because we only comparing these two GMT dates against each other,
|
||||
|
@ -573,14 +585,33 @@ parse_time_string (const char *string)
|
|||
}
|
||||
}
|
||||
|
||||
/* Checks if the server 'reply' is one of the expected 'statuscodes' */
|
||||
static int
|
||||
expected_statuscode (const char *reply, const char *statuscodes)
|
||||
{
|
||||
char *expected, *code;
|
||||
int result = 0;
|
||||
|
||||
if ((expected = strdup (statuscodes)) == NULL)
|
||||
die (STATE_UNKNOWN, _("HTTP UNKNOWN - Memory allocation error\n"));
|
||||
|
||||
static void
|
||||
check_document_dates (const char *headers)
|
||||
for (code = strtok (expected, ","); code != NULL; code = strtok (NULL, ","))
|
||||
if (strstr (reply, code) != NULL) {
|
||||
result = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
free (expected);
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
check_document_dates (const char *headers, char **msg)
|
||||
{
|
||||
const char *s;
|
||||
char *server_date = 0;
|
||||
char *document_date = 0;
|
||||
int date_result = STATE_OK;
|
||||
|
||||
s = headers;
|
||||
while (*s) {
|
||||
|
@ -598,7 +629,10 @@ check_document_dates (const char *headers)
|
|||
/* Skip to the end of the header, including continuation lines. */
|
||||
while (*s && !(*s == '\n' && (s[1] != ' ' && s[1] != '\t')))
|
||||
s++;
|
||||
s++;
|
||||
|
||||
/* Avoid stepping over end-of-string marker */
|
||||
if (*s)
|
||||
s++;
|
||||
|
||||
/* Process this header. */
|
||||
if (value && value > field+2) {
|
||||
|
@ -631,34 +665,38 @@ check_document_dates (const char *headers)
|
|||
|
||||
/* Done parsing the body. Now check the dates we (hopefully) parsed. */
|
||||
if (!server_date || !*server_date) {
|
||||
die (STATE_UNKNOWN, _("HTTP UNKNOWN - Server date unknown\n"));
|
||||
asprintf (msg, _("%sServer date unknown, "), *msg);
|
||||
date_result = max_state_alt(STATE_UNKNOWN, date_result);
|
||||
} else if (!document_date || !*document_date) {
|
||||
die (STATE_CRITICAL, _("HTTP CRITICAL - Document modification date unknown\n"));
|
||||
asprintf (msg, _("%sDocument modification date unknown, "), *msg);
|
||||
date_result = max_state_alt(STATE_CRITICAL, date_result);
|
||||
} else {
|
||||
time_t srv_data = parse_time_string (server_date);
|
||||
time_t doc_data = parse_time_string (document_date);
|
||||
|
||||
if (srv_data <= 0) {
|
||||
die (STATE_CRITICAL, _("HTTP CRITICAL - Server date \"%100s\" unparsable"), server_date);
|
||||
asprintf (msg, _("%sServer date \"%100s\" unparsable, "), *msg, server_date);
|
||||
date_result = max_state_alt(STATE_CRITICAL, date_result);
|
||||
} else if (doc_data <= 0) {
|
||||
die (STATE_CRITICAL, _("HTTP CRITICAL - Document date \"%100s\" unparsable"), document_date);
|
||||
asprintf (msg, _("%sDocument date \"%100s\" unparsable, "), *msg, document_date);
|
||||
date_result = max_state_alt(STATE_CRITICAL, date_result);
|
||||
} else if (doc_data > srv_data + 30) {
|
||||
die (STATE_CRITICAL, _("HTTP CRITICAL - Document is %d seconds in the future\n"), (int)doc_data - (int)srv_data);
|
||||
asprintf (msg, _("%sDocument is %d seconds in the future, "), *msg, (int)doc_data - (int)srv_data);
|
||||
date_result = max_state_alt(STATE_CRITICAL, date_result);
|
||||
} else if (doc_data < srv_data - maximum_age) {
|
||||
int n = (srv_data - doc_data);
|
||||
if (n > (60 * 60 * 24 * 2))
|
||||
die (STATE_CRITICAL,
|
||||
_("HTTP CRITICAL - Last modified %.1f days ago\n"),
|
||||
((float) n) / (60 * 60 * 24));
|
||||
else
|
||||
die (STATE_CRITICAL,
|
||||
_("HTTP CRITICAL - Last modified %d:%02d:%02d ago\n"),
|
||||
n / (60 * 60), (n / 60) % 60, n % 60);
|
||||
int n = (srv_data - doc_data);
|
||||
if (n > (60 * 60 * 24 * 2)) {
|
||||
asprintf (msg, _("%sLast modified %.1f days ago, "), *msg, ((float) n) / (60 * 60 * 24));
|
||||
date_result = max_state_alt(STATE_CRITICAL, date_result);
|
||||
} else {
|
||||
asprintf (msg, _("%sLast modified %d:%02d:%02d ago, "), *msg, n / (60 * 60), (n / 60) % 60, n % 60);
|
||||
date_result = max_state_alt(STATE_CRITICAL, date_result);
|
||||
}
|
||||
}
|
||||
|
||||
free (server_date);
|
||||
free (document_date);
|
||||
}
|
||||
return date_result;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -711,6 +749,22 @@ get_content_length (const char *headers)
|
|||
return (content_length);
|
||||
}
|
||||
|
||||
char *
|
||||
prepend_slash (char *path)
|
||||
{
|
||||
char *newpath;
|
||||
|
||||
if (path[0] == '/')
|
||||
return path;
|
||||
|
||||
if ((newpath = malloc (strlen(path) + 2)) == NULL)
|
||||
die (STATE_UNKNOWN, _("HTTP UNKNOWN - Memory allocation error\n"));
|
||||
newpath[0] = '/';
|
||||
strcpy (newpath + 1, path);
|
||||
free (path);
|
||||
return newpath;
|
||||
}
|
||||
|
||||
int
|
||||
check_http (void)
|
||||
{
|
||||
|
@ -729,31 +783,41 @@ check_http (void)
|
|||
long microsec;
|
||||
double elapsed_time;
|
||||
int page_len = 0;
|
||||
int result = STATE_UNKNOWN;
|
||||
int result = STATE_OK;
|
||||
|
||||
/* try to connect to the host at the given port number */
|
||||
if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK)
|
||||
die (STATE_CRITICAL, _("HTTP CRITICAL - Unable to open TCP socket\n"));
|
||||
#ifdef HAVE_SSL
|
||||
if (use_ssl == TRUE) {
|
||||
np_net_ssl_init(sd);
|
||||
np_net_ssl_init_with_hostname(sd, host_name);
|
||||
if (check_cert == TRUE) {
|
||||
result = np_net_ssl_check_cert(days_till_exp);
|
||||
np_net_ssl_cleanup();
|
||||
if(sd) close(sd);
|
||||
if (sd) close(sd);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_SSL */
|
||||
|
||||
asprintf (&buf, "%s %s HTTP/1.0\r\n%s\r\n", http_method, server_url, user_agent);
|
||||
asprintf (&buf, "%s %s %s\r\n%s\r\n", http_method, server_url, host_name ? "HTTP/1.1" : "HTTP/1.0", user_agent);
|
||||
|
||||
/* tell HTTP/1.1 servers not to keep the connection alive */
|
||||
asprintf (&buf, "%sConnection: close\r\n", buf);
|
||||
|
||||
/* optionally send the host header info */
|
||||
if (host_name)
|
||||
asprintf (&buf, "%sHost: %s:%d\r\n", buf, host_name, server_port);
|
||||
if (host_name) {
|
||||
/*
|
||||
* Specify the port only if we're using a non-default port (see RFC 2616,
|
||||
* 14.23). Some server applications/configurations cause trouble if the
|
||||
* (default) port is explicitly specified in the "Host:" header line.
|
||||
*/
|
||||
if ((use_ssl == FALSE && server_port == HTTP_PORT) ||
|
||||
(use_ssl == TRUE && server_port == HTTPS_PORT))
|
||||
asprintf (&buf, "%sHost: %s\r\n", buf, host_name);
|
||||
else
|
||||
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 +825,9 @@ check_http (void)
|
|||
for ((pos = strtok(http_opt_headers[i], INPUT_DELIMITER)); pos; (pos = strtok(NULL, INPUT_DELIMITER)))
|
||||
asprintf (&buf, "%s%s\r\n", buf, pos);
|
||||
}
|
||||
free(http_opt_headers);
|
||||
/* This cannot be free'd here because a redirection will then try to access this and segfault */
|
||||
/* Covered in a testcase in tests/check_http.t */
|
||||
/* free(http_opt_headers); */
|
||||
}
|
||||
|
||||
/* optionally send the authentication info */
|
||||
|
@ -770,7 +836,7 @@ check_http (void)
|
|||
asprintf (&buf, "%sAuthorization: Basic %s\r\n", buf, auth);
|
||||
}
|
||||
|
||||
/* either send http POST data */
|
||||
/* either send http POST data (any data, not only POST)*/
|
||||
if (http_post_data) {
|
||||
if (http_content_type) {
|
||||
asprintf (&buf, "%sContent-Type: %s\r\n", buf, http_content_type);
|
||||
|
@ -832,10 +898,11 @@ check_http (void)
|
|||
#ifdef HAVE_SSL
|
||||
np_net_ssl_cleanup();
|
||||
#endif
|
||||
if(sd) close(sd);
|
||||
if (sd) close(sd);
|
||||
|
||||
/* reset the alarm */
|
||||
alarm (0);
|
||||
/* Save check time */
|
||||
microsec = deltime (tv);
|
||||
elapsed_time = (double)microsec / 1.0e6;
|
||||
|
||||
/* leave full_page untouched so we can free it later */
|
||||
page = full_page;
|
||||
|
@ -873,22 +940,23 @@ check_http (void)
|
|||
(no_body ? " [[ skipped ]]" : page));
|
||||
|
||||
/* make sure the status line matches the response we are looking for */
|
||||
if (!strstr (status_line, server_expect)) {
|
||||
if (!expected_statuscode (status_line, server_expect)) {
|
||||
if (server_port == HTTP_PORT)
|
||||
asprintf (&msg,
|
||||
_("Invalid HTTP response received from host\n"));
|
||||
_("Invalid HTTP response received from host: %s\n"),
|
||||
status_line);
|
||||
else
|
||||
asprintf (&msg,
|
||||
_("Invalid HTTP response received from host on port %d\n"),
|
||||
server_port);
|
||||
_("Invalid HTTP response received from host on port %d: %s\n"),
|
||||
server_port, status_line);
|
||||
die (STATE_CRITICAL, "HTTP CRITICAL - %s", msg);
|
||||
}
|
||||
|
||||
/* Exit here if server_expect was set by user and not default */
|
||||
/* Bypass normal status line check if server_expect was set by user and not default */
|
||||
/* NOTE: After this if/else block msg *MUST* be an asprintf-allocated string */
|
||||
if ( server_expect_yn ) {
|
||||
asprintf (&msg,
|
||||
_("HTTP OK: Status line output matched \"%s\"\n"),
|
||||
server_expect);
|
||||
_("Status line output matched \"%s\" - "), server_expect);
|
||||
if (verbose)
|
||||
printf ("%s\n",msg);
|
||||
}
|
||||
|
@ -905,123 +973,110 @@ check_http (void)
|
|||
|
||||
/* check the return code */
|
||||
|
||||
if (http_status >= 600 || http_status < 100)
|
||||
if (http_status >= 600 || http_status < 100) {
|
||||
die (STATE_CRITICAL, _("HTTP CRITICAL: Invalid Status (%s)\n"), status_line);
|
||||
|
||||
}
|
||||
/* server errors result in a critical state */
|
||||
else if (http_status >= 500)
|
||||
die (STATE_CRITICAL, _("HTTP CRITICAL: %s\n"), status_line);
|
||||
|
||||
else if (http_status >= 500) {
|
||||
asprintf (&msg, _("%s - "), status_line);
|
||||
result = STATE_CRITICAL;
|
||||
}
|
||||
/* client errors result in a warning state */
|
||||
else if (http_status >= 400)
|
||||
die (STATE_WARNING, _("HTTP WARNING: %s\n"), status_line);
|
||||
|
||||
else if (http_status >= 400) {
|
||||
asprintf (&msg, _("%s - "), status_line);
|
||||
result = max_state_alt(STATE_WARNING, result);
|
||||
}
|
||||
/* check redirected page if specified */
|
||||
else if (http_status >= 300) {
|
||||
|
||||
if (onredirect == STATE_DEPENDENT)
|
||||
redir (header, status_line);
|
||||
else if (onredirect == STATE_UNKNOWN)
|
||||
printf (_("HTTP UNKNOWN"));
|
||||
else if (onredirect == STATE_OK)
|
||||
printf (_("HTTP OK"));
|
||||
else if (onredirect == STATE_WARNING)
|
||||
printf (_("HTTP WARNING"));
|
||||
else if (onredirect == STATE_CRITICAL)
|
||||
printf (_("HTTP CRITICAL"));
|
||||
microsec = deltime (tv);
|
||||
elapsed_time = (double)microsec / 1.0e6;
|
||||
die (onredirect,
|
||||
_(" - %s - %.3f second response time %s|%s %s\n"),
|
||||
status_line, elapsed_time,
|
||||
(display_html ? "</A>" : ""),
|
||||
perfd_time (elapsed_time), perfd_size (pagesize));
|
||||
else
|
||||
result = max_state_alt(onredirect, result);
|
||||
asprintf (&msg, _("%s - "), status_line);
|
||||
} /* end if (http_status >= 300) */
|
||||
else {
|
||||
/* Print OK status anyway */
|
||||
asprintf (&msg, _("%s - "), status_line);
|
||||
}
|
||||
|
||||
} /* end else (server_expect_yn) */
|
||||
|
||||
if (maximum_age >= 0) {
|
||||
check_document_dates (header);
|
||||
}
|
||||
/* reset the alarm - must be called *after* redir or we'll never die on redirects! */
|
||||
alarm (0);
|
||||
|
||||
/* check elapsed time */
|
||||
microsec = deltime (tv);
|
||||
elapsed_time = (double)microsec / 1.0e6;
|
||||
asprintf (&msg,
|
||||
_(" - %s - %.3f second response time %s|%s %s\n"),
|
||||
status_line, elapsed_time,
|
||||
(display_html ? "</A>" : ""),
|
||||
perfd_time (elapsed_time), perfd_size (pagesize));
|
||||
if (check_critical_time == TRUE && elapsed_time > critical_time)
|
||||
die (STATE_CRITICAL, "HTTP %s: %s", _("CRITICAL"), msg);
|
||||
if (check_warning_time == TRUE && elapsed_time > warning_time)
|
||||
die (STATE_WARNING, "HTTP %s: %s", _("WARNING"), msg);
|
||||
if (maximum_age >= 0) {
|
||||
result = max_state_alt(check_document_dates(header, &msg), result);
|
||||
}
|
||||
|
||||
/* Page and Header content checks go here */
|
||||
/* these checks should be last */
|
||||
|
||||
if (strlen (string_expect)) {
|
||||
if (strstr (page, string_expect)) {
|
||||
printf (_("HTTP OK %s - %.3f second response time %s|%s %s\n"),
|
||||
status_line, elapsed_time,
|
||||
(display_html ? "</A>" : ""),
|
||||
perfd_time (elapsed_time), perfd_size (pagesize));
|
||||
exit (STATE_OK);
|
||||
}
|
||||
else {
|
||||
printf (_("HTTP CRITICAL - string not found%s|%s %s\n"),
|
||||
(display_html ? "</A>" : ""),
|
||||
perfd_time (elapsed_time), perfd_size (pagesize));
|
||||
exit (STATE_CRITICAL);
|
||||
if (!strstr (page, string_expect)) {
|
||||
asprintf (&msg, _("%sstring not found, "), msg);
|
||||
result = STATE_CRITICAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen (regexp)) {
|
||||
errcode = regexec (&preg, page, REGS, pmatch, 0);
|
||||
if ((errcode == 0 && invert_regex == 0) || (errcode == REG_NOMATCH && invert_regex == 1)) {
|
||||
printf (_("HTTP OK %s - %.3f second response time %s|%s %s\n"),
|
||||
status_line, elapsed_time,
|
||||
(display_html ? "</A>" : ""),
|
||||
perfd_time (elapsed_time), perfd_size (pagesize));
|
||||
exit (STATE_OK);
|
||||
/* OK - No-op to avoid changing the logic around it */
|
||||
result = max_state_alt(STATE_OK, result);
|
||||
}
|
||||
else if ((errcode == REG_NOMATCH && invert_regex == 0) || (errcode == 0 && invert_regex == 1)) {
|
||||
if (invert_regex == 0)
|
||||
msg = strdup(_("pattern not found"));
|
||||
else
|
||||
msg = strdup(_("pattern found"));
|
||||
printf (("%s - %s%s|%s %s\n"),
|
||||
_("HTTP CRITICAL"),
|
||||
msg,
|
||||
(display_html ? "</A>" : ""),
|
||||
perfd_time (elapsed_time), perfd_size (pagesize));
|
||||
exit (STATE_CRITICAL);
|
||||
if (invert_regex == 0)
|
||||
asprintf (&msg, _("%spattern not found, "), msg);
|
||||
else
|
||||
asprintf (&msg, _("%spattern found, "), msg);
|
||||
result = STATE_CRITICAL;
|
||||
}
|
||||
else {
|
||||
/* FIXME: Shouldn't that be UNKNOWN? */
|
||||
regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER);
|
||||
printf (_("HTTP CRITICAL - Execute Error: %s\n"), errbuf);
|
||||
exit (STATE_CRITICAL);
|
||||
asprintf (&msg, _("%sExecute Error: %s, "), msg, errbuf);
|
||||
result = STATE_CRITICAL;
|
||||
}
|
||||
}
|
||||
|
||||
/* make sure the page is of an appropriate size */
|
||||
/* page_len = get_content_length(header); */
|
||||
/* FIXME: Will this work with -N ? IMHO we should use
|
||||
* get_content_length(header) and always check if it's different than the
|
||||
* returned pagesize
|
||||
*/
|
||||
/* FIXME: IIRC pagesize returns headers - shouldn't we make
|
||||
* it == get_content_length(header) ??
|
||||
*/
|
||||
page_len = pagesize;
|
||||
if ((max_page_len > 0) && (page_len > max_page_len)) {
|
||||
printf (_("HTTP WARNING: page size %d too large%s|%s\n"),
|
||||
page_len, (display_html ? "</A>" : ""), perfd_size (page_len) );
|
||||
exit (STATE_WARNING);
|
||||
asprintf (&msg, _("%spage size %d too large, "), msg, page_len);
|
||||
result = max_state_alt(STATE_WARNING, result);
|
||||
} else if ((min_page_len > 0) && (page_len < min_page_len)) {
|
||||
printf (_("HTTP WARNING: page size %d too small%s|%s\n"),
|
||||
page_len, (display_html ? "</A>" : ""), perfd_size (page_len) );
|
||||
exit (STATE_WARNING);
|
||||
asprintf (&msg, _("%spage size %d too small, "), msg, page_len);
|
||||
result = max_state_alt(STATE_WARNING, result);
|
||||
}
|
||||
/* We only get here if all tests have been passed */
|
||||
asprintf (&msg, _("HTTP OK %s - %d bytes in %.3f seconds %s|%s %s\n"),
|
||||
status_line, page_len, elapsed_time,
|
||||
|
||||
/* Cut-off trailing characters */
|
||||
if(msg[strlen(msg)-2] == ',')
|
||||
msg[strlen(msg)-2] = '\0';
|
||||
else
|
||||
msg[strlen(msg)-3] = '\0';
|
||||
|
||||
/* check elapsed time */
|
||||
asprintf (&msg,
|
||||
_("%s - %d bytes in %.3f second response time %s|%s %s"),
|
||||
msg, page_len, elapsed_time,
|
||||
(display_html ? "</A>" : ""),
|
||||
perfd_time (elapsed_time), perfd_size (page_len));
|
||||
die (STATE_OK, "%s", msg);
|
||||
|
||||
if (check_critical_time == TRUE && elapsed_time > critical_time)
|
||||
result = STATE_CRITICAL;
|
||||
if (check_warning_time == TRUE && elapsed_time > warning_time)
|
||||
result = max_state_alt(STATE_WARNING, result);
|
||||
|
||||
die (result, "HTTP %s: %s\n", state_text(result), msg);
|
||||
/* die failed? */
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
|
@ -1054,14 +1109,14 @@ redir (char *pos, char *status_line)
|
|||
|
||||
url = malloc (strcspn (pos, "\r\n"));
|
||||
if (url == NULL)
|
||||
die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate url\n"));
|
||||
die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate URL\n"));
|
||||
|
||||
while (pos) {
|
||||
sscanf (pos, "%1[Ll]%*1[Oo]%*1[Cc]%*1[Aa]%*1[Tt]%*1[Ii]%*1[Oo]%*1[Nn]:%n", xx, &i);
|
||||
if (i == 0) {
|
||||
pos += (size_t) strcspn (pos, "\r\n");
|
||||
pos += (size_t) strspn (pos, "\r\n");
|
||||
if (strlen(pos) == 0)
|
||||
if (strlen(pos) == 0)
|
||||
die (STATE_UNKNOWN,
|
||||
_("HTTP UNKNOWN - Could not find redirect location - %s%s\n"),
|
||||
status_line, (display_html ? "</A>" : ""));
|
||||
|
@ -1085,26 +1140,29 @@ redir (char *pos, char *status_line)
|
|||
|
||||
url = realloc (url, strcspn (pos, "\r\n") + 1);
|
||||
if (url == NULL)
|
||||
die (STATE_UNKNOWN, _("HTTP UNKNOWN - could not allocate url\n"));
|
||||
die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate URL\n"));
|
||||
|
||||
/* URI_HTTP, URI_HOST, URI_PORT, URI_PATH */
|
||||
if (sscanf (pos, HD1, type, addr, &i, url) == 4)
|
||||
if (sscanf (pos, HD1, type, addr, &i, url) == 4) {
|
||||
url = prepend_slash (url);
|
||||
use_ssl = server_type_check (type);
|
||||
}
|
||||
|
||||
/* URI_HTTP URI_HOST URI_PATH */
|
||||
else if (sscanf (pos, HD2, type, addr, url) == 3 ) {
|
||||
else if (sscanf (pos, HD2, type, addr, url) == 3 ) {
|
||||
url = prepend_slash (url);
|
||||
use_ssl = server_type_check (type);
|
||||
i = server_port_check (use_ssl);
|
||||
}
|
||||
|
||||
/* URI_HTTP URI_HOST URI_PORT */
|
||||
else if(sscanf (pos, HD3, type, addr, &i) == 3) {
|
||||
else if (sscanf (pos, HD3, type, addr, &i) == 3) {
|
||||
strcpy (url, HTTP_URL);
|
||||
use_ssl = server_type_check (type);
|
||||
}
|
||||
|
||||
/* URI_HTTP URI_HOST */
|
||||
else if(sscanf (pos, HD4, type, addr) == 2) {
|
||||
else if (sscanf (pos, HD4, type, addr) == 2) {
|
||||
strcpy (url, HTTP_URL);
|
||||
use_ssl = server_type_check (type);
|
||||
i = server_port_check (use_ssl);
|
||||
|
@ -1121,7 +1179,7 @@ redir (char *pos, char *status_line)
|
|||
i = server_port;
|
||||
strcpy (type, server_type);
|
||||
strcpy (addr, host_name ? host_name : server_address);
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
die (STATE_UNKNOWN,
|
||||
|
@ -1151,18 +1209,18 @@ redir (char *pos, char *status_line)
|
|||
free (host_name);
|
||||
host_name = strdup (addr);
|
||||
|
||||
free (server_address);
|
||||
server_address = strdup (addr);
|
||||
if (!(followsticky & STICKY_HOST)) {
|
||||
free (server_address);
|
||||
server_address = strdup (addr);
|
||||
}
|
||||
if (!(followsticky & STICKY_PORT)) {
|
||||
server_port = i;
|
||||
}
|
||||
|
||||
free (server_url);
|
||||
if ((url[0] == '/'))
|
||||
server_url = strdup (url);
|
||||
else if (asprintf(&server_url, "/%s", url) == -1)
|
||||
die (STATE_UNKNOWN, _("HTTP UNKNOWN - Could not allocate server_url%s\n"),
|
||||
display_html ? "</A>" : "");
|
||||
free(url);
|
||||
server_url = url;
|
||||
|
||||
if ((server_port = i) > MAX_PORT)
|
||||
if (server_port > MAX_PORT)
|
||||
die (STATE_UNKNOWN,
|
||||
_("HTTP UNKNOWN - Redirection to port above %d - %s://%s:%d%s%s\n"),
|
||||
MAX_PORT, server_type, server_address, server_port, server_url,
|
||||
|
@ -1176,7 +1234,6 @@ redir (char *pos, char *status_line)
|
|||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
server_type_check (const char *type)
|
||||
{
|
||||
|
@ -1216,7 +1273,7 @@ char *perfd_size (int page_len)
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
@ -1243,7 +1300,7 @@ print_help (void)
|
|||
printf (" %s\n", "-I, --IP-address=ADDRESS");
|
||||
printf (" %s\n", _("IP address or name (use numeric address if possible to bypass DNS lookup)."));
|
||||
printf (" %s\n", "-p, --port=INTEGER");
|
||||
printf (" %s", _("Port number (default: "));
|
||||
printf (" %s", _("Port number (default: "));
|
||||
printf ("%d)\n", HTTP_PORT);
|
||||
|
||||
printf (_(UT_IPv46));
|
||||
|
@ -1253,11 +1310,12 @@ print_help (void)
|
|||
printf (" %s\n", _("Connect via SSL. Port defaults to 443"));
|
||||
printf (" %s\n", "-C, --certificate=INTEGER");
|
||||
printf (" %s\n", _("Minimum number of days a certificate has to be valid. Port defaults to 443"));
|
||||
printf (" %s\n", _("(when this option is used the url is not checked.)\n"));
|
||||
printf (" %s\n", _("(when this option is used the URL is not checked.)\n"));
|
||||
#endif
|
||||
|
||||
printf (" %s\n", "-e, --expect=STRING");
|
||||
printf (" %s\n", _("String to expect in first (status) line of server response (default: "));
|
||||
printf (" %s\n", _("Comma-delimited list of strings, at least one of them is expected in"));
|
||||
printf (" %s", _("the first (status) line of the server response (default: "));
|
||||
printf ("%s)\n", HTTP_EXPECT);
|
||||
printf (" %s\n", _("If specified skips all other status line logic (ex: 3xx, 4xx, 5xx processing)"));
|
||||
printf (" %s\n", "-s, --string=STRING");
|
||||
|
@ -1266,6 +1324,8 @@ print_help (void)
|
|||
printf (" %s\n", _("URL to GET or POST (default: /)"));
|
||||
printf (" %s\n", "-P, --post=STRING");
|
||||
printf (" %s\n", _("URL encoded http POST data"));
|
||||
printf (" %s\n", "-j, --method=STRING (for example: HEAD, OPTIONS, TRACE, PUT, DELETE)");
|
||||
printf (" %s\n", _("Set HTTP method."));
|
||||
printf (" %s\n", "-N, --no-body");
|
||||
printf (" %s\n", _("Don't wait for document body: stop reading after headers."));
|
||||
printf (" %s\n", _("(Note that this still does an HTTP GET or POST, not a HEAD.)"));
|
||||
|
@ -1292,8 +1352,9 @@ print_help (void)
|
|||
printf (" %s\n", _(" Any other tags to be sent in http header. Use multiple times for additional headers"));
|
||||
printf (" %s\n", "-L, --link");
|
||||
printf (" %s\n", _("Wrap output in HTML link (obsoleted by urlize)"));
|
||||
printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow>");
|
||||
printf (" %s\n", _("How to handle redirected pages"));
|
||||
printf (" %s\n", "-f, --onredirect=<ok|warning|critical|follow|sticky|stickyport>");
|
||||
printf (" %s\n", _("How to handle redirected pages. sticky is like follow but stick to the"));
|
||||
printf (" %s\n", _("specified IP address. stickyport also ensure post stays the same."));
|
||||
printf (" %s\n", "-m, --pagesize=INTEGER<:INTEGER>");
|
||||
printf (" %s\n", _("Minimum page size required (bytes) : Maximum page size required (bytes)"));
|
||||
|
||||
|
@ -1346,8 +1407,8 @@ print_usage (void)
|
|||
printf (_("Usage:"));
|
||||
printf (" %s -H <vhost> | -I <IP-address> [-u <uri>] [-p <port>]\n",progname);
|
||||
printf (" [-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n");
|
||||
printf (" [-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n");
|
||||
printf (" [-s string] [-l] [-r <regex> | -R <case-insensitive regex>] [-P string]\n");
|
||||
printf (" [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>] [-A string]\n");
|
||||
printf (" [-k string] [-S] [-C <age>] [-T <content-type>]\n");
|
||||
printf (" [-a auth] [-f <ok | warn | critcal | follow | sticky | stickyport>]\n");
|
||||
printf (" [-e <expect>] [-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n");
|
||||
printf (" [-P string] [-m <min_pg_size>:<max_pg_size>] [-4|-6] [-N] [-M <age>]\n");
|
||||
printf (" [-A string] [-k string] [-S] [-C <age>] [-T <content-type>] [-j method]\n");
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
* Copyright (c) 2000 Robert Dale <rdale@digital-mission.com>
|
||||
* 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
|
||||
|
@ -32,12 +30,10 @@
|
|||
* 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_ide_smart.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_ide_smart";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "1998-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -173,7 +169,8 @@ main (int argc, char *argv[])
|
|||
{"auto-off", no_argument, 0, '0'},
|
||||
{"nagios", no_argument, 0, 'n'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"version", no_argument, 0, 'V'}, {0, 0, 0, 0}
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
|
@ -210,7 +207,7 @@ main (int argc, char *argv[])
|
|||
print_help ();
|
||||
return STATE_OK;
|
||||
case 'V':
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
return STATE_OK;
|
||||
default:
|
||||
usage5 ();
|
||||
|
@ -480,7 +477,7 @@ smart_read_thresholds (int fd, thresholds_t * thresholds)
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Nagios feature - 1999 Robert Dale <rdale@digital-mission.com>\n");
|
||||
printf ("(C) 1999 Ragnar Hojland Espinosa <ragnar@lightside.dhis.org>\n");
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* License: GPL
|
||||
* 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
|
||||
|
@ -25,13 +23,11 @@
|
|||
* 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_ldap.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/* progname may be check_ldaps */
|
||||
char *progname = "check_ldap";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "2000-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -87,15 +83,15 @@ main (int argc, char *argv[])
|
|||
LDAPMessage *result;
|
||||
|
||||
/* should be int result = STATE_UNKNOWN; */
|
||||
|
||||
|
||||
int status = STATE_UNKNOWN;
|
||||
long microsec;
|
||||
double elapsed_time;
|
||||
|
||||
|
||||
/* for ldap tls */
|
||||
|
||||
int tls;
|
||||
int version=3;
|
||||
|
||||
int tls;
|
||||
int version=3;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
|
@ -129,7 +125,7 @@ main (int argc, char *argv[])
|
|||
printf ("Could not connect to the server at port %i\n", ld_port);
|
||||
return STATE_CRITICAL;
|
||||
}
|
||||
#else
|
||||
#else
|
||||
if (!(ld = ldap_open (ld_host, ld_port))) {
|
||||
if (verbose)
|
||||
ldap_perror(ld, "ldap_open");
|
||||
|
@ -137,7 +133,7 @@ main (int argc, char *argv[])
|
|||
return STATE_CRITICAL;
|
||||
}
|
||||
#endif /* HAVE_LDAP_INIT */
|
||||
|
||||
|
||||
#ifdef HAVE_LDAP_SET_OPTION
|
||||
/* set ldap options */
|
||||
if (ldap_set_option (ld, LDAP_OPT_PROTOCOL_VERSION, &ld_protocol) !=
|
||||
|
@ -152,7 +148,7 @@ main (int argc, char *argv[])
|
|||
#if defined(HAVE_LDAP_SET_OPTION) && defined(LDAP_OPT_X_TLS)
|
||||
/* ldaps: set option tls */
|
||||
tls = LDAP_OPT_X_TLS_HARD;
|
||||
|
||||
|
||||
if (ldap_set_option (ld, LDAP_OPT_X_TLS, &tls) != LDAP_SUCCESS)
|
||||
{
|
||||
if (verbose)
|
||||
|
@ -179,7 +175,7 @@ main (int argc, char *argv[])
|
|||
/* call start_tls */
|
||||
if (ldap_start_tls_s(ld, NULL, NULL) != LDAP_SUCCESS)
|
||||
{
|
||||
if (verbose)
|
||||
if (verbose)
|
||||
ldap_perror(ld, "ldap_start_tls");
|
||||
printf (_("Could not init startTLS at port %i!\n"), ld_port);
|
||||
return STATE_CRITICAL;
|
||||
|
@ -189,13 +185,13 @@ main (int argc, char *argv[])
|
|||
return STATE_CRITICAL;
|
||||
#endif /* HAVE_LDAP_START_TLS_S */
|
||||
}
|
||||
|
||||
|
||||
/* bind to the ldap server */
|
||||
if (ldap_bind_s (ld, ld_binddn, ld_passwd, LDAP_AUTH_SIMPLE) !=
|
||||
LDAP_SUCCESS) {
|
||||
if (verbose)
|
||||
ldap_perror(ld, "ldap_bind");
|
||||
printf (_("Could not bind to the ldap-server\n"));
|
||||
printf (_("Could not bind to the LDAP server\n"));
|
||||
return STATE_CRITICAL;
|
||||
}
|
||||
|
||||
|
@ -289,7 +285,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 't': /* timeout period */
|
||||
if (!is_intnonneg (optarg))
|
||||
|
@ -390,7 +386,7 @@ print_help (void)
|
|||
char *myport;
|
||||
asprintf (&myport, "%d", DEFAULT_PORT);
|
||||
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* License: GPL
|
||||
* 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
|
||||
|
@ -27,12 +25,10 @@
|
|||
* 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_load.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_load";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "1999-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -245,7 +241,7 @@ process_arguments (int argc, char **argv)
|
|||
take_into_account_cpus = 1;
|
||||
break;
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
|
@ -298,7 +294,7 @@ validate_arguments (void)
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Felipe Gustavo de Almeida <galmeida@linux.ime.usp.br>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* License: GPL
|
||||
* 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
|
||||
|
@ -28,12 +26,10 @@
|
|||
* 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_mrtg.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_mrtg";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "1999-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -57,7 +53,7 @@ char *units;
|
|||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int result = STATE_UNKNOWN;
|
||||
int result = STATE_OK;
|
||||
FILE *fp;
|
||||
int line;
|
||||
char input_buffer[MAX_INPUT_BUFFER];
|
||||
|
@ -181,7 +177,7 @@ process_arguments (int argc, char **argv)
|
|||
{"warning", required_argument, 0, 'w'},
|
||||
{"label", required_argument, 0, 'l'},
|
||||
{"units", required_argument, 0, 'u'},
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
{"variable", required_argument, 0, 'v'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{0, 0, 0, 0}
|
||||
|
@ -237,7 +233,7 @@ process_arguments (int argc, char **argv)
|
|||
units = optarg;
|
||||
break;
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
|
@ -317,7 +313,7 @@ validate_arguments (void)
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
@ -334,7 +330,7 @@ print_help (void)
|
|||
|
||||
printf (" %s\n", "-F, --logfile=FILE");
|
||||
printf (" %s\n", _("The MRTG log file containing the data you want to monitor"));
|
||||
printf ("-e, --expires=MINUTES");
|
||||
printf (" %s\n", "-e, --expires=MINUTES");
|
||||
printf (" %s\n", _("Minutes before MRTG data is considered to be too old"));
|
||||
printf (" %s\n", "-a, --aggregation=AVG|MAX");
|
||||
printf (" %s\n", _("Should we check average or maximum values?"));
|
||||
|
@ -380,7 +376,7 @@ print_help (void)
|
|||
|
||||
|
||||
|
||||
/* original command line:
|
||||
/* original command line:
|
||||
<log_file> <expire_minutes> <AVG|MAX> <variable> <vwl> <vcl> <label> [units] */
|
||||
|
||||
void
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* License: GPL
|
||||
* 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
|
||||
|
@ -28,7 +26,6 @@
|
|||
* 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_mrtgtraf.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
@ -36,7 +33,6 @@
|
|||
#include "utils.h"
|
||||
|
||||
const char *progname = "check_mrtgtraf";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "1999-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -203,7 +199,7 @@ main (int argc, char **argv)
|
|||
(int)incoming_warning_threshold, incoming_warning_threshold,
|
||||
(int)incoming_critical_threshold, incoming_critical_threshold,
|
||||
TRUE, 0, FALSE, 0),
|
||||
fperfdata("in", adjusted_outgoing_rate, outgoing_speed_rating,
|
||||
fperfdata("out", adjusted_outgoing_rate, outgoing_speed_rating,
|
||||
(int)outgoing_warning_threshold, outgoing_warning_threshold,
|
||||
(int)outgoing_critical_threshold, outgoing_critical_threshold,
|
||||
TRUE, 0, FALSE, 0));
|
||||
|
@ -223,13 +219,11 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
int option = 0;
|
||||
static struct option longopts[] = {
|
||||
{"logfile", required_argument, 0, 'F'},
|
||||
{"filename", required_argument, 0, 'F'},
|
||||
{"expires", required_argument, 0, 'e'},
|
||||
{"aggregation", required_argument, 0, 'a'},
|
||||
{"variable", required_argument, 0, 'v'},
|
||||
{"critical", required_argument, 0, 'c'},
|
||||
{"warning", required_argument, 0, 'w'},
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{0, 0, 0, 0}
|
||||
|
@ -275,7 +269,7 @@ process_arguments (int argc, char **argv)
|
|||
&outgoing_warning_threshold);
|
||||
break;
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
|
@ -333,7 +327,7 @@ validate_arguments (void)
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
@ -385,6 +379,6 @@ void
|
|||
print_usage (void)
|
||||
{
|
||||
printf (_("Usage"));
|
||||
printf (" %s -F <log_file> -a <AVG | MAX> -v <variable> -w <warning_pair>",progname);
|
||||
printf ("-c <critical_pair> [-e expire_minutes] [-t timeout] [-v]\n");
|
||||
printf (" %s -F <log_file> -a <AVG | MAX> -w <warning_pair>\n",progname);
|
||||
printf ("-c <critical_pair> [-e expire_minutes]\n");
|
||||
}
|
||||
|
|
|
@ -5,10 +5,8 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999 Didi Rieder (adrieder@sbox.tu-graz.ac.at)
|
||||
* Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net)
|
||||
* Copyright (c) 1999-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 1999-2009 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
|
||||
|
@ -29,12 +27,10 @@
|
|||
* 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_mysql.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_mysql";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "1999-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -71,9 +67,9 @@ main (int argc, char **argv)
|
|||
MYSQL mysql;
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
|
||||
|
||||
/* should be status */
|
||||
|
||||
|
||||
char *result = NULL;
|
||||
char *error = NULL;
|
||||
char slaveresult[SLAVERESULTSIZE];
|
||||
|
@ -181,13 +177,14 @@ main (int argc, char **argv)
|
|||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ((slave_io_field < 0) || (slave_sql_field < 0) || (num_fields == 0)) {
|
||||
mysql_free_result (res);
|
||||
mysql_close (&mysql);
|
||||
die (STATE_CRITICAL, "Slave status unavailable\n");
|
||||
}
|
||||
|
||||
snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s Seconds Behind Master: %s", row[slave_io_field], row[slave_sql_field], row[seconds_behind_field]);
|
||||
|
||||
snprintf (slaveresult, SLAVERESULTSIZE, "Slave IO: %s Slave SQL: %s Seconds Behind Master: %s", row[slave_io_field], row[slave_sql_field], seconds_behind_field!=-1?row[seconds_behind_field]:"Unknown");
|
||||
if (strcmp (row[slave_io_field], "Yes") != 0 || strcmp (row[slave_sql_field], "Yes") != 0) {
|
||||
mysql_free_result (res);
|
||||
mysql_close (&mysql);
|
||||
|
@ -310,7 +307,7 @@ process_arguments (int argc, char **argv)
|
|||
critical = optarg;
|
||||
break;
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
|
@ -361,9 +358,6 @@ validate_arguments (void)
|
|||
if (db_host == NULL)
|
||||
db_host = strdup("");
|
||||
|
||||
if (db_pass == NULL)
|
||||
db_pass == strdup("");
|
||||
|
||||
if (db == NULL)
|
||||
db = strdup("");
|
||||
|
||||
|
@ -377,11 +371,11 @@ print_help (void)
|
|||
char *myport;
|
||||
asprintf (&myport, "%d", MYSQL_PORT);
|
||||
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf (_(COPYRIGHT), copyright, email);
|
||||
|
||||
printf ("%s\n", _("This program tests connections to a mysql server"));
|
||||
printf ("%s\n", _("This program tests connections to a MySQL server"));
|
||||
|
||||
printf ("\n\n");
|
||||
|
||||
|
@ -420,6 +414,9 @@ print_help (void)
|
|||
printf ("\n");
|
||||
printf ("%s\n", _("Notes:"));
|
||||
printf (_(UT_EXTRA_OPTS_NOTES));
|
||||
printf ("\n");
|
||||
printf (" %s\n", _("You must specify -p with an empty string to force an empty password,"));
|
||||
printf (" %s\n", _("overriding any my.cnf settings."));
|
||||
#endif
|
||||
|
||||
printf (_(UT_SUPPORT));
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
* Nagios check_mysql_query plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 2006-2007 Nagios Plugins Development Team
|
||||
* Copyright (c) 2006-2009 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
|
||||
|
@ -28,12 +26,10 @@
|
|||
* 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_mysql_query.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_mysql_query";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "1999-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -192,7 +188,7 @@ process_arguments (int argc, char **argv)
|
|||
return ERROR;
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "hvVSP:p:u:d:H:s:q:w:c:", longopts, &option);
|
||||
c = getopt_long (argc, argv, "hvVP:p:u:d:H:s:q:w:c:", longopts, &option);
|
||||
|
||||
if (c == -1 || c == EOF)
|
||||
break;
|
||||
|
@ -231,7 +227,7 @@ process_arguments (int argc, char **argv)
|
|||
verbose++;
|
||||
break;
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
|
@ -270,9 +266,6 @@ validate_arguments (void)
|
|||
if (db_host == NULL)
|
||||
db_host = strdup("");
|
||||
|
||||
if (db_pass == NULL)
|
||||
db_pass == strdup("");
|
||||
|
||||
if (db == NULL)
|
||||
db = strdup("");
|
||||
|
||||
|
@ -286,7 +279,7 @@ print_help (void)
|
|||
char *myport;
|
||||
asprintf (&myport, "%d", MYSQL_PORT);
|
||||
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf (_(COPYRIGHT), copyright, email);
|
||||
|
||||
|
@ -321,6 +314,9 @@ print_help (void)
|
|||
printf ("\n");
|
||||
printf ("%s\n", _("Notes:"));
|
||||
printf (_(UT_EXTRA_OPTS_NOTES));
|
||||
printf ("\n");
|
||||
printf (" %s\n", _("You must specify -p with an empty string to force an empty password,"));
|
||||
printf (" %s\n", _("overriding any my.cnf settings."));
|
||||
#endif
|
||||
|
||||
printf (_(UT_SUPPORT));
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* License: GPL
|
||||
* 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
|
||||
|
@ -31,12 +29,10 @@
|
|||
* 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_nagios.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_nagios";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "1999-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -187,8 +183,8 @@ main (int argc, char **argv)
|
|||
printf (ngettext ("%d process", "%d processes", proc_entries), proc_entries);
|
||||
printf (", ");
|
||||
printf (
|
||||
ngettext ("status log updated %d second ago",
|
||||
"status log updated %d seconds ago",
|
||||
ngettext ("status log updated %d second ago",
|
||||
"status log updated %d seconds ago",
|
||||
(int) (current_time - latest_entry_time) ),
|
||||
(int) (current_time - latest_entry_time) );
|
||||
printf ("\n");
|
||||
|
@ -240,7 +236,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'F': /* status log */
|
||||
status_log = optarg;
|
||||
|
@ -278,7 +274,7 @@ process_arguments (int argc, char **argv)
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf (_(COPYRIGHT), copyright, email);
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
* Copyright (c) 2000-2002 Yves Rubin (rubiyz@yahoo.com)
|
||||
* 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
|
||||
|
@ -31,12 +29,10 @@
|
|||
* 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_nt.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_nt";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -97,6 +93,7 @@ int main(int argc, char **argv){
|
|||
char *temp_string_perf=NULL;
|
||||
char *description=NULL,*counter_unit = NULL;
|
||||
char *minval = NULL, *maxval = NULL, *errcvt = NULL;
|
||||
char *fds=NULL, *tds=NULL;
|
||||
|
||||
double total_disk_space=0;
|
||||
double free_disk_space=0;
|
||||
|
@ -163,9 +160,9 @@ int main(int argc, char **argv){
|
|||
|
||||
/* 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 &&
|
||||
lvalue_list[0+offset]<=(unsigned long)17280 &&
|
||||
lvalue_list[1+offset]> (unsigned long)0 &&
|
||||
lvalue_list[1+offset]<=(unsigned long)100 &&
|
||||
lvalue_list[1+offset]<=(unsigned long)100 &&
|
||||
lvalue_list[2+offset]> (unsigned long)0 &&
|
||||
lvalue_list[2+offset]<=(unsigned long)100) {
|
||||
|
||||
|
@ -174,7 +171,7 @@ int main(int argc, char **argv){
|
|||
fetch_data (server_address, server_port, send_buffer);
|
||||
|
||||
utilization=strtoul(recv_buffer,NULL,10);
|
||||
|
||||
|
||||
/* Check if any of the request is in a warning or critical state */
|
||||
if(utilization >= lvalue_list[2+offset])
|
||||
return_code=STATE_CRITICAL;
|
||||
|
@ -194,7 +191,7 @@ int main(int argc, char **argv){
|
|||
perfdata = temp_string_perf;
|
||||
} else
|
||||
output_message = strdup (_("not enough values for -l parameters"));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CHECK_UPTIME:
|
||||
|
@ -202,7 +199,7 @@ int main(int argc, char **argv){
|
|||
asprintf(&send_buffer, "%s&3", req_password);
|
||||
fetch_data (server_address, server_port, send_buffer);
|
||||
uptime=strtoul(recv_buffer,NULL,10);
|
||||
updays = uptime / 86400;
|
||||
updays = uptime / 86400;
|
||||
uphours = (uptime % 86400) / 3600;
|
||||
upminutes = ((uptime % 86400) % 3600) / 60;
|
||||
asprintf(&output_message,_("System Uptime - %u day(s) %u hour(s) %u minute(s)"),updays,uphours, upminutes);
|
||||
|
@ -218,13 +215,18 @@ int main(int argc, char **argv){
|
|||
else {
|
||||
asprintf(&send_buffer,"%s&4&%s", req_password, value_list);
|
||||
fetch_data (server_address, server_port, send_buffer);
|
||||
free_disk_space=atof(strtok(recv_buffer,"&"));
|
||||
total_disk_space=atof(strtok(NULL,"&"));
|
||||
percent_used_space = ((total_disk_space - free_disk_space) / total_disk_space) * 100;
|
||||
warning_used_space = ((float)warning_value / 100) * total_disk_space;
|
||||
critical_used_space = ((float)critical_value / 100) * total_disk_space;
|
||||
fds=strtok(recv_buffer,"&");
|
||||
tds=strtok(NULL,"&");
|
||||
if(fds!=NULL)
|
||||
free_disk_space=atof(fds);
|
||||
if(tds!=NULL)
|
||||
total_disk_space=atof(tds);
|
||||
|
||||
if (total_disk_space>0 && free_disk_space>=0) {
|
||||
percent_used_space = ((total_disk_space - free_disk_space) / total_disk_space) * 100;
|
||||
warning_used_space = ((float)warning_value / 100) * total_disk_space;
|
||||
critical_used_space = ((float)critical_value / 100) * total_disk_space;
|
||||
|
||||
if (free_disk_space>=0) {
|
||||
asprintf(&temp_string,_("%s:\\ - total: %.2f Gb - used: %.2f Gb (%.0f%%) - free %.2f Gb (%.0f%%)"),
|
||||
value_list, total_disk_space / 1073741824, (total_disk_space - free_disk_space) / 1073741824,
|
||||
percent_used_space, free_disk_space / 1073741824, (free_disk_space / total_disk_space)*100);
|
||||
|
@ -235,14 +237,14 @@ int main(int argc, char **argv){
|
|||
if(check_critical_value==TRUE && percent_used_space >= critical_value)
|
||||
return_code=STATE_CRITICAL;
|
||||
else if (check_warning_value==TRUE && percent_used_space >= warning_value)
|
||||
return_code=STATE_WARNING;
|
||||
return_code=STATE_WARNING;
|
||||
else
|
||||
return_code=STATE_OK;
|
||||
return_code=STATE_OK;
|
||||
|
||||
output_message = strdup (temp_string);
|
||||
perfdata = temp_string_perf;
|
||||
} else {
|
||||
output_message = strdup (_("Free disk space : Invalid drive "));
|
||||
output_message = strdup (_("Free disk space : Invalid drive"));
|
||||
return_code=STATE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
@ -265,7 +267,7 @@ int main(int argc, char **argv){
|
|||
break;
|
||||
|
||||
case CHECK_MEMUSE:
|
||||
|
||||
|
||||
asprintf(&send_buffer,"%s&7", req_password);
|
||||
fetch_data (server_address, server_port, send_buffer);
|
||||
mem_commitLimit=atof(strtok(recv_buffer,"&"));
|
||||
|
@ -274,130 +276,129 @@ int main(int argc, char **argv){
|
|||
warning_used_space = ((float)warning_value / 100) * mem_commitLimit;
|
||||
critical_used_space = ((float)critical_value / 100) * mem_commitLimit;
|
||||
|
||||
/* Divisor should be 1048567, not 3044515, as we are measuring "Commit Charge" here,
|
||||
/* Divisor should be 1048567, not 3044515, as we are measuring "Commit Charge" here,
|
||||
which equals RAM + Pagefiles. */
|
||||
asprintf(&output_message,_("Memory usage: total:%.2f Mb - used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)"),
|
||||
mem_commitLimit / 1048567, mem_commitByte / 1048567, percent_used_space,
|
||||
asprintf(&output_message,_("Memory usage: total:%.2f Mb - used: %.2f Mb (%.0f%%) - free: %.2f Mb (%.0f%%)"),
|
||||
mem_commitLimit / 1048567, mem_commitByte / 1048567, percent_used_space,
|
||||
(mem_commitLimit - mem_commitByte) / 1048567, (mem_commitLimit - mem_commitByte) / mem_commitLimit * 100);
|
||||
asprintf(&perfdata,_("'Memory usage'=%.2fMb;%.2f;%.2f;0.00;%.2f"), mem_commitByte / 1048567,
|
||||
warning_used_space / 1048567, critical_used_space / 1048567, mem_commitLimit / 1048567);
|
||||
|
||||
|
||||
return_code=STATE_OK;
|
||||
if(check_critical_value==TRUE && percent_used_space >= critical_value)
|
||||
return_code=STATE_CRITICAL;
|
||||
else if (check_warning_value==TRUE && percent_used_space >= warning_value)
|
||||
return_code=STATE_WARNING;
|
||||
return_code=STATE_WARNING;
|
||||
|
||||
break;
|
||||
|
||||
case CHECK_COUNTER:
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
CHECK_COUNTER has been modified to provide extensive perfdata information.
|
||||
In order to do this, some modifications have been done to the code
|
||||
and some constraints have been introduced.
|
||||
|
||||
1) For the sake of simplicity of the code, perfdata information will only be
|
||||
provided when the "description" field is added.
|
||||
|
||||
2) If the counter you're going to measure is percent-based, the code will detect
|
||||
the percent sign in its name and will attribute minimum (0%) and maximum (100%)
|
||||
values automagically, as well the ¨%" sign to graph units.
|
||||
In order to do this, some modifications have been done to the code
|
||||
and some constraints have been introduced.
|
||||
|
||||
3) OTOH, if the counter is "absolute", you'll have to provide the following
|
||||
the counter unit - that is, the dimensions of the counter you're getting. Examples:
|
||||
pages/s, packets transferred, etc.
|
||||
1) For the sake of simplicity of the code, perfdata information will only be
|
||||
provided when the "description" field is added.
|
||||
|
||||
4) If you want, you may provide the minimum and maximum values to expect. They aren't mandatory,
|
||||
but once specified they MUST have the same order of magnitude and units of -w and -c; otherwise.
|
||||
strange things will happen when you make graphs of your data.
|
||||
2) If the counter you're going to measure is percent-based, the code will detect
|
||||
the percent sign in its name and will attribute minimum (0%) and maximum (100%)
|
||||
values automagically, as well the ¨%" sign to graph units.
|
||||
|
||||
3) OTOH, if the counter is "absolute", you'll have to provide the following
|
||||
the counter unit - that is, the dimensions of the counter you're getting. Examples:
|
||||
pages/s, packets transferred, etc.
|
||||
|
||||
4) If you want, you may provide the minimum and maximum values to expect. They aren't mandatory,
|
||||
but once specified they MUST have the same order of magnitude and units of -w and -c; otherwise.
|
||||
strange things will happen when you make graphs of your data.
|
||||
*/
|
||||
|
||||
if (value_list == NULL)
|
||||
if (value_list == NULL)
|
||||
output_message = strdup (_("No counter specified"));
|
||||
else
|
||||
else
|
||||
{
|
||||
preparelist (value_list); /* replace , between services with & to send the request */
|
||||
isPercent = (strchr (value_list, '%') != NULL);
|
||||
preparelist (value_list); /* replace , between services with & to send the request */
|
||||
isPercent = (strchr (value_list, '%') != NULL);
|
||||
|
||||
strtok (value_list, "&"); /* burn the first parameters */
|
||||
description = strtok (NULL, "&");
|
||||
counter_unit = strtok (NULL, "&");
|
||||
asprintf (&send_buffer, "%s&8&%s", req_password, value_list);
|
||||
fetch_data (server_address, server_port, send_buffer);
|
||||
counter_value = atof (recv_buffer);
|
||||
strtok (value_list, "&"); /* burn the first parameters */
|
||||
description = strtok (NULL, "&");
|
||||
counter_unit = strtok (NULL, "&");
|
||||
asprintf (&send_buffer, "%s&8&%s", req_password, value_list);
|
||||
fetch_data (server_address, server_port, send_buffer);
|
||||
counter_value = atof (recv_buffer);
|
||||
|
||||
if (description == NULL)
|
||||
asprintf (&output_message, "%.f", counter_value);
|
||||
else if (isPercent)
|
||||
{
|
||||
counter_unit = strdup ("%");
|
||||
allRight = TRUE;
|
||||
}
|
||||
|
||||
if (description == NULL)
|
||||
asprintf (&output_message, "%.f", counter_value);
|
||||
else if (isPercent)
|
||||
{
|
||||
counter_unit = strdup ("%");
|
||||
allRight = TRUE;
|
||||
}
|
||||
if ((counter_unit != NULL) && (!allRight))
|
||||
{
|
||||
minval = strtok (NULL, "&");
|
||||
maxval = strtok (NULL, "&");
|
||||
|
||||
if ((counter_unit != NULL) && (!allRight))
|
||||
{
|
||||
minval = strtok (NULL, "&");
|
||||
maxval = strtok (NULL, "&");
|
||||
/* All parameters specified. Let's check the numbers */
|
||||
|
||||
/* All parameters specified. Let's check the numbers */
|
||||
fminval = (minval != NULL) ? strtod (minval, &errcvt) : -1;
|
||||
fmaxval = (minval != NULL) ? strtod (maxval, &errcvt) : -1;
|
||||
|
||||
fminval = (minval != NULL) ? strtod (minval, &errcvt) : -1;
|
||||
fmaxval = (minval != NULL) ? strtod (maxval, &errcvt) : -1;
|
||||
|
||||
if ((fminval == 0) && (minval == errcvt))
|
||||
if ((fminval == 0) && (minval == errcvt))
|
||||
output_message = strdup (_("Minimum value contains non-numbers"));
|
||||
else
|
||||
else
|
||||
{
|
||||
if ((fmaxval == 0) && (maxval == errcvt))
|
||||
output_message = strdup (_("Maximum value contains non-numbers"));
|
||||
else
|
||||
allRight = TRUE; /* Everything is OK. */
|
||||
if ((fmaxval == 0) && (maxval == errcvt))
|
||||
output_message = strdup (_("Maximum value contains non-numbers"));
|
||||
else
|
||||
allRight = TRUE; /* Everything is OK. */
|
||||
|
||||
}
|
||||
}
|
||||
else if ((counter_unit == NULL) && (description != NULL))
|
||||
output_message = strdup (_("No unit counter specified"));
|
||||
}
|
||||
else if ((counter_unit == NULL) && (description != NULL))
|
||||
output_message = strdup (_("No unit counter specified"));
|
||||
|
||||
if (allRight)
|
||||
{
|
||||
/* Let's format the output string, finally... */
|
||||
if (allRight)
|
||||
{
|
||||
/* Let's format the output string, finally... */
|
||||
if (strstr(description, "%") == NULL) {
|
||||
asprintf (&output_message, "%s = %.2f %s", description, counter_value, counter_unit);
|
||||
asprintf (&output_message, "%s = %.2f %s", description, counter_value, counter_unit);
|
||||
} else {
|
||||
/* has formatting, will segv if wrong */
|
||||
asprintf (&output_message, description, counter_value);
|
||||
asprintf (&output_message, description, counter_value);
|
||||
}
|
||||
asprintf (&output_message, "%s |", output_message);
|
||||
asprintf (&output_message,"%s %s", output_message,
|
||||
fperfdata (description, counter_value,
|
||||
asprintf (&output_message,"%s %s", output_message,
|
||||
fperfdata (description, counter_value,
|
||||
counter_unit, 1, warning_value, 1, critical_value,
|
||||
(!(isPercent) && (minval != NULL)), fminval,
|
||||
(!(isPercent) && (minval != NULL)), fmaxval));
|
||||
}
|
||||
(!(isPercent) && (minval != NULL)), fminval,
|
||||
(!(isPercent) && (minval != NULL)), fmaxval));
|
||||
}
|
||||
}
|
||||
|
||||
if (critical_value > warning_value)
|
||||
if (critical_value > warning_value)
|
||||
{ /* Normal thresholds */
|
||||
if (check_critical_value == TRUE && counter_value >= critical_value)
|
||||
return_code = STATE_CRITICAL;
|
||||
else if (check_warning_value == TRUE && counter_value >= warning_value)
|
||||
return_code = STATE_WARNING;
|
||||
else
|
||||
return_code = STATE_OK;
|
||||
if (check_critical_value == TRUE && counter_value >= critical_value)
|
||||
return_code = STATE_CRITICAL;
|
||||
else if (check_warning_value == TRUE && counter_value >= warning_value)
|
||||
return_code = STATE_WARNING;
|
||||
else
|
||||
return_code = STATE_OK;
|
||||
}
|
||||
else
|
||||
else
|
||||
{ /* inverse thresholds */
|
||||
return_code = STATE_OK;
|
||||
if (check_critical_value == TRUE && counter_value <= critical_value)
|
||||
return_code = STATE_CRITICAL;
|
||||
else if (check_warning_value == TRUE && counter_value <= warning_value)
|
||||
return_code = STATE_WARNING;
|
||||
return_code = STATE_OK;
|
||||
if (check_critical_value == TRUE && counter_value <= critical_value)
|
||||
return_code = STATE_CRITICAL;
|
||||
else if (check_warning_value == TRUE && counter_value <= warning_value)
|
||||
return_code = STATE_WARNING;
|
||||
}
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
case CHECK_FILEAGE:
|
||||
|
||||
if (value_list==NULL)
|
||||
|
@ -409,27 +410,27 @@ int main(int argc, char **argv){
|
|||
age_in_minutes = atoi(strtok(recv_buffer,"&"));
|
||||
description = strtok(NULL,"&");
|
||||
output_message = strdup (description);
|
||||
|
||||
|
||||
if (critical_value > warning_value) { /* Normal thresholds */
|
||||
if(check_critical_value==TRUE && age_in_minutes >= critical_value)
|
||||
return_code=STATE_CRITICAL;
|
||||
else if (check_warning_value==TRUE && age_in_minutes >= warning_value)
|
||||
return_code=STATE_WARNING;
|
||||
return_code=STATE_WARNING;
|
||||
else
|
||||
return_code=STATE_OK;
|
||||
return_code=STATE_OK;
|
||||
}
|
||||
else { /* inverse thresholds */
|
||||
if(check_critical_value==TRUE && age_in_minutes <= critical_value)
|
||||
return_code=STATE_CRITICAL;
|
||||
else if (check_warning_value==TRUE && age_in_minutes <= warning_value)
|
||||
return_code=STATE_WARNING;
|
||||
return_code=STATE_WARNING;
|
||||
else
|
||||
return_code=STATE_OK;
|
||||
return_code=STATE_OK;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CHECK_INSTANCES:
|
||||
case CHECK_INSTANCES:
|
||||
if (value_list==NULL)
|
||||
output_message = strdup (_("No counter specified"));
|
||||
else {
|
||||
|
@ -439,7 +440,7 @@ int main(int argc, char **argv){
|
|||
printf("NSClient - %s\n",recv_buffer);
|
||||
exit(STATE_UNKNOWN);
|
||||
}
|
||||
asprintf(&output_message,"%s",recv_buffer);
|
||||
asprintf(&output_message,"%s",recv_buffer);
|
||||
return_code=STATE_OK;
|
||||
}
|
||||
break;
|
||||
|
@ -469,13 +470,17 @@ int process_arguments(int argc, char **argv){
|
|||
|
||||
int option = 0;
|
||||
static struct option longopts[] =
|
||||
{
|
||||
{
|
||||
{"port", required_argument,0,'p'},
|
||||
{"timeout", required_argument,0,'t'},
|
||||
{"critical", required_argument,0,'c'},
|
||||
{"warning", required_argument,0,'w'},
|
||||
{"variable", required_argument,0,'v'},
|
||||
{"hostname", required_argument,0,'H'},
|
||||
{"params", required_argument,0,'l'},
|
||||
{"secret", required_argument,0,'s'},
|
||||
{"display", required_argument,0,'d'},
|
||||
{"unknown-timeout", no_argument, 0, 'u'},
|
||||
{"version", no_argument, 0,'V'},
|
||||
{"help", no_argument, 0,'h'},
|
||||
{0,0,0,0}
|
||||
|
@ -492,17 +497,17 @@ int process_arguments(int argc, char **argv){
|
|||
argc--;
|
||||
}
|
||||
|
||||
for (c=1;c<argc;c++) {
|
||||
if(strcmp("-to",argv[c])==0)
|
||||
strcpy(argv[c],"-t");
|
||||
else if (strcmp("-wv",argv[c])==0)
|
||||
strcpy(argv[c],"-w");
|
||||
else if (strcmp("-cv",argv[c])==0)
|
||||
strcpy(argv[c],"-c");
|
||||
for (c=1;c<argc;c++) {
|
||||
if(strcmp("-to",argv[c])==0)
|
||||
strcpy(argv[c],"-t");
|
||||
else if (strcmp("-wv",argv[c])==0)
|
||||
strcpy(argv[c],"-w");
|
||||
else if (strcmp("-cv",argv[c])==0)
|
||||
strcpy(argv[c],"-c");
|
||||
}
|
||||
|
||||
while (1) {
|
||||
c = getopt_long(argc,argv,"+hVH:t:c:w:p:v:l:s:d:",longopts,&option);
|
||||
c = getopt_long(argc,argv,"+hVH:t:c:w:p:v:l:s:d:u",longopts,&option);
|
||||
|
||||
if (c==-1||c==EOF||c==1)
|
||||
break;
|
||||
|
@ -514,10 +519,9 @@ int process_arguments(int argc, char **argv){
|
|||
print_help();
|
||||
exit(STATE_OK);
|
||||
case 'V': /* version */
|
||||
print_revision(progname,revision);
|
||||
print_revision(progname, NP_VERSION);
|
||||
exit(STATE_OK);
|
||||
case 'H': /* hostname */
|
||||
if (server_address) free(server_address);
|
||||
server_address = optarg;
|
||||
break;
|
||||
case 's': /* password */
|
||||
|
@ -570,6 +574,9 @@ int process_arguments(int argc, char **argv){
|
|||
if (!strcmp(optarg,"SHOWALL"))
|
||||
show_all = TRUE;
|
||||
break;
|
||||
case 'u':
|
||||
socket_timeout_state=STATE_UNKNOWN;
|
||||
break;
|
||||
case 't': /* timeout */
|
||||
socket_timeout=atoi(optarg);
|
||||
if(socket_timeout<=0)
|
||||
|
@ -577,6 +584,8 @@ int process_arguments(int argc, char **argv){
|
|||
}
|
||||
|
||||
}
|
||||
if (server_address == NULL)
|
||||
usage4 (_("You must provide a server address or host name"));
|
||||
|
||||
if (vars_to_check==CHECK_NONE)
|
||||
return ERROR;
|
||||
|
@ -596,7 +605,7 @@ void fetch_data (const char *address, int port, const char *sendb) {
|
|||
|
||||
if(result!=STATE_OK)
|
||||
die (result, _("could not fetch information from server\n"));
|
||||
|
||||
|
||||
if (!strncmp(recv_buffer,"ERROR",5))
|
||||
die (STATE_UNKNOWN, "NSClient - %s\n",recv_buffer);
|
||||
}
|
||||
|
@ -608,15 +617,15 @@ int strtoularray(unsigned long *array, char *string, const char *delim) {
|
|||
|
||||
for (idx=0;idx<MAX_VALUE_LIST;idx++)
|
||||
array[idx]=0;
|
||||
|
||||
|
||||
idx=0;
|
||||
for(t1 = strtok(string,delim);t1 != NULL; t1 = strtok(NULL, delim)) {
|
||||
if (is_numeric(t1) && idx<MAX_VALUE_LIST) {
|
||||
array[idx]=strtoul(t1,NULL,10);
|
||||
idx++;
|
||||
} else
|
||||
} else
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -634,117 +643,124 @@ void preparelist(char *string) {
|
|||
|
||||
void print_help(void)
|
||||
{
|
||||
print_revision(progname,revision);
|
||||
|
||||
print_revision(progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 2000 Yves Rubin (rubiyz@yahoo.com)\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
||||
printf ("%s\n", _("This plugin collects data from the NSClient service running on a"));
|
||||
printf ("%s\n", _("Windows NT/2000/XP/2003 server."));
|
||||
|
||||
printf ("\n\n");
|
||||
printf ("%s\n", _("This plugin collects data from the NSClient service running on a"));
|
||||
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", "-H, --hostname=HOST");
|
||||
printf (" %s\n", _("Name of the host to check"));
|
||||
printf (" %s\n", "-p, --port=INTEGER");
|
||||
printf (" %s", _("Optional port number (default: "));
|
||||
printf ("%d)\n", PORT);
|
||||
printf (" %s\n", "-s <password>");
|
||||
printf (" %s\n", _("Password needed for the request"));
|
||||
printf (" %s\n", "-w, --warning=INTEGER");
|
||||
printf (" %s\n", _("Threshold which will result in a warning status"));
|
||||
printf (" %s\n", "-c, --critical=INTEGER");
|
||||
printf (" %s\n", _("Threshold which will result in a critical status"));
|
||||
printf (" %s\n", "-t, --timeout=INTEGER");
|
||||
printf (" %s", _("Seconds before connection attempt times out (default: "));
|
||||
printf ("%d)\n", DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (" %s\n", "-h, --help");
|
||||
printf (" %s\n", _("Print this help screen"));
|
||||
printf (" %s\n", "-V, --version");
|
||||
printf (" %s\n", _("Print version information"));
|
||||
printf (" %s\n", "-v, --variable=STRING");
|
||||
printf (" %s\n\n", _("Variable to check"));
|
||||
printf ("%s\n", _("Valid variables are:"));
|
||||
printf (" %s", "CLIENTVERSION =");
|
||||
printf (" %s\n", _("Get the NSClient version"));
|
||||
printf (" %s\n", _("If -l <version> is specified, will return warning if versions differ."));
|
||||
printf (" %s\n", "CPULOAD =");
|
||||
printf (" %s\n", _("Average CPU load on last x minutes."));
|
||||
printf (" %s\n", _("Request a -l parameter with the following syntax:"));
|
||||
printf (" %s\n", _("-l <minutes range>,<warning threshold>,<critical threshold>."));
|
||||
printf (" %s\n", _("<minute range> should be less than 24*60."));
|
||||
printf (" %s\n", _("Thresholds are percentage and up to 10 requests can be done in one shot."));
|
||||
printf (" %s\n", "ie: -l 60,90,95,120,90,95");
|
||||
printf (" %s\n", "UPTIME =");
|
||||
printf (" %s\n", _("Get the uptime of the machine."));
|
||||
printf (" %s\n", _("No specific parameters. No warning or critical threshold"));
|
||||
printf (" %s\n", "USEDDISKSPACE =");
|
||||
printf (" %s\n", _("Size and percentage of disk use."));
|
||||
printf (" %s\n", _("Request a -l parameter containing the drive letter only."));
|
||||
printf (" %s\n", _("Warning and critical thresholds can be specified with -w and -c."));
|
||||
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", _("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>,..."));
|
||||
printf (" %s\n", _("You can specify -d SHOWALL in case you want to see working services"));
|
||||
printf (" %s\n", _("in the returned string."));
|
||||
printf (" %s\n", "PROCSTATE =");
|
||||
printf (" %s\n", _("Check if one or several process are running."));
|
||||
printf (" %s\n", _("Same syntax as SERVICESTATE."));
|
||||
printf (" %s\n", "COUNTER =");
|
||||
printf (" %s\n", _("Check any performance counter of Windows NT/2000."));
|
||||
printf (" %s\n", _("Request a -l parameters with the following syntax:"));
|
||||
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", _("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", "\"%%.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 (_(UT_HELP_VRSN));
|
||||
printf (_(UT_EXTRA_OPTS));
|
||||
|
||||
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", _("- 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", _("Options:"));
|
||||
printf (" %s\n", "-H, --hostname=HOST");
|
||||
printf (" %s\n", _("Name of the host to check"));
|
||||
printf (" %s\n", "-p, --port=INTEGER");
|
||||
printf (" %s", _("Optional port number (default: "));
|
||||
printf ("%d)\n", PORT);
|
||||
printf (" %s\n", "-s, --secret=<password>");
|
||||
printf (" %s\n", _("Password needed for the request"));
|
||||
printf (" %s\n", "-w, --warning=INTEGER");
|
||||
printf (" %s\n", _("Threshold which will result in a warning status"));
|
||||
printf (" %s\n", "-c, --critical=INTEGER");
|
||||
printf (" %s\n", _("Threshold which will result in a critical status"));
|
||||
printf (" %s\n", "-t, --timeout=INTEGER");
|
||||
printf (" %s", _("Seconds before connection attempt times out (default: "));
|
||||
printf (" %s\n", "-l, --params=<parameters>");
|
||||
printf (" %s", _("Parameters passed to specified check (see below)"));
|
||||
printf (" %s\n", "-d, --display={SHOWALL}");
|
||||
printf (" %s", _("Display options (currently only SHOWALL works)"));
|
||||
printf (" %s\n", "-u, --unknown-timeout");
|
||||
printf (" %s", _("Return UNKNOWN on timeouts"));
|
||||
printf ("%d)\n", DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (" %s\n", "-h, --help");
|
||||
printf (" %s\n", _("Print this help screen"));
|
||||
printf (" %s\n", "-V, --version");
|
||||
printf (" %s\n", _("Print version information"));
|
||||
printf (" %s\n", "-v, --variable=STRING");
|
||||
printf (" %s\n\n", _("Variable to check"));
|
||||
printf ("%s\n", _("Valid variables are:"));
|
||||
printf (" %s", "CLIENTVERSION =");
|
||||
printf (" %s\n", _("Get the NSClient version"));
|
||||
printf (" %s\n", _("If -l <version> is specified, will return warning if versions differ."));
|
||||
printf (" %s\n", "CPULOAD =");
|
||||
printf (" %s\n", _("Average CPU load on last x minutes."));
|
||||
printf (" %s\n", _("Request a -l parameter with the following syntax:"));
|
||||
printf (" %s\n", _("-l <minutes range>,<warning threshold>,<critical threshold>."));
|
||||
printf (" %s\n", _("<minute range> should be less than 24*60."));
|
||||
printf (" %s\n", _("Thresholds are percentage and up to 10 requests can be done in one shot."));
|
||||
printf (" %s\n", "ie: -l 60,90,95,120,90,95");
|
||||
printf (" %s\n", "UPTIME =");
|
||||
printf (" %s\n", _("Get the uptime of the machine."));
|
||||
printf (" %s\n", _("No specific parameters. No warning or critical threshold"));
|
||||
printf (" %s\n", "USEDDISKSPACE =");
|
||||
printf (" %s\n", _("Size and percentage of disk use."));
|
||||
printf (" %s\n", _("Request a -l parameter containing the drive letter only."));
|
||||
printf (" %s\n", _("Warning and critical thresholds can be specified with -w and -c."));
|
||||
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", _("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>,..."));
|
||||
printf (" %s\n", _("You can specify -d SHOWALL in case you want to see working services"));
|
||||
printf (" %s\n", _("in the returned string."));
|
||||
printf (" %s\n", "PROCSTATE =");
|
||||
printf (" %s\n", _("Check if one or several process are running."));
|
||||
printf (" %s\n", _("Same syntax as SERVICESTATE."));
|
||||
printf (" %s\n", "COUNTER =");
|
||||
printf (" %s\n", _("Check any performance counter of Windows NT/2000."));
|
||||
printf (" %s\n", _("Request a -l parameters with the following syntax:"));
|
||||
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", _("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", "\"%%.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", _("- 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."));
|
||||
#ifdef NP_EXTRA_OPTS
|
||||
printf (" -%s", _(UT_EXTRA_OPTS_NOTES));
|
||||
printf (" -%s", _(UT_EXTRA_OPTS_NOTES));
|
||||
#endif
|
||||
|
||||
printf (_(UT_SUPPORT));
|
||||
printf (_(UT_SUPPORT));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void print_usage(void)
|
||||
{
|
||||
printf (_("Usage:"));
|
||||
printf ("%s -H host -v variable [-p port] [-w warning] [-c critical]",progname);
|
||||
printf ("[-l params] [-d SHOWALL] [-t timeout]\n");
|
||||
printf (_("Usage:"));
|
||||
printf ("%s -H host -v variable [-p port] [-w warning] [-c critical]\n",progname);
|
||||
printf ("[-l params] [-d SHOWALL] [-u] [-t timeout]\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
* 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
|
||||
|
@ -29,12 +27,10 @@
|
|||
* 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_ntp.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_ntp";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "2006-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -80,7 +76,7 @@ typedef struct {
|
|||
|
||||
/* this structure holds data about results from querying offset from a peer */
|
||||
typedef struct {
|
||||
time_t waiting; /* ts set when we started waiting for a response */
|
||||
time_t waiting; /* ts set when we started waiting for a response */
|
||||
int num_responses; /* number of successfully recieved responses */
|
||||
uint8_t stratum; /* copied verbatim from the ntp_message */
|
||||
double rtdelay; /* converted from the ntp_message */
|
||||
|
@ -150,7 +146,7 @@ typedef struct {
|
|||
they are divided into halves, each being a 16-bit int in network byte order:
|
||||
- the first 16 bits are an int on the left side of a decimal point.
|
||||
- the second 16 bits represent a fraction n/(2^16)
|
||||
likewise for the 64-bit "fixed point" numbers with everything doubled :)
|
||||
likewise for the 64-bit "fixed point" numbers with everything doubled :)
|
||||
**/
|
||||
|
||||
/* macros to access the left/right 16 bits of a 32-bit ntp "fixed point"
|
||||
|
@ -198,7 +194,7 @@ typedef struct {
|
|||
/* NTP control message header is 12 bytes, plus any data in the data
|
||||
* field, plus null padding to the nearest 32-bit boundary per rfc.
|
||||
*/
|
||||
#define SIZEOF_NTPCM(m) (12+ntohs(m.count)+((m.count)?4-(ntohs(m.count)%4):0))
|
||||
#define SIZEOF_NTPCM(m) (12+ntohs(m.count)+((ntohs(m.count)%4)?4-(ntohs(m.count)%4):0))
|
||||
|
||||
/* finally, a little helper or two for debugging: */
|
||||
#define DBG(x) do{if(verbose>1){ x; }}while(0);
|
||||
|
@ -265,7 +261,7 @@ void print_ntp_control_message(const ntp_control_message *p){
|
|||
if(p->op&REM_RESP && p->op&OP_READSTAT){
|
||||
peer=(ntp_assoc_status_pair*)p->data;
|
||||
for(i=0;i<numpeers;i++){
|
||||
printf("\tpeer id %.2x status %.2x",
|
||||
printf("\tpeer id %.2x status %.2x",
|
||||
ntohs(peer[i].assoc), ntohs(peer[i].status));
|
||||
if (PEER_SEL(peer[i].status) >= PEER_INCLUDED){
|
||||
if(PEER_SEL(peer[i].status) >= PEER_SYNCSOURCE){
|
||||
|
@ -353,7 +349,7 @@ int best_offset_server(const ntp_server_results *slist, int nservers){
|
|||
|
||||
/* do everything we need to get the total average offset
|
||||
* - we use a certain amount of parallelization with poll() to ensure
|
||||
* we don't waste time sitting around waiting for single packets.
|
||||
* we don't waste time sitting around waiting for single packets.
|
||||
* - we also "manually" handle resolving host names and connecting, because
|
||||
* we have to do it in a way that our lazy macros don't handle currently :( */
|
||||
double offset_request(const char *host, int *status){
|
||||
|
@ -667,7 +663,7 @@ int process_arguments(int argc, char **argv){
|
|||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (argc < 2)
|
||||
usage ("\n");
|
||||
|
||||
|
@ -682,7 +678,7 @@ int process_arguments(int argc, char **argv){
|
|||
exit(STATE_OK);
|
||||
break;
|
||||
case 'V':
|
||||
print_revision(progname, revision);
|
||||
print_revision(progname, NP_VERSION);
|
||||
exit(STATE_OK);
|
||||
break;
|
||||
case 'v':
|
||||
|
@ -836,7 +832,7 @@ int main(int argc, char *argv[]){
|
|||
|
||||
|
||||
void print_help(void){
|
||||
print_revision(progname, revision);
|
||||
print_revision(progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 2006 Sean Finney\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
* 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
|
||||
|
@ -34,12 +32,10 @@
|
|||
* 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_ntp_peer.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_ntp_peer";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "2006-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -48,6 +44,7 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
|||
#include "utils.h"
|
||||
|
||||
static char *server_address=NULL;
|
||||
static int port=123;
|
||||
static int verbose=0;
|
||||
static int quiet=0;
|
||||
static short do_offset=0;
|
||||
|
@ -130,7 +127,7 @@ typedef struct {
|
|||
/* NTP control message header is 12 bytes, plus any data in the data
|
||||
* field, plus null padding to the nearest 32-bit boundary per rfc.
|
||||
*/
|
||||
#define SIZEOF_NTPCM(m) (12+ntohs(m.count)+((m.count)?4-(ntohs(m.count)%4):0))
|
||||
#define SIZEOF_NTPCM(m) (12+ntohs(m.count)+((ntohs(m.count)%4)?4-(ntohs(m.count)%4):0))
|
||||
|
||||
/* finally, a little helper or two for debugging: */
|
||||
#define DBG(x) do{if(verbose>1){ x; }}while(0);
|
||||
|
@ -161,7 +158,7 @@ void print_ntp_control_message(const ntp_control_message *p){
|
|||
if(p->op&REM_RESP && p->op&OP_READSTAT){
|
||||
peer=(ntp_assoc_status_pair*)p->data;
|
||||
for(i=0;i<numpeers;i++){
|
||||
printf("\tpeer id %.2x status %.2x",
|
||||
printf("\tpeer id %.2x status %.2x",
|
||||
ntohs(peer[i].assoc), ntohs(peer[i].status));
|
||||
if (PEER_SEL(peer[i].status) >= PEER_INCLUDED){
|
||||
if(PEER_SEL(peer[i].status) >= PEER_SYNCSOURCE){
|
||||
|
@ -175,27 +172,6 @@ void print_ntp_control_message(const ntp_control_message *p){
|
|||
}
|
||||
}
|
||||
|
||||
char *extract_value(const char *varlist, const char *name){
|
||||
char *tmpvarlist=NULL, *tmpkey=NULL, *value=NULL;
|
||||
int last=0;
|
||||
|
||||
/* The following code require a non-empty varlist */
|
||||
if(strlen(varlist) == 0)
|
||||
return NULL;
|
||||
|
||||
tmpvarlist = strdup(varlist);
|
||||
tmpkey = strtok(tmpvarlist, "=");
|
||||
|
||||
do {
|
||||
if(strstr(tmpkey, name) != NULL) {
|
||||
value = strtok(NULL, ",");
|
||||
last = 1;
|
||||
}
|
||||
} while (last == 0 && (tmpkey = strtok(NULL, "=")));
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
void
|
||||
setup_control_request(ntp_control_message *p, uint8_t opcode, uint16_t seq){
|
||||
memset(p, 0, sizeof(ntp_control_message));
|
||||
|
@ -250,7 +226,7 @@ int ntp_request(const char *host, double *offset, int *offset_result, double *ji
|
|||
* 4) Extract the offset, jitter and stratum value from the data[]
|
||||
* (it's ASCII)
|
||||
*/
|
||||
my_udp_connect(server_address, 123, &conn);
|
||||
my_udp_connect(server_address, port, &conn);
|
||||
|
||||
/* keep sending requests until the server stops setting the
|
||||
* REM_MORE bit, though usually this is only 1 packet. */
|
||||
|
@ -265,6 +241,9 @@ 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));
|
||||
/* discard obviously invalid packets */
|
||||
if (ntohs(req.count) > MAX_CM_SIZE)
|
||||
die(STATE_CRITICAL, "NTP CRITICAL: Invalid packet received from NTP server\n");
|
||||
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.
|
||||
|
@ -354,7 +333,7 @@ int ntp_request(const char *host, double *offset, int *offset_result, double *ji
|
|||
if(verbose)
|
||||
printf("parsing offset from peer %.2x: ", ntohs(peers[i].assoc));
|
||||
|
||||
value = extract_value(data, "offset");
|
||||
value = np_extract_ntpvar(data, "offset");
|
||||
nptr=NULL;
|
||||
/* Convert the value if we have one */
|
||||
if(value != NULL)
|
||||
|
@ -378,7 +357,7 @@ int ntp_request(const char *host, double *offset, int *offset_result, double *ji
|
|||
if(verbose) {
|
||||
printf("parsing %s from peer %.2x: ", strstr(getvar, "dispersion") != NULL ? "dispersion" : "jitter", ntohs(peers[i].assoc));
|
||||
}
|
||||
value = extract_value(data, strstr(getvar, "dispersion") != NULL ? "dispersion" : "jitter");
|
||||
value = np_extract_ntpvar(data, strstr(getvar, "dispersion") != NULL ? "dispersion" : "jitter");
|
||||
nptr=NULL;
|
||||
/* Convert the value if we have one */
|
||||
if(value != NULL)
|
||||
|
@ -397,7 +376,7 @@ int ntp_request(const char *host, double *offset, int *offset_result, double *ji
|
|||
if(verbose) {
|
||||
printf("parsing stratum from peer %.2x: ", ntohs(peers[i].assoc));
|
||||
}
|
||||
value = extract_value(data, "stratum");
|
||||
value = np_extract_ntpvar(data, "stratum");
|
||||
nptr=NULL;
|
||||
/* Convert the value if we have one */
|
||||
if(value != NULL)
|
||||
|
@ -436,15 +415,16 @@ int process_arguments(int argc, char **argv){
|
|||
{"jcrit", required_argument, 0, 'k'},
|
||||
{"timeout", required_argument, 0, 't'},
|
||||
{"hostname", required_argument, 0, 'H'},
|
||||
{"port", required_argument, 0, 'p'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (argc < 2)
|
||||
usage ("\n");
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "Vhv46qw:c:W:C:j:k:t:H:", longopts, &option);
|
||||
c = getopt_long (argc, argv, "Vhv46qw:c:W:C:j:k:t:H:p:", longopts, &option);
|
||||
if (c == -1 || c == EOF || c == 1)
|
||||
break;
|
||||
|
||||
|
@ -454,7 +434,7 @@ int process_arguments(int argc, char **argv){
|
|||
exit(STATE_OK);
|
||||
break;
|
||||
case 'V':
|
||||
print_revision(progname, revision);
|
||||
print_revision(progname, NP_VERSION);
|
||||
exit(STATE_OK);
|
||||
break;
|
||||
case 'v':
|
||||
|
@ -492,6 +472,9 @@ int process_arguments(int argc, char **argv){
|
|||
usage2(_("Invalid hostname/address"), optarg);
|
||||
server_address = strdup(optarg);
|
||||
break;
|
||||
case 'p':
|
||||
port=atoi(optarg);
|
||||
break;
|
||||
case 't':
|
||||
socket_timeout=atoi(optarg);
|
||||
break;
|
||||
|
@ -630,7 +613,7 @@ int main(int argc, char *argv[]){
|
|||
|
||||
|
||||
void print_help(void){
|
||||
print_revision(progname, revision);
|
||||
print_revision(progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 2006 Sean Finney\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
* 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
|
||||
|
@ -33,12 +31,10 @@
|
|||
* 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_ntp_time.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_ntp_time";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "2006-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -47,6 +43,7 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
|||
#include "utils.h"
|
||||
|
||||
static char *server_address=NULL;
|
||||
static char *port="123";
|
||||
static int verbose=0;
|
||||
static int quiet=0;
|
||||
static char *owarn="60";
|
||||
|
@ -80,7 +77,7 @@ typedef struct {
|
|||
|
||||
/* this structure holds data about results from querying offset from a peer */
|
||||
typedef struct {
|
||||
time_t waiting; /* ts set when we started waiting for a response */
|
||||
time_t waiting; /* ts set when we started waiting for a response */
|
||||
int num_responses; /* number of successfully recieved responses */
|
||||
uint8_t stratum; /* copied verbatim from the ntp_message */
|
||||
double rtdelay; /* converted from the ntp_message */
|
||||
|
@ -131,7 +128,7 @@ typedef struct {
|
|||
they are divided into halves, each being a 16-bit int in network byte order:
|
||||
- the first 16 bits are an int on the left side of a decimal point.
|
||||
- the second 16 bits represent a fraction n/(2^16)
|
||||
likewise for the 64-bit "fixed point" numbers with everything doubled :)
|
||||
likewise for the 64-bit "fixed point" numbers with everything doubled :)
|
||||
**/
|
||||
|
||||
/* macros to access the left/right 16 bits of a 32-bit ntp "fixed point"
|
||||
|
@ -298,7 +295,7 @@ int best_offset_server(const ntp_server_results *slist, int nservers){
|
|||
|
||||
/* do everything we need to get the total average offset
|
||||
* - we use a certain amount of parallelization with poll() to ensure
|
||||
* we don't waste time sitting around waiting for single packets.
|
||||
* we don't waste time sitting around waiting for single packets.
|
||||
* - we also "manually" handle resolving host names and connecting, because
|
||||
* we have to do it in a way that our lazy macros don't handle currently :( */
|
||||
double offset_request(const char *host, int *status){
|
||||
|
@ -319,7 +316,7 @@ double offset_request(const char *host, int *status){
|
|||
hints.ai_socktype = SOCK_DGRAM;
|
||||
|
||||
/* fill in ai with the list of hosts resolved by the host name */
|
||||
ga_result = getaddrinfo(host, "123", &hints, &ai);
|
||||
ga_result = getaddrinfo(host, port, &hints, &ai);
|
||||
if(ga_result!=0){
|
||||
die(STATE_UNKNOWN, "error getting address for %s: %s\n",
|
||||
host, gai_strerror(ga_result));
|
||||
|
@ -456,15 +453,16 @@ int process_arguments(int argc, char **argv){
|
|||
{"critical", required_argument, 0, 'c'},
|
||||
{"timeout", required_argument, 0, 't'},
|
||||
{"hostname", required_argument, 0, 'H'},
|
||||
{"port", required_argument, 0, 'p'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (argc < 2)
|
||||
usage ("\n");
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "Vhv46qw:c:t:H:", longopts, &option);
|
||||
c = getopt_long (argc, argv, "Vhv46qw:c:t:H:p:", longopts, &option);
|
||||
if (c == -1 || c == EOF || c == 1)
|
||||
break;
|
||||
|
||||
|
@ -474,7 +472,7 @@ int process_arguments(int argc, char **argv){
|
|||
exit(STATE_OK);
|
||||
break;
|
||||
case 'V':
|
||||
print_revision(progname, revision);
|
||||
print_revision(progname, NP_VERSION);
|
||||
exit(STATE_OK);
|
||||
break;
|
||||
case 'v':
|
||||
|
@ -494,6 +492,9 @@ int process_arguments(int argc, char **argv){
|
|||
usage2(_("Invalid hostname/address"), optarg);
|
||||
server_address = strdup(optarg);
|
||||
break;
|
||||
case 'p':
|
||||
port = strdup(optarg);
|
||||
break;
|
||||
case 't':
|
||||
socket_timeout=atoi(optarg);
|
||||
break;
|
||||
|
@ -589,7 +590,7 @@ int main(int argc, char *argv[]){
|
|||
}
|
||||
|
||||
void print_help(void){
|
||||
print_revision(progname, revision);
|
||||
print_revision(progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 2006 Sean Finney\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* 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
|
||||
|
@ -28,12 +26,10 @@
|
|||
* 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_nwstat.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_nwstat";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -203,7 +199,7 @@ main(int argc, char **argv) {
|
|||
|
||||
/* check CPU load */
|
||||
if (vars_to_check==LOAD1 || vars_to_check==LOAD5 || vars_to_check==LOAD15) {
|
||||
|
||||
|
||||
switch(vars_to_check) {
|
||||
case LOAD1:
|
||||
temp_buffer = strdup ("1");
|
||||
|
@ -249,7 +245,7 @@ main(int argc, char **argv) {
|
|||
temp_buffer,
|
||||
utilization,
|
||||
warning_value,
|
||||
critical_value);
|
||||
critical_value);
|
||||
|
||||
/* check number of user connections */
|
||||
} else if (vars_to_check==CONNS) {
|
||||
|
@ -457,7 +453,7 @@ main(int argc, char **argv) {
|
|||
critical_value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* check % free space on volume */
|
||||
} else if (vars_to_check==VPF) {
|
||||
|
||||
|
@ -568,11 +564,11 @@ main(int argc, char **argv) {
|
|||
result=STATE_WARNING;
|
||||
asprintf (&output_message,_("Warning - NRM Status is suspect!"));
|
||||
}
|
||||
|
||||
|
||||
asprintf (&output_message,_("OK - NRM Status is good!"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* check packet receive buffers */
|
||||
} else if (vars_to_check==UPRB || vars_to_check==PUPRB) {
|
||||
|
@ -827,7 +823,7 @@ main(int argc, char **argv) {
|
|||
open_files,
|
||||
warning_value,
|
||||
critical_value);
|
||||
|
||||
|
||||
|
||||
/* check # of abended threads (Netware > 5.x only) */
|
||||
} else if (vars_to_check==ABENDS) {
|
||||
|
@ -914,7 +910,7 @@ main(int argc, char **argv) {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
/* check LRU sitting time in secondss */
|
||||
} else if (vars_to_check==LRUS) {
|
||||
|
||||
|
@ -977,7 +973,7 @@ main(int argc, char **argv) {
|
|||
total_cache_buffers,
|
||||
warning_value,
|
||||
critical_value);
|
||||
|
||||
|
||||
} else if (vars_to_check==DSVER) {
|
||||
|
||||
close(sd);
|
||||
|
@ -1005,7 +1001,7 @@ main(int argc, char **argv) {
|
|||
|
||||
recv_buffer[sizeof(recv_buffer)-1]=0;
|
||||
recv_buffer[strlen(recv_buffer)-1]=0;
|
||||
|
||||
|
||||
asprintf (&output_message,_("Up %s"),recv_buffer);
|
||||
|
||||
} else if (vars_to_check==NLM) {
|
||||
|
@ -1024,7 +1020,7 @@ main(int argc, char **argv) {
|
|||
} else {
|
||||
result=STATE_CRITICAL;
|
||||
asprintf (&output_message,_("Module %s is not loaded"),nlm_name);
|
||||
|
||||
|
||||
}
|
||||
} else if (vars_to_check==NRMP) {
|
||||
|
||||
|
@ -1313,7 +1309,7 @@ int process_arguments(int argc, char **argv) {
|
|||
|
||||
int option = 0;
|
||||
static struct option longopts[] =
|
||||
{
|
||||
{
|
||||
{"port", required_argument,0,'p'},
|
||||
{"timeout", required_argument,0,'t'},
|
||||
{"critical", required_argument,0,'c'},
|
||||
|
@ -1360,7 +1356,7 @@ int process_arguments(int argc, char **argv) {
|
|||
print_help();
|
||||
exit(STATE_OK);
|
||||
case 'V': /* version */
|
||||
print_revision(progname, revision);
|
||||
print_revision(progname, NP_VERSION);
|
||||
exit(STATE_OK);
|
||||
case 'H': /* hostname */
|
||||
server_address=optarg;
|
||||
|
@ -1498,7 +1494,7 @@ int process_arguments(int argc, char **argv) {
|
|||
nrmm_name = strdup (optarg+4);
|
||||
if (!strcmp(nrmm_name,""))
|
||||
nrmm_name = strdup ("AVAILABLE_CACHE_MEMORY");
|
||||
|
||||
|
||||
}
|
||||
|
||||
else if (strncmp(optarg,"NRMS",4)==0) {
|
||||
|
@ -1506,7 +1502,7 @@ int process_arguments(int argc, char **argv) {
|
|||
nrms_name = strdup (optarg+4);
|
||||
if (!strcmp(nrms_name,""))
|
||||
nrms_name = strdup ("USED_SWAP_SPACE");
|
||||
|
||||
|
||||
}
|
||||
|
||||
else if (strncmp(optarg,"NSS1",4)==0) {
|
||||
|
@ -1514,7 +1510,7 @@ int process_arguments(int argc, char **argv) {
|
|||
nss1_name = strdup (optarg+4);
|
||||
if (!strcmp(nss1_name,""))
|
||||
nss1_name = strdup ("CURRENTBUFFERCACHESIZE");
|
||||
|
||||
|
||||
}
|
||||
|
||||
else if (strncmp(optarg,"NSS2",4)==0) {
|
||||
|
@ -1522,7 +1518,7 @@ int process_arguments(int argc, char **argv) {
|
|||
nss2_name = strdup (optarg+4);
|
||||
if (!strcmp(nss2_name,""))
|
||||
nss2_name = strdup ("CACHEHITS");
|
||||
|
||||
|
||||
}
|
||||
|
||||
else if (strncmp(optarg,"NSS3",4)==0) {
|
||||
|
@ -1530,7 +1526,7 @@ int process_arguments(int argc, char **argv) {
|
|||
nss3_name = strdup (optarg+4);
|
||||
if (!strcmp(nss3_name,""))
|
||||
nss3_name = strdup ("CACHEGITPERCENT");
|
||||
|
||||
|
||||
}
|
||||
|
||||
else if (strncmp(optarg,"NSS4",4)==0) {
|
||||
|
@ -1538,7 +1534,7 @@ int process_arguments(int argc, char **argv) {
|
|||
nss4_name = strdup (optarg+4);
|
||||
if (!strcmp(nss4_name,""))
|
||||
nss4_name = strdup ("CURRENTOPENCOUNT");
|
||||
|
||||
|
||||
}
|
||||
|
||||
else if (strncmp(optarg,"NSS5",4)==0) {
|
||||
|
@ -1546,7 +1542,7 @@ int process_arguments(int argc, char **argv) {
|
|||
nss5_name = strdup (optarg+4);
|
||||
if (!strcmp(nss5_name,""))
|
||||
nss5_name = strdup ("CACHEMISSES");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1555,7 +1551,7 @@ int process_arguments(int argc, char **argv) {
|
|||
nss6_name = strdup (optarg+4);
|
||||
if (!strcmp(nss6_name,""))
|
||||
nss6_name = strdup ("PENDINGWORKSCOUNT");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1564,7 +1560,7 @@ int process_arguments(int argc, char **argv) {
|
|||
nss7_name = strdup (optarg+4);
|
||||
if (!strcmp(nss7_name,""))
|
||||
nss7_name = strdup ("CACHESIZE");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1597,7 +1593,7 @@ void print_help(void)
|
|||
char *myport;
|
||||
asprintf (&myport, "%d", PORT);
|
||||
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* 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_overcr plugin
|
||||
|
@ -28,12 +26,10 @@
|
|||
* 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_overcr.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_overcr";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -346,7 +342,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'H': /* hostname */
|
||||
server_address = optarg;
|
||||
|
@ -415,7 +411,7 @@ print_help (void)
|
|||
char *myport;
|
||||
asprintf (&myport, "%d", PORT);
|
||||
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* License: GPL
|
||||
* 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
|
||||
|
@ -27,12 +25,10 @@
|
|||
* 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_pgsql.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_pgsql";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "1999-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -71,6 +67,7 @@ char *pguser = NULL;
|
|||
char *pgpasswd = NULL;
|
||||
double twarn = (double)DEFAULT_WARN;
|
||||
double tcrit = (double)DEFAULT_CRIT;
|
||||
int verbose = 0;
|
||||
|
||||
PGconn *conn;
|
||||
/*PGresult *res;*/
|
||||
|
@ -155,6 +152,8 @@ main (int argc, char **argv)
|
|||
|
||||
if (process_arguments (argc, argv) == ERROR)
|
||||
usage4 (_("Could not parse arguments"));
|
||||
if (verbose > 2)
|
||||
printf("Arguments initialized\n");
|
||||
|
||||
/* Set signal handling and alarm */
|
||||
if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) {
|
||||
|
@ -162,14 +161,24 @@ main (int argc, char **argv)
|
|||
}
|
||||
alarm (timeout_interval);
|
||||
|
||||
if (verbose)
|
||||
printf("Connecting to database:\n DB: %s\n User: %s\n Host: %s\n Port: %d\n", dbName,
|
||||
(pguser != NULL) ? pguser : "unspecified",
|
||||
(pghost != NULL) ? pghost : "unspecified",
|
||||
(pgport != NULL) ? atoi(pgport) : DEFAULT_PORT);
|
||||
|
||||
/* make a connection to the database */
|
||||
time (&start_time);
|
||||
conn =
|
||||
PQsetdbLogin (pghost, pgport, pgoptions, pgtty, dbName, pguser, pgpasswd);
|
||||
time (&end_time);
|
||||
elapsed_time = (int) (end_time - start_time);
|
||||
if (verbose)
|
||||
printf("Time elapsed: %d\n", elapsed_time);
|
||||
|
||||
/* check to see that the backend connection was successfully made */
|
||||
if (verbose)
|
||||
printf("Verifying connection\n");
|
||||
if (PQstatus (conn) == CONNECTION_BAD) {
|
||||
printf (_("CRITICAL - no connection to '%s' (%s).\n"),
|
||||
dbName, PQerrorMessage (conn));
|
||||
|
@ -185,8 +194,10 @@ main (int argc, char **argv)
|
|||
else {
|
||||
status = STATE_OK;
|
||||
}
|
||||
if (verbose)
|
||||
printf("Closing connection\n");
|
||||
PQfinish (conn);
|
||||
printf (_(" %s - database %s (%d sec.)|%s\n"),
|
||||
printf (_(" %s - database %s (%d sec.)|%s\n"),
|
||||
state_text(status), dbName, elapsed_time,
|
||||
fperfdata("time", elapsed_time, "s",
|
||||
(int)twarn, twarn, (int)tcrit, tcrit, TRUE, 0, FALSE,0));
|
||||
|
@ -214,11 +225,12 @@ process_arguments (int argc, char **argv)
|
|||
{"authorization", required_argument, 0, 'a'},
|
||||
{"port", required_argument, 0, 'P'},
|
||||
{"database", required_argument, 0, 'd'},
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "hVt:c:w:H:P:d:l:p:a:",
|
||||
c = getopt_long (argc, argv, "hVt:c:w:H:P:d:l:p:a:v",
|
||||
longopts, &option);
|
||||
|
||||
if (c == EOF)
|
||||
|
@ -231,7 +243,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 't': /* timeout period */
|
||||
if (!is_integer (optarg))
|
||||
|
@ -279,6 +291,9 @@ process_arguments (int argc, char **argv)
|
|||
case 'a':
|
||||
pgpasswd = optarg;
|
||||
break;
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -355,7 +370,7 @@ is_pg_dbname (char *dbname)
|
|||
|
||||
/**
|
||||
|
||||
the tango program should eventually create an entity here based on the
|
||||
the tango program should eventually create an entity here based on the
|
||||
function prototype
|
||||
|
||||
@@-
|
||||
|
@ -389,7 +404,7 @@ is_pg_logname (char *username)
|
|||
|
||||
/******************************************************************************
|
||||
@@-
|
||||
</sect2>
|
||||
</sect2>
|
||||
</sect1>
|
||||
</article>
|
||||
-@@
|
||||
|
@ -404,13 +419,13 @@ print_help (void)
|
|||
|
||||
asprintf (&myport, "%d", DEFAULT_PORT);
|
||||
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
||||
printf (_("Test whether a PostgreSQL Database is accepting connections."));
|
||||
|
||||
printf ("\n\n");
|
||||
printf ("\n\n");
|
||||
|
||||
print_usage ();
|
||||
|
||||
|
@ -422,12 +437,12 @@ print_help (void)
|
|||
printf (_(UT_IPv46));
|
||||
|
||||
printf (" %s\n", "-d, --database=STRING");
|
||||
printf (" %s", _("Database to check "));
|
||||
printf (_("(default: %s)"), DEFAULT_DB);
|
||||
printf (" %s\n", "-l, --logname = STRING");
|
||||
printf (" %s\n", _("Login name of user"));
|
||||
printf (" %s\n", "-p, --password = STRING");
|
||||
printf (" %s\n", _("Password (BIG SECURITY ISSUE)"));
|
||||
printf (" %s", _("Database to check "));
|
||||
printf (_("(default: %s)"), DEFAULT_DB);
|
||||
printf (" %s\n", "-l, --logname = STRING");
|
||||
printf (" %s\n", _("Login name of user"));
|
||||
printf (" %s\n", "-p, --password = STRING");
|
||||
printf (" %s\n", _("Password (BIG SECURITY ISSUE)"));
|
||||
|
||||
printf (_(UT_WARN_CRIT));
|
||||
|
||||
|
@ -435,26 +450,26 @@ print_help (void)
|
|||
|
||||
printf (_(UT_VERBOSE));
|
||||
|
||||
printf ("\n");
|
||||
printf ("\n");
|
||||
printf (" %s\n", _("All parameters are optional."));
|
||||
printf (" %s\n", _("This plugin tests a PostgreSQL DBMS to determine whether it is active and"));
|
||||
printf (" %s\n", _("accepting queries. In its current operation, it simply connects to the"));
|
||||
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", _("This plugin tests a PostgreSQL DBMS to determine whether it is active and"));
|
||||
printf (" %s\n", _("accepting queries. In its current operation, it simply connects to the"));
|
||||
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", _("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."));
|
||||
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));
|
||||
printf ("\n");
|
||||
printf ("%s\n", _("Notes:"));
|
||||
printf (_(UT_EXTRA_OPTS_NOTES));
|
||||
#endif
|
||||
|
||||
printf (_(UT_SUPPORT));
|
||||
|
@ -465,7 +480,7 @@ print_help (void)
|
|||
void
|
||||
print_usage (void)
|
||||
{
|
||||
printf (_("Usage:"));
|
||||
printf (_("Usage:"));
|
||||
printf ("%s [-H <host>] [-P <port>] [-c <critical time>] [-w <warning time>]\n", progname);
|
||||
printf (" [-t <timeout>] [-d <database>] [-l <logname>] [-p <password>]\n");
|
||||
printf (" [-t <timeout>] [-d <database>] [-l <logname>] [-p <password>]\n");
|
||||
}
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* 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_ping plugin
|
||||
|
@ -27,12 +25,10 @@
|
|||
* 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_ping.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_ping";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -112,7 +108,7 @@ main (int argc, char **argv)
|
|||
#endif
|
||||
|
||||
for (i = 0 ; i < n_addresses ; i++) {
|
||||
|
||||
|
||||
#ifdef PING6_COMMAND
|
||||
if (address_family != AF_INET && is_inet6_addr(addresses[i]))
|
||||
rawcmd = strdup(PING6_COMMAND);
|
||||
|
@ -150,8 +146,8 @@ main (int argc, char **argv)
|
|||
else if (pl >= wpl || rta >= wrta)
|
||||
this_result = STATE_WARNING;
|
||||
else if (pl >= 0 && rta >= 0)
|
||||
this_result = max_state (STATE_OK, this_result);
|
||||
|
||||
this_result = max_state (STATE_OK, this_result);
|
||||
|
||||
if (n_addresses > 1 && this_result != STATE_UNKNOWN)
|
||||
die (STATE_OK, "%s is alive\n", addresses[i]);
|
||||
|
||||
|
@ -231,7 +227,7 @@ process_arguments (int argc, char **argv)
|
|||
exit (STATE_OK);
|
||||
break;
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
break;
|
||||
case 't': /* timeout period */
|
||||
|
@ -370,7 +366,7 @@ get_threshold (char *arg, float *trta, int *tpl)
|
|||
return OK;
|
||||
else if (strpbrk (arg, ",:") && strstr (arg, "%") && sscanf (arg, "%f%*[:,]%d%%", trta, tpl) == 2)
|
||||
return OK;
|
||||
else if (strstr (arg, "%") && sscanf (arg, "%d%%", tpl) == 1)
|
||||
else if (strstr (arg, "%") && sscanf (arg, "%d%%", tpl) == 1)
|
||||
return OK;
|
||||
|
||||
usage2 (_("%s: Warning threshold must be integer or percentage!\n\n"), arg);
|
||||
|
@ -555,7 +551,7 @@ error_scan (char buf[MAX_INPUT_BUFFER], const char *addr)
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* License: GPL
|
||||
* 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
|
||||
|
@ -30,19 +28,17 @@
|
|||
* 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: 1991 $";
|
||||
const char *copyright = "2000-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
#include "common.h"
|
||||
#include "popen.h"
|
||||
#include "utils.h"
|
||||
#include "utils_cmd.h"
|
||||
#include "regex.h"
|
||||
|
||||
#include <pwd.h>
|
||||
|
@ -129,8 +125,9 @@ main (int argc, char **argv)
|
|||
int expected_cols = PS_COLS - 1;
|
||||
int warn = 0; /* number of processes in warn state */
|
||||
int crit = 0; /* number of processes in crit state */
|
||||
int i = 0;
|
||||
int i = 0, j = 0;
|
||||
int result = STATE_UNKNOWN;
|
||||
output chld_out, chld_err;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
|
@ -153,41 +150,27 @@ main (int argc, char **argv)
|
|||
mypid = getpid();
|
||||
|
||||
/* Set signal handling and alarm timeout */
|
||||
if (signal (SIGALRM, popen_timeout_alarm_handler) == SIG_ERR) {
|
||||
usage4 (_("Cannot catch SIGALRM"));
|
||||
if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) {
|
||||
die (STATE_UNKNOWN, _("Cannot catch SIGALRM"));
|
||||
}
|
||||
alarm (timeout_interval);
|
||||
(void) alarm ((unsigned) timeout_interval);
|
||||
|
||||
if (verbose >= 2)
|
||||
printf (_("CMD: %s\n"), PS_COMMAND);
|
||||
|
||||
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;
|
||||
result = cmd_run( PS_COMMAND, &chld_out, &chld_err, 0);
|
||||
if (chld_err.lines > 0) {
|
||||
printf ("%s: %s", _("System call sent warnings to stderr"), chld_err.line[0]);
|
||||
exit(STATE_WARNING);
|
||||
}
|
||||
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 );
|
||||
}
|
||||
result = cmd_file_read( input_filename, &chld_out, 0);
|
||||
}
|
||||
|
||||
/* flush first line */
|
||||
fgets (input_buffer, MAX_INPUT_BUFFER - 1, ps_input);
|
||||
while ( input_buffer[strlen(input_buffer)-1] != '\n' )
|
||||
fgets (input_buffer, MAX_INPUT_BUFFER - 1, ps_input);
|
||||
|
||||
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, ps_input);
|
||||
asprintf (&input_line, "%s%s", input_line, input_buffer);
|
||||
}
|
||||
/* flush first line: j starts at 1 */
|
||||
for (j = 1; j < chld_out.lines; j++) {
|
||||
input_line = chld_out.line[j];
|
||||
|
||||
if (verbose >= 3)
|
||||
printf ("%s", input_line);
|
||||
|
@ -283,27 +266,9 @@ main (int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
/* If we get anything on STDERR, at least set warning */
|
||||
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);
|
||||
|
||||
/* 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 */
|
||||
printf (_("Unable to read output\n"));
|
||||
return result;
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
if ( result == STATE_UNKNOWN )
|
||||
|
@ -392,7 +357,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 't': /* timeout period */
|
||||
if (!is_integer (optarg))
|
||||
|
@ -705,7 +670,7 @@ convert_to_seconds(char *etime) {
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
@ -729,7 +694,7 @@ print_help (void)
|
|||
printf (" %s\n", _("PROCS - number of processes (default)"));
|
||||
printf (" %s\n", _("VSZ - virtual memory size"));
|
||||
printf (" %s\n", _("RSS - resident set memory size"));
|
||||
printf (" %s\n", _("CPU - percentage cpu"));
|
||||
printf (" %s\n", _("CPU - percentage CPU"));
|
||||
/* only linux etime is support currently */
|
||||
#if defined( __linux__ )
|
||||
printf (" %s\n", _("ELAPSED - time elapsed in seconds"));
|
||||
|
@ -748,11 +713,11 @@ print_help (void)
|
|||
printf (" %s\n", "-p, --ppid=PPID");
|
||||
printf (" %s\n", _("Only scan for children of the parent process ID indicated."));
|
||||
printf (" %s\n", "-z, --vsz=VSZ");
|
||||
printf (" %s\n", _("Only scan for processes with vsz higher than indicated."));
|
||||
printf (" %s\n", _("Only scan for processes with VSZ higher than indicated."));
|
||||
printf (" %s\n", "-r, --rss=RSS");
|
||||
printf (" %s\n", _("Only scan for processes with rss higher than indicated."));
|
||||
printf (" %s\n", _("Only scan for processes with RSS higher than indicated."));
|
||||
printf (" %s\n", "-P, --pcpu=PCPU");
|
||||
printf (" %s\n", _("Only scan for processes with pcpu higher than indicated."));
|
||||
printf (" %s\n", _("Only scan for processes with PCPU higher than indicated."));
|
||||
printf (" %s\n", "-u, --user=USER");
|
||||
printf (" %s\n", _("Only scan for processes with user name or ID indicated."));
|
||||
printf (" %s\n", "-a, --argument-array=STRING");
|
||||
|
@ -788,9 +753,9 @@ be the total number of running processes\n\n"));
|
|||
printf (" %s\n", _("Warning alert if > 10 processes with command arguments containing"));
|
||||
printf (" %s\n\n", _("'/usr/local/bin/perl' and owned by root"));
|
||||
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\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", _("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));
|
||||
}
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* License: GPL
|
||||
* 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
|
||||
|
@ -27,12 +25,10 @@
|
|||
* 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: 1994 $";
|
||||
const char *copyright = "2000-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -169,8 +165,8 @@ main (int argc, char **argv)
|
|||
(nasid==NULL || my_rc_avpair_add (&data.send_pairs, PW_NAS_IDENTIFIER, nasid, 0))))
|
||||
die (STATE_UNKNOWN, _("Out of Memory?"));
|
||||
|
||||
/*
|
||||
* Fill in NAS-IP-Address
|
||||
/*
|
||||
* Fill in NAS-IP-Address
|
||||
*/
|
||||
|
||||
if ((client_id = my_rc_own_ipaddress ()) == 0)
|
||||
|
@ -239,7 +235,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (OK);
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (OK);
|
||||
case 'v': /* verbose mode */
|
||||
verbose = TRUE;
|
||||
|
@ -312,12 +308,12 @@ print_help (void)
|
|||
char *myport;
|
||||
asprintf (&myport, "%d", PW_AUTH_UDP_PORT);
|
||||
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Robert August Vincent II\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
||||
printf("%s\n", _("Tests to see if a radius server is accepting connections."));
|
||||
printf("%s\n", _("Tests to see if a RADIUS server is accepting connections."));
|
||||
|
||||
printf ("\n\n");
|
||||
|
||||
|
@ -344,7 +340,7 @@ print_help (void)
|
|||
printf (_(UT_TIMEOUT), timeout_interval);
|
||||
|
||||
printf ("\n");
|
||||
printf ("%s\n", _("This plugin tests a radius server to see if it is accepting connections."));
|
||||
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."));
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* 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_real plugin
|
||||
|
@ -27,12 +25,10 @@
|
|||
* 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: 1991 $";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -361,7 +357,7 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
break;
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
|
@ -409,7 +405,7 @@ print_help (void)
|
|||
char *myport;
|
||||
asprintf (&myport, "%d", PORT);
|
||||
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Pedro Leite <leite@cic.ua.pt>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* 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_smtp plugin
|
||||
|
@ -27,12 +25,10 @@
|
|||
* 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: 1991 $";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -168,7 +164,7 @@ main (int argc, char **argv)
|
|||
|
||||
if (verbose && smtp_use_dummycmd)
|
||||
printf ("FROM CMD: %s", cmd_str);
|
||||
|
||||
|
||||
/* initialize alarm signal handling */
|
||||
(void) signal (SIGALRM, socket_timeout_alarm_handler);
|
||||
|
||||
|
@ -285,7 +281,7 @@ main (int argc, char **argv)
|
|||
# endif /* USE_OPENSSL */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* sendmail will syslog a "NOQUEUE" error if session does not attempt
|
||||
* to do something useful. This can be prevented by giving a command
|
||||
* even if syntax is illegal (MAIL requires a FROM:<...> argument)
|
||||
|
@ -293,7 +289,6 @@ main (int argc, char **argv)
|
|||
* According to rfc821 you can include a null reversepath in the from command
|
||||
* - but a log message is generated on the smtp server.
|
||||
*
|
||||
* You can disable sending mail_command with '--nocommand'
|
||||
* Use the -f option to provide a FROM address
|
||||
*/
|
||||
if (smtp_use_dummycmd) {
|
||||
|
@ -474,7 +469,6 @@ process_arguments (int argc, char **argv)
|
|||
{"authpass", required_argument, 0, 'P'},
|
||||
{"command", required_argument, 0, 'C'},
|
||||
{"response", required_argument, 0, 'R'},
|
||||
{"nocommand", required_argument, 0, 'n'},
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{"use-ipv4", no_argument, 0, '4'},
|
||||
|
@ -620,7 +614,7 @@ process_arguments (int argc, char **argv)
|
|||
#endif
|
||||
break;
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
|
@ -746,7 +740,7 @@ recvlines(char *buf, size_t bufsize)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
int
|
||||
my_close (void)
|
||||
{
|
||||
#ifdef HAVE_SSL
|
||||
|
@ -762,7 +756,7 @@ print_help (void)
|
|||
char *myport;
|
||||
asprintf (&myport, "%d", SMTP_PORT);
|
||||
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999-2001 Ethan Galstad <nagios@nagios.org>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
@ -782,8 +776,6 @@ print_help (void)
|
|||
|
||||
printf (" %s\n", "-e, --expect=STRING");
|
||||
printf (_(" String to expect in first line of server response (default: '%s')\n"), SMTP_EXPECT);
|
||||
printf (" %s\n", "-n, nocommand");
|
||||
printf (" %s\n", _("Suppress SMTP command"));
|
||||
printf (" %s\n", "-C, --command=STRING");
|
||||
printf (" %s\n", _("SMTP command (may be used repeatedly)"));
|
||||
printf (" %s\n", "-R, --command=STRING");
|
||||
|
@ -833,6 +825,6 @@ print_usage (void)
|
|||
printf (_("Usage:"));
|
||||
printf ("%s -H host [-p port] [-e expect] [-C command] [-f from addr]", progname);
|
||||
printf ("[-A authtype -U authuser -P authpass] [-w warn] [-c crit] [-t timeout]\n");
|
||||
printf ("[-S] [-D days] [-n] [-v] [-4|-6]\n");
|
||||
printf ("[-S] [-D days] [-v] [-4|-6]\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* License: GPL
|
||||
* 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
|
||||
|
@ -27,18 +25,16 @@
|
|||
* 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: 1991 $";
|
||||
const char *copyright = "1999-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
#include "common.h"
|
||||
#include "utils.h"
|
||||
#include "popen.h"
|
||||
#include "utils_cmd.h"
|
||||
|
||||
#define DEFAULT_COMMUNITY "public"
|
||||
#define DEFAULT_PORT "161"
|
||||
|
@ -47,6 +43,7 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
|||
#define DEFAULT_TIMEOUT 1
|
||||
#define DEFAULT_RETRIES 5
|
||||
#define DEFAULT_AUTH_PROTOCOL "MD5"
|
||||
#define DEFAULT_PRIV_PROTOCOL "DES"
|
||||
#define DEFAULT_DELIMITER "="
|
||||
#define DEFAULT_OUTPUT_DELIMITER " "
|
||||
|
||||
|
@ -56,33 +53,14 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
|||
#define CRIT_PRESENT 1
|
||||
#define CRIT_STRING 2
|
||||
#define CRIT_REGEX 4
|
||||
#define CRIT_GT 8
|
||||
#define CRIT_LT 16
|
||||
#define CRIT_GE 32
|
||||
#define CRIT_LE 64
|
||||
#define CRIT_EQ 128
|
||||
#define CRIT_NE 256
|
||||
#define CRIT_RANGE 512
|
||||
#define WARN_PRESENT 1024
|
||||
#define WARN_STRING 2048
|
||||
#define WARN_REGEX 4096
|
||||
#define WARN_GT 8192
|
||||
#define WARN_LT 16384
|
||||
#define WARN_GE 32768
|
||||
#define WARN_LE 65536
|
||||
#define WARN_EQ 131072
|
||||
#define WARN_NE 262144
|
||||
#define WARN_RANGE 524288
|
||||
#define WARN_PRESENT 8
|
||||
#define WARN_STRING 16
|
||||
#define WARN_REGEX 32
|
||||
|
||||
#define MAX_OIDS 8
|
||||
#define MAX_DELIM_LENGTH 8
|
||||
|
||||
int process_arguments (int, char **);
|
||||
int validate_arguments (void);
|
||||
char *clarify_message (char *);
|
||||
int check_num (int);
|
||||
int llu_getll (unsigned long long *, char *);
|
||||
int llu_getul (unsigned long long *, char *);
|
||||
char *thisarg (char *str);
|
||||
char *nextarg (char *str);
|
||||
void print_usage (void);
|
||||
|
@ -92,26 +70,27 @@ void print_help (void);
|
|||
char regex_expect[MAX_INPUT_BUFFER] = "";
|
||||
regex_t preg;
|
||||
regmatch_t pmatch[10];
|
||||
char timestamp[10] = "";
|
||||
char errbuf[MAX_INPUT_BUFFER] = "";
|
||||
char perfstr[MAX_INPUT_BUFFER] = "";
|
||||
char perfstr[MAX_INPUT_BUFFER] = "| ";
|
||||
int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE;
|
||||
int eflags = 0;
|
||||
int errcode, excode;
|
||||
|
||||
char *server_address = NULL;
|
||||
char *community = NULL;
|
||||
char *authpriv = NULL;
|
||||
char **authpriv = NULL;
|
||||
char *proto = NULL;
|
||||
char *seclevel = NULL;
|
||||
char *secname = NULL;
|
||||
char *authproto = NULL;
|
||||
char *privproto = NULL;
|
||||
char *authpasswd = NULL;
|
||||
char *privpasswd = NULL;
|
||||
char *oid;
|
||||
char **oids = NULL;
|
||||
char *label;
|
||||
char *units;
|
||||
char *port;
|
||||
char *snmpcmd;
|
||||
char string_value[MAX_INPUT_BUFFER] = "";
|
||||
char **labels = NULL;
|
||||
char **unitv = NULL;
|
||||
|
@ -119,17 +98,16 @@ size_t nlabels = 0;
|
|||
size_t labels_size = 8;
|
||||
size_t nunits = 0;
|
||||
size_t unitv_size = 8;
|
||||
int numoids = 0;
|
||||
int numauthpriv = 0;
|
||||
int verbose = FALSE;
|
||||
int usesnmpgetnext = FALSE;
|
||||
unsigned long long lower_warn_lim[MAX_OIDS];
|
||||
unsigned long long upper_warn_lim[MAX_OIDS];
|
||||
unsigned long long lower_crit_lim[MAX_OIDS];
|
||||
unsigned long long upper_crit_lim[MAX_OIDS];
|
||||
unsigned long long response_value[MAX_OIDS];
|
||||
int check_warning_value = FALSE;
|
||||
int check_critical_value = FALSE;
|
||||
char *warning_thresholds = NULL;
|
||||
char *critical_thresholds = NULL;
|
||||
thresholds *thlds[MAX_OIDS];
|
||||
double response_value[MAX_OIDS];
|
||||
int retries = 0;
|
||||
unsigned long long eval_method[MAX_OIDS];
|
||||
int eval_method[MAX_OIDS];
|
||||
char *delimiter;
|
||||
char *output_delim;
|
||||
char *miblist = NULL;
|
||||
|
@ -139,20 +117,22 @@ int needmibs = FALSE;
|
|||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int i = 0;
|
||||
int i;
|
||||
int iresult = STATE_UNKNOWN;
|
||||
int found = 0;
|
||||
int result = STATE_DEPENDENT;
|
||||
char input_buffer[MAX_INPUT_BUFFER];
|
||||
char *command_line = NULL;
|
||||
int result = STATE_UNKNOWN;
|
||||
int return_code = 0;
|
||||
int external_error = 0;
|
||||
char **command_line = NULL;
|
||||
char *cl_hidden_auth = NULL;
|
||||
char *oidname = NULL;
|
||||
char *response = NULL;
|
||||
char *outbuff;
|
||||
char *output;
|
||||
char *ptr = NULL;
|
||||
char *p2 = NULL;
|
||||
char *show = NULL;
|
||||
char *th_warn=NULL;
|
||||
char *th_crit=NULL;
|
||||
char type[8] = "";
|
||||
output chld_out, chld_err;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
|
@ -162,17 +142,13 @@ main (int argc, char **argv)
|
|||
unitv = malloc (unitv_size);
|
||||
for (i = 0; i < MAX_OIDS; i++)
|
||||
eval_method[i] = CHECK_UNDEF;
|
||||
i = 0;
|
||||
|
||||
oid = strdup ("");
|
||||
label = strdup ("SNMP");
|
||||
units = strdup ("");
|
||||
port = strdup (DEFAULT_PORT);
|
||||
outbuff = strdup ("");
|
||||
output = strdup ("");
|
||||
delimiter = strdup (" = ");
|
||||
output_delim = strdup (DEFAULT_OUTPUT_DELIMITER);
|
||||
/* miblist = strdup (DEFAULT_MIBLIST); */
|
||||
timeout_interval = DEFAULT_TIMEOUT;
|
||||
retries = DEFAULT_RETRIES;
|
||||
|
||||
|
@ -182,91 +158,103 @@ main (int argc, char **argv)
|
|||
if (process_arguments (argc, argv) == ERROR)
|
||||
usage4 (_("Could not parse arguments"));
|
||||
|
||||
/* create the command line to execute */
|
||||
if(usesnmpgetnext == TRUE) {
|
||||
asprintf(&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s",
|
||||
PATH_TO_SNMPGETNEXT, timeout_interval, retries, miblist, proto,
|
||||
authpriv, server_address, port, oid);
|
||||
asprintf(&cl_hidden_auth, "%s -t %d -r %d -m %s -v %s %s %s:%s %s",
|
||||
PATH_TO_SNMPGETNEXT, timeout_interval, retries, miblist, proto,
|
||||
"[authpriv]", server_address, port, oid);
|
||||
}else{
|
||||
/* Populate the thresholds */
|
||||
th_warn=warning_thresholds;
|
||||
th_crit=critical_thresholds;
|
||||
for (i=0; i<numoids; i++) {
|
||||
char *w = th_warn ? strndup(th_warn, strcspn(th_warn, ",")) : NULL;
|
||||
char *c = th_crit ? strndup(th_crit, strcspn(th_crit, ",")) : NULL;
|
||||
/* Skip empty thresholds, while avoiding segfault */
|
||||
set_thresholds(&thlds[i],
|
||||
w ? strpbrk(w, NP_THRESHOLDS_CHARS) : NULL,
|
||||
c ? strpbrk(c, NP_THRESHOLDS_CHARS) : NULL);
|
||||
if (w) {
|
||||
th_warn=strchr(th_warn, ',');
|
||||
if (th_warn) th_warn++;
|
||||
free(w);
|
||||
}
|
||||
if (c) {
|
||||
th_crit=strchr(th_crit, ',');
|
||||
if (th_crit) th_crit++;
|
||||
free(c);
|
||||
}
|
||||
}
|
||||
|
||||
asprintf (&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s",
|
||||
PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto,
|
||||
authpriv, server_address, port, oid);
|
||||
asprintf(&cl_hidden_auth, "%s -t %d -r %d -m %s -v %s %s %s:%s %s",
|
||||
PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto,
|
||||
"[authpriv]", server_address, port, oid);
|
||||
/* Create the command array to execute */
|
||||
if(usesnmpgetnext == TRUE) {
|
||||
snmpcmd = strdup (PATH_TO_SNMPGETNEXT);
|
||||
}else{
|
||||
snmpcmd = strdup (PATH_TO_SNMPGET);
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
printf ("%s\n", command_line);
|
||||
|
||||
/* 9 arguments to pass before authpriv options + 1 for host and numoids. Add one for terminating NULL */
|
||||
command_line = calloc (9 + numauthpriv + 1 + numoids + 1, sizeof (char *));
|
||||
command_line[0] = snmpcmd;
|
||||
command_line[1] = strdup ("-t");
|
||||
asprintf (&command_line[2], "%d", timeout_interval);
|
||||
command_line[3] = strdup ("-r");
|
||||
asprintf (&command_line[4], "%d", retries);
|
||||
command_line[5] = strdup ("-m");
|
||||
command_line[6] = strdup (miblist);
|
||||
command_line[7] = "-v";
|
||||
command_line[8] = strdup (proto);
|
||||
|
||||
/* run the command */
|
||||
child_process = spopen (command_line);
|
||||
if (child_process == NULL) {
|
||||
printf (_("Could not open pipe: %s\n"), cl_hidden_auth);
|
||||
for (i = 0; i < numauthpriv; i++) {
|
||||
command_line[9 + i] = authpriv[i];
|
||||
}
|
||||
|
||||
asprintf (&command_line[9 + numauthpriv], "%s:%s", server_address, port);
|
||||
|
||||
/* This is just for display purposes, so it can remain a string */
|
||||
asprintf(&cl_hidden_auth, "%s -t %d -r %d -m %s -v %s %s %s:%s",
|
||||
snmpcmd, timeout_interval, retries, miblist, proto, "[authpriv]",
|
||||
server_address, port);
|
||||
|
||||
for (i = 0; i < numoids; i++) {
|
||||
command_line[9 + numauthpriv + 1 + i] = oids[i];
|
||||
asprintf(&cl_hidden_auth, "%s %s", cl_hidden_auth, oids[i]);
|
||||
}
|
||||
|
||||
command_line[9 + numauthpriv + 1 + numoids] = NULL;
|
||||
|
||||
if (verbose)
|
||||
printf ("%s\n", cl_hidden_auth);
|
||||
|
||||
/* Run the command */
|
||||
return_code = cmd_run_array (command_line, &chld_out, &chld_err, 0);
|
||||
|
||||
/* Due to net-snmp sometimes showing stderr messages with poorly formed MIBs,
|
||||
only return state unknown if return code is non zero or there is no stdout.
|
||||
Do this way so that if there is stderr, will get added to output, which helps problem diagnosis
|
||||
*/
|
||||
if (return_code != 0)
|
||||
external_error=1;
|
||||
if (chld_out.lines == 0)
|
||||
external_error=1;
|
||||
if (external_error) {
|
||||
if (chld_err.lines > 0) {
|
||||
printf (_("External command error: %s\n"), chld_err.line[0]);
|
||||
for (i = 1; i < chld_err.lines; i++) {
|
||||
printf ("%s\n", chld_err.line[i]);
|
||||
}
|
||||
} else {
|
||||
printf(_("External command error with no output (return code: %d)\n"), return_code);
|
||||
}
|
||||
exit (STATE_UNKNOWN);
|
||||
}
|
||||
|
||||
#if 0 /* Removed May 29, 2007 */
|
||||
child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
|
||||
if (child_stderr == NULL) {
|
||||
printf (_("Could not open stderr for %s\n"), cl_hidden_auth);
|
||||
if (verbose) {
|
||||
for (i = 0; i < chld_out.lines; i++) {
|
||||
printf ("%s\n", chld_out.line[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process))
|
||||
asprintf (&output, "%s%s", output, input_buffer);
|
||||
for (i = 0; i < chld_out.lines; i++) {
|
||||
const char *conv = "%.0f";
|
||||
|
||||
if (verbose)
|
||||
printf ("%s\n", output);
|
||||
|
||||
ptr = output;
|
||||
|
||||
strncat(perfstr, "| ", sizeof(perfstr)-strlen(perfstr)-1);
|
||||
while (ptr) {
|
||||
char *foo;
|
||||
unsigned int copylen;
|
||||
|
||||
foo = strstr (ptr, delimiter);
|
||||
copylen = foo-ptr;
|
||||
if (copylen > sizeof(perfstr)-strlen(perfstr)-1)
|
||||
copylen = sizeof(perfstr)-strlen(perfstr)-1;
|
||||
strncat(perfstr, ptr, copylen);
|
||||
ptr = foo;
|
||||
|
||||
if (ptr == NULL)
|
||||
break;
|
||||
|
||||
ptr += strlen (delimiter);
|
||||
ptr += strspn (ptr, " ");
|
||||
|
||||
found++;
|
||||
|
||||
if (ptr[0] == '"') {
|
||||
ptr++;
|
||||
response = strpcpy (response, ptr, "\"");
|
||||
ptr = strpbrk (ptr, "\"");
|
||||
ptr += strspn (ptr, "\"\n");
|
||||
}
|
||||
else {
|
||||
response = strpcpy (response, ptr, "\n");
|
||||
ptr = strpbrk (ptr, "\n");
|
||||
ptr += strspn (ptr, "\n");
|
||||
while
|
||||
(strstr (ptr, delimiter) &&
|
||||
strstr (ptr, "\n") && strstr (ptr, "\n") < strstr (ptr, delimiter)) {
|
||||
response = strpcat (response, ptr, "\n");
|
||||
ptr = strpbrk (ptr, "\n");
|
||||
}
|
||||
if (ptr && strstr (ptr, delimiter) == NULL) {
|
||||
asprintf (&response, "%s%s", response, ptr);
|
||||
ptr = NULL;
|
||||
}
|
||||
}
|
||||
ptr = chld_out.line[i];
|
||||
oidname = strpcpy (oidname, ptr, delimiter);
|
||||
response = strstr (ptr, delimiter);
|
||||
|
||||
/* We strip out the datatype indicator for PHBs */
|
||||
|
||||
|
@ -287,33 +275,25 @@ main (int argc, char **argv)
|
|||
}
|
||||
else if (strstr (response, "INTEGER: "))
|
||||
show = strstr (response, "INTEGER: ") + 9;
|
||||
else if (strstr (response, "STRING: "))
|
||||
else if (strstr (response, "STRING: ")) {
|
||||
show = strstr (response, "STRING: ") + 8;
|
||||
conv = "%.10g";
|
||||
}
|
||||
else if (strstr (response, "Timeticks: "))
|
||||
show = strstr (response, "Timeticks: ");
|
||||
else
|
||||
show = response;
|
||||
p2 = show;
|
||||
|
||||
iresult = STATE_DEPENDENT;
|
||||
|
||||
/* Process this block for integer comparisons */
|
||||
if (eval_method[i] & CRIT_GT ||
|
||||
eval_method[i] & CRIT_LT ||
|
||||
eval_method[i] & CRIT_GE ||
|
||||
eval_method[i] & CRIT_LE ||
|
||||
eval_method[i] & CRIT_EQ ||
|
||||
eval_method[i] & CRIT_NE ||
|
||||
eval_method[i] & WARN_GT ||
|
||||
eval_method[i] & WARN_LT ||
|
||||
eval_method[i] & WARN_GE ||
|
||||
eval_method[i] & WARN_LE ||
|
||||
eval_method[i] & WARN_EQ ||
|
||||
eval_method[i] & WARN_NE) {
|
||||
p2 = strpbrk (p2, "0123456789");
|
||||
if (p2 == NULL)
|
||||
if (thlds[i]->warning || thlds[i]->critical) {
|
||||
ptr = strpbrk (show, "0123456789");
|
||||
if (ptr == NULL)
|
||||
die (STATE_UNKNOWN,_("No valid data returned"));
|
||||
response_value[i] = strtoul (p2, NULL, 10);
|
||||
iresult = check_num (i);
|
||||
asprintf (&show, "%llu", response_value[i]);
|
||||
response_value[i] = strtod (ptr, NULL);
|
||||
iresult = get_status(response_value[i], thlds[i]);
|
||||
asprintf (&show, conv, response_value[i]);
|
||||
}
|
||||
|
||||
/* Process this block for string matching */
|
||||
|
@ -346,7 +326,7 @@ main (int argc, char **argv)
|
|||
iresult = STATE_CRITICAL;
|
||||
else if (eval_method[i] & WARN_PRESENT)
|
||||
iresult = STATE_WARNING;
|
||||
else if (response && iresult == STATE_DEPENDENT)
|
||||
else if (response && iresult == STATE_DEPENDENT)
|
||||
iresult = STATE_OK;
|
||||
}
|
||||
|
||||
|
@ -366,41 +346,17 @@ main (int argc, char **argv)
|
|||
if (nunits > (size_t)0 && (size_t)i < nunits && unitv[i] != NULL)
|
||||
asprintf (&outbuff, "%s %s", outbuff, unitv[i]);
|
||||
|
||||
i++;
|
||||
if (is_numeric(show)) {
|
||||
strncat(perfstr, oidname, sizeof(perfstr)-strlen(perfstr)-1);
|
||||
strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1);
|
||||
strncat(perfstr, show, sizeof(perfstr)-strlen(perfstr)-1);
|
||||
|
||||
strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1);
|
||||
strncat(perfstr, show, sizeof(perfstr)-strlen(perfstr)-1);
|
||||
if (type)
|
||||
strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1);
|
||||
strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1);
|
||||
|
||||
} /* end while (ptr) */
|
||||
|
||||
if (found == 0)
|
||||
die (STATE_UNKNOWN,
|
||||
_("%s problem - No data received from host\nCMD: %s\n"),
|
||||
label,
|
||||
cl_hidden_auth);
|
||||
|
||||
#if 0 /* Removed May 29, 2007 */
|
||||
/* WARNING if output found on stderr */
|
||||
if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr))
|
||||
result = max_state (result, STATE_WARNING);
|
||||
|
||||
/* close stderr */
|
||||
(void) fclose (child_stderr);
|
||||
#endif
|
||||
|
||||
/* close the pipe */
|
||||
if (spclose (child_process)) {
|
||||
if (result == STATE_OK)
|
||||
result = STATE_UNKNOWN;
|
||||
asprintf (&outbuff, "%s (%s)", outbuff, _("snmpget returned an error status"));
|
||||
if (type)
|
||||
strncat(perfstr, type, sizeof(perfstr)-strlen(perfstr)-1);
|
||||
strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1);
|
||||
}
|
||||
}
|
||||
|
||||
/* if (nunits == 1 || i == 1) */
|
||||
/* printf ("%s %s -%s %s\n", label, state_text (result), outbuff, units); */
|
||||
/* else */
|
||||
printf ("%s %s -%s %s \n", label, state_text (result), outbuff, perfstr);
|
||||
|
||||
return result;
|
||||
|
@ -438,6 +394,7 @@ process_arguments (int argc, char **argv)
|
|||
{"seclevel", required_argument, 0, 'L'},
|
||||
{"secname", required_argument, 0, 'U'},
|
||||
{"authproto", required_argument, 0, 'a'},
|
||||
{"privproto", required_argument, 0, 'x'},
|
||||
{"authpasswd", required_argument, 0, 'A'},
|
||||
{"privpasswd", required_argument, 0, 'X'},
|
||||
{"next", no_argument, 0, 'n'},
|
||||
|
@ -458,7 +415,7 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "nhvVt:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:L:U:a:A:X:",
|
||||
c = getopt_long (argc, argv, "nhvVt:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:L:U:a:x:A:X:",
|
||||
longopts, &option);
|
||||
|
||||
if (c == -1 || c == EOF)
|
||||
|
@ -469,9 +426,9 @@ process_arguments (int argc, char **argv)
|
|||
usage5 ();
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
exit (STATE_OK);
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'v': /* verbose */
|
||||
verbose = TRUE;
|
||||
|
@ -487,7 +444,7 @@ process_arguments (int argc, char **argv)
|
|||
case 'p': /* TCP port number */
|
||||
port = optarg;
|
||||
break;
|
||||
case 'm': /* List of MIBS */
|
||||
case 'm': /* List of MIBS */
|
||||
miblist = optarg;
|
||||
break;
|
||||
case 'n': /* usesnmpgetnext */
|
||||
|
@ -505,6 +462,9 @@ process_arguments (int argc, char **argv)
|
|||
case 'a': /* auth protocol */
|
||||
authproto = optarg;
|
||||
break;
|
||||
case 'x': /* priv protocol */
|
||||
privproto = optarg;
|
||||
break;
|
||||
case 'A': /* auth passwd */
|
||||
authpasswd = optarg;
|
||||
break;
|
||||
|
@ -519,27 +479,11 @@ process_arguments (int argc, char **argv)
|
|||
break;
|
||||
|
||||
/* Test parameters */
|
||||
case 'c': /* critical time threshold */
|
||||
if (strspn (optarg, "0123456789:,") < strlen (optarg))
|
||||
usage2 (_("Invalid critical threshold"), optarg);
|
||||
for (ptr = optarg; ptr && jj < MAX_OIDS; jj++) {
|
||||
if (llu_getll (&lower_crit_lim[jj], ptr) == 1)
|
||||
eval_method[jj] |= CRIT_LT;
|
||||
if (llu_getul (&upper_crit_lim[jj], ptr) == 1)
|
||||
eval_method[jj] |= CRIT_GT;
|
||||
(ptr = index (ptr, ',')) ? ptr++ : ptr;
|
||||
}
|
||||
case 'c': /* critical threshold */
|
||||
critical_thresholds = optarg;
|
||||
break;
|
||||
case 'w': /* warning time threshold */
|
||||
if (strspn (optarg, "0123456789:,") < strlen (optarg))
|
||||
usage2 (_("Invalid warning threshold"), optarg);
|
||||
for (ptr = optarg; ptr && ii < MAX_OIDS; ii++) {
|
||||
if (llu_getll (&lower_warn_lim[ii], ptr) == 1)
|
||||
eval_method[ii] |= WARN_LT;
|
||||
if (llu_getul (&upper_warn_lim[ii], ptr) == 1)
|
||||
eval_method[ii] |= WARN_GT;
|
||||
(ptr = index (ptr, ',')) ? ptr++ : ptr;
|
||||
}
|
||||
case 'w': /* warning threshold */
|
||||
warning_thresholds = optarg;
|
||||
break;
|
||||
case 'e': /* PRELIMINARY - may change */
|
||||
case 'E': /* PRELIMINARY - may change */
|
||||
|
@ -557,17 +501,16 @@ process_arguments (int argc, char **argv)
|
|||
*/
|
||||
needmibs = TRUE;
|
||||
}
|
||||
|
||||
for (ptr = optarg; (ptr = index (ptr, ',')); ptr++)
|
||||
ptr[0] = ' '; /* relpace comma with space */
|
||||
for (ptr = optarg; (ptr = index (ptr, ' ')); ptr++)
|
||||
j++; /* count OIDs */
|
||||
asprintf (&oid, "%s %s", (oid?oid:""), optarg);
|
||||
oids = calloc(MAX_OIDS, sizeof (char *));
|
||||
for (ptr = strtok(optarg, ", "); ptr != NULL && j < MAX_OIDS; ptr = strtok(NULL, ", "), j++) {
|
||||
oids[j] = strdup(ptr);
|
||||
}
|
||||
numoids = j;
|
||||
if (c == 'E' || c == 'e') {
|
||||
jj++;
|
||||
ii++;
|
||||
}
|
||||
if (c == 'E')
|
||||
if (c == 'E')
|
||||
eval_method[j+1] |= WARN_PRESENT;
|
||||
else if (c == 'e')
|
||||
eval_method[j+1] |= CRIT_PRESENT;
|
||||
|
@ -668,8 +611,6 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
if (community == NULL)
|
||||
community = strdup (DEFAULT_COMMUNITY);
|
||||
|
||||
|
||||
|
||||
return validate_arguments ();
|
||||
}
|
||||
|
@ -683,8 +624,8 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
<para>&PROTO_validate_arguments;</para>
|
||||
|
||||
<para>Checks to see if the default miblist needs to be loaded. Also verifies
|
||||
the authentication and authorization combinations based on protocol version
|
||||
<para>Checks to see if the default miblist needs to be loaded. Also verifies
|
||||
the authentication and authorization combinations based on protocol version
|
||||
selected.</para>
|
||||
|
||||
<para></para>
|
||||
|
@ -700,176 +641,98 @@ validate_arguments ()
|
|||
{
|
||||
/* check whether to load locally installed MIBS (CPU/disk intensive) */
|
||||
if (miblist == NULL) {
|
||||
if ( needmibs == TRUE ) {
|
||||
if ( needmibs == TRUE ) {
|
||||
miblist = strdup (DEFAULT_MIBLIST);
|
||||
}else{
|
||||
miblist = "''"; /* don't read any mib files for numeric oids */
|
||||
}
|
||||
}
|
||||
|
||||
/* Check server_address is given */
|
||||
if (server_address == NULL)
|
||||
die(STATE_UNKNOWN, _("No host specified\n"));
|
||||
|
||||
/* Need better checks to verify seclevel and authproto choices */
|
||||
|
||||
if (seclevel == NULL)
|
||||
asprintf (&seclevel, "noAuthNoPriv");
|
||||
/* Check oid is given */
|
||||
if (numoids == 0)
|
||||
die(STATE_UNKNOWN, _("No OIDs specified\n"));
|
||||
|
||||
|
||||
if (authproto == NULL )
|
||||
asprintf(&authproto, DEFAULT_AUTH_PROTOCOL);
|
||||
|
||||
|
||||
|
||||
if (proto == NULL || (strcmp(proto,DEFAULT_PROTOCOL) == 0) ) { /* default protocol version */
|
||||
if (proto == NULL)
|
||||
asprintf(&proto, DEFAULT_PROTOCOL);
|
||||
asprintf(&authpriv, "%s%s", "-c ", community);
|
||||
}
|
||||
else if ( strcmp (proto, "2c") == 0 ) { /* snmpv2c args */
|
||||
asprintf(&authpriv, "%s%s", "-c ", community);
|
||||
|
||||
if ((strcmp(proto,"1") == 0) || (strcmp(proto, "2c")==0)) { /* snmpv1 or snmpv2c */
|
||||
numauthpriv = 2;
|
||||
authpriv = calloc (numauthpriv, sizeof (char *));
|
||||
authpriv[0] = strdup ("-c");
|
||||
authpriv[1] = strdup (community);
|
||||
}
|
||||
else if ( strcmp (proto, "3") == 0 ) { /* snmpv3 args */
|
||||
asprintf(&proto, "%s", "3");
|
||||
|
||||
if ( (strcmp(seclevel, "noAuthNoPriv") == 0) || seclevel == NULL ) {
|
||||
asprintf(&authpriv, "%s", "-l noAuthNoPriv" );
|
||||
}
|
||||
else if ( strcmp(seclevel, "authNoPriv") == 0 ) {
|
||||
if ( secname == NULL || authpasswd == NULL) {
|
||||
printf (_("Missing secname (%s) or authpassword (%s) ! \n"),secname, authpasswd );
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
if (seclevel == NULL)
|
||||
asprintf(&seclevel, "noAuthNoPriv");
|
||||
|
||||
if (strcmp(seclevel, "noAuthNoPriv") == 0) {
|
||||
numauthpriv = 2;
|
||||
authpriv = calloc (numauthpriv, sizeof (char *));
|
||||
authpriv[0] = strdup ("-l");
|
||||
authpriv[1] = strdup ("noAuthNoPriv");
|
||||
} else {
|
||||
if (! ( (strcmp(seclevel, "authNoPriv")==0) || (strcmp(seclevel, "authPriv")==0) ) ) {
|
||||
usage2 (_("Invalid seclevel"), seclevel);
|
||||
}
|
||||
asprintf(&authpriv, "-l authNoPriv -a %s -u %s -A %s ", authproto, secname, authpasswd);
|
||||
}
|
||||
else if ( strcmp(seclevel, "authPriv") == 0 ) {
|
||||
if ( secname == NULL || authpasswd == NULL || privpasswd == NULL ) {
|
||||
printf (_("Missing secname (%s), authpassword (%s), or privpasswd (%s)! \n"),secname, authpasswd,privpasswd );
|
||||
print_usage ();
|
||||
exit (STATE_UNKNOWN);
|
||||
|
||||
if (authproto == NULL )
|
||||
asprintf(&authproto, DEFAULT_AUTH_PROTOCOL);
|
||||
|
||||
if (secname == NULL)
|
||||
die(STATE_UNKNOWN, _("Required parameter: %s\n"), "secname");
|
||||
|
||||
if (authpasswd == NULL)
|
||||
die(STATE_UNKNOWN, _("Required parameter: %s\n"), "authpasswd");
|
||||
|
||||
if ( strcmp(seclevel, "authNoPriv") == 0 ) {
|
||||
numauthpriv = 8;
|
||||
authpriv = calloc (numauthpriv, sizeof (char *));
|
||||
authpriv[0] = strdup ("-l");
|
||||
authpriv[1] = strdup ("authNoPriv");
|
||||
authpriv[2] = strdup ("-a");
|
||||
authpriv[3] = strdup (authproto);
|
||||
authpriv[4] = strdup ("-u");
|
||||
authpriv[5] = strdup (secname);
|
||||
authpriv[6] = strdup ("-A");
|
||||
authpriv[7] = strdup (authpasswd);
|
||||
} else if ( strcmp(seclevel, "authPriv") == 0 ) {
|
||||
if (privproto == NULL )
|
||||
asprintf(&privproto, DEFAULT_PRIV_PROTOCOL);
|
||||
|
||||
if (privpasswd == NULL)
|
||||
die(STATE_UNKNOWN, _("Required parameter: %s\n"), "privpasswd");
|
||||
|
||||
numauthpriv = 12;
|
||||
authpriv = calloc (numauthpriv, sizeof (char *));
|
||||
authpriv[0] = strdup ("-l");
|
||||
authpriv[1] = strdup ("authPriv");
|
||||
authpriv[2] = strdup ("-a");
|
||||
authpriv[3] = strdup (authproto);
|
||||
authpriv[4] = strdup ("-u");
|
||||
authpriv[5] = strdup (secname);
|
||||
authpriv[6] = strdup ("-A");
|
||||
authpriv[7] = strdup (authpasswd);
|
||||
authpriv[8] = strdup ("-x");
|
||||
authpriv[9] = strdup (privproto);
|
||||
authpriv[10] = strdup ("-X");
|
||||
authpriv[11] = strdup (privpasswd);
|
||||
}
|
||||
asprintf(&authpriv, "-l authPriv -a %s -u %s -A %s -x DES -X %s ", authproto, secname, authpasswd, privpasswd);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
usage2 (_("Invalid SNMP version"), proto);
|
||||
}
|
||||
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
char *
|
||||
clarify_message (char *msg)
|
||||
{
|
||||
int i = 0;
|
||||
int foo;
|
||||
char tmpmsg_c[MAX_INPUT_BUFFER];
|
||||
char *tmpmsg = (char *) &tmpmsg_c;
|
||||
tmpmsg = strcpy (tmpmsg, msg);
|
||||
if (!strncmp (tmpmsg, " Hex:", 5)) {
|
||||
tmpmsg = strtok (tmpmsg, ":");
|
||||
while ((tmpmsg = strtok (NULL, " "))) {
|
||||
foo = strtol (tmpmsg, NULL, 16);
|
||||
/* Translate chars that are not the same value in the printers
|
||||
* character set.
|
||||
*/
|
||||
switch (foo) {
|
||||
case 208:
|
||||
{
|
||||
foo = 197;
|
||||
break;
|
||||
}
|
||||
case 216:
|
||||
{
|
||||
foo = 196;
|
||||
break;
|
||||
}
|
||||
}
|
||||
msg[i] = foo;
|
||||
i++;
|
||||
}
|
||||
msg[i] = 0;
|
||||
}
|
||||
return (msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
check_num (int i)
|
||||
{
|
||||
int result;
|
||||
result = STATE_OK;
|
||||
if (eval_method[i] & WARN_GT && eval_method[i] & WARN_LT &&
|
||||
lower_warn_lim[i] > upper_warn_lim[i]) {
|
||||
if (response_value[i] <= lower_warn_lim[i] &&
|
||||
response_value[i] >= upper_warn_lim[i]) {
|
||||
result = STATE_WARNING;
|
||||
}
|
||||
}
|
||||
else if
|
||||
((eval_method[i] & WARN_GT && response_value[i] > upper_warn_lim[i]) ||
|
||||
(eval_method[i] & WARN_GE && response_value[i] >= upper_warn_lim[i]) ||
|
||||
(eval_method[i] & WARN_LT && response_value[i] < lower_warn_lim[i]) ||
|
||||
(eval_method[i] & WARN_LE && response_value[i] <= lower_warn_lim[i]) ||
|
||||
(eval_method[i] & WARN_EQ && response_value[i] == upper_warn_lim[i]) ||
|
||||
(eval_method[i] & WARN_NE && response_value[i] != upper_warn_lim[i])) {
|
||||
result = STATE_WARNING;
|
||||
}
|
||||
|
||||
if (eval_method[i] & CRIT_GT && eval_method[i] & CRIT_LT &&
|
||||
lower_crit_lim[i] > upper_crit_lim[i]) {
|
||||
if (response_value[i] <= lower_crit_lim[i] &&
|
||||
response_value[i] >= upper_crit_lim[i]) {
|
||||
result = STATE_CRITICAL;
|
||||
}
|
||||
}
|
||||
else if
|
||||
((eval_method[i] & CRIT_GT && response_value[i] > upper_crit_lim[i]) ||
|
||||
(eval_method[i] & CRIT_GE && response_value[i] >= upper_crit_lim[i]) ||
|
||||
(eval_method[i] & CRIT_LT && response_value[i] < lower_crit_lim[i]) ||
|
||||
(eval_method[i] & CRIT_LE && response_value[i] <= lower_crit_lim[i]) ||
|
||||
(eval_method[i] & CRIT_EQ && response_value[i] == upper_crit_lim[i]) ||
|
||||
(eval_method[i] & CRIT_NE && response_value[i] != upper_crit_lim[i])) {
|
||||
result = STATE_CRITICAL;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
llu_getll (unsigned long long *ll, char *str)
|
||||
{
|
||||
char tmp[100];
|
||||
if (strchr (str, ':') == NULL)
|
||||
return 0;
|
||||
if (strchr (str, ',') != NULL && (strchr (str, ',') < strchr (str, ':')))
|
||||
return 0;
|
||||
if (sscanf (str, "%llu%[:]", ll, tmp) == 2)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
llu_getul (unsigned long long *ul, char *str)
|
||||
{
|
||||
char tmp[100];
|
||||
if (sscanf (str, "%llu%[^,]", ul, tmp) == 1)
|
||||
return 1;
|
||||
if (sscanf (str, ":%llu%[^,]", ul, tmp) == 1)
|
||||
return 1;
|
||||
if (sscanf (str, "%*u:%llu%[^,]", ul, tmp) == 1)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* trim leading whitespace
|
||||
if there is a leading quote, make sure it balances */
|
||||
|
||||
|
@ -924,13 +787,13 @@ nextarg (char *str)
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
||||
printf ("%s\n", _("Check status of remote machines and obtain sustem information via SNMP"));
|
||||
printf ("%s\n", _("Check status of remote machines and obtain system information via SNMP"));
|
||||
|
||||
printf ("\n\n");
|
||||
printf ("\n\n");
|
||||
|
||||
print_usage ();
|
||||
|
||||
|
@ -941,88 +804,84 @@ print_help (void)
|
|||
|
||||
/* SNMP and Authentication Protocol */
|
||||
printf (" %s\n", "-n, --next");
|
||||
printf (" %s\n", _("Use SNMP GETNEXT instead of SNMP GET"));
|
||||
printf (" %s\n", "-P, --protocol=[1|2c|3]");
|
||||
printf (" %s\n", _("SNMP protocol version"));
|
||||
printf (" %s\n", "-L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]");
|
||||
printf (" %s\n", _("SNMPv3 securityLevel"));
|
||||
printf (" %s\n", "-a, --authproto=[MD5|SHA]");
|
||||
printf (" %s\n", _("SNMPv3 auth proto"));
|
||||
printf (" %s\n", _("Use SNMP GETNEXT instead of SNMP GET"));
|
||||
printf (" %s\n", "-P, --protocol=[1|2c|3]");
|
||||
printf (" %s\n", _("SNMP protocol version"));
|
||||
printf (" %s\n", "-L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]");
|
||||
printf (" %s\n", _("SNMPv3 securityLevel"));
|
||||
printf (" %s\n", "-a, --authproto=[MD5|SHA]");
|
||||
printf (" %s\n", _("SNMPv3 auth proto"));
|
||||
printf (" %s\n", "-x, --privproto=[DES|AES]");
|
||||
printf (" %s\n", _("SNMPv3 priv proto (default DES)"));
|
||||
|
||||
/* Authentication Tokens*/
|
||||
printf (" %s\n", "-C, --community=STRING");
|
||||
printf (" %s ", _("Optional community string for SNMP communication"));
|
||||
printf ("(%s \"%s\")\n", _("default is") ,DEFAULT_COMMUNITY);
|
||||
printf (" %s\n", "-U, --secname=USERNAME");
|
||||
printf (" %s\n", _("SNMPv3 username"));
|
||||
printf (" %s\n", "-A, --authpassword=PASSWORD");
|
||||
printf (" %s\n", _("SNMPv3 authentication password"));
|
||||
printf (" %s\n", "-X, --privpasswd=PASSWORD");
|
||||
printf (" %s\n", _("SNMPv3 privacy password"));
|
||||
printf (" %s ", _("Optional community string for SNMP communication"));
|
||||
printf ("(%s \"%s\")\n", _("default is") ,DEFAULT_COMMUNITY);
|
||||
printf (" %s\n", "-U, --secname=USERNAME");
|
||||
printf (" %s\n", _("SNMPv3 username"));
|
||||
printf (" %s\n", "-A, --authpassword=PASSWORD");
|
||||
printf (" %s\n", _("SNMPv3 authentication password"));
|
||||
printf (" %s\n", "-X, --privpasswd=PASSWORD");
|
||||
printf (" %s\n", _("SNMPv3 privacy password"));
|
||||
|
||||
/* OID Stuff */
|
||||
printf (" %s\n", "-o, --oid=OID(s)");
|
||||
printf (" %s\n", _("Object identifier(s) or SNMP variables whose value you wish to query"));
|
||||
printf (" %s\n", "-m, --miblist=STRING");
|
||||
printf (" %s\n", _("List of MIBS to be loaded (default = none if using numeric oids or 'ALL'"));
|
||||
printf (" %s\n", _("for symbolic oids.)"));
|
||||
printf (" %s\n", "-d, --delimiter=STRING");
|
||||
printf (_(" Delimiter to use when parsing returned data. Default is \"%s\""), DEFAULT_DELIMITER);
|
||||
printf (" %s\n", _("Any data on the right hand side of the delimiter is considered"));
|
||||
printf (" %s\n", _("to be the data that should be used in the evaluation."));
|
||||
printf (" %s\n", _("Object identifier(s) or SNMP variables whose value you wish to query"));
|
||||
printf (" %s\n", "-m, --miblist=STRING");
|
||||
printf (" %s\n", _("List of MIBS to be loaded (default = none if using numeric OIDs or 'ALL'"));
|
||||
printf (" %s\n", _("for symbolic OIDs.)"));
|
||||
printf (" %s\n", "-d, --delimiter=STRING");
|
||||
printf (" %s \"%s\"\n", _("Delimiter to use when parsing returned data. Default is"), DEFAULT_DELIMITER);
|
||||
printf (" %s\n", _("Any data on the right hand side of the delimiter is considered"));
|
||||
printf (" %s\n", _("to be the data that should be used in the evaluation."));
|
||||
|
||||
/* Tests Against Integers */
|
||||
printf (" %s\n", "-w, --warning=INTEGER_RANGE(s)");
|
||||
printf (" %s\n", _("Range(s) which will not result in a WARNING status"));
|
||||
printf (" %s\n", "-c, --critical=INTEGER_RANGE(s)");
|
||||
printf (" %s\n", _("Range(s) which will not result in a CRITICAL status"));
|
||||
printf (" %s\n", "-w, --warning=THRESHOLD(s)");
|
||||
printf (" %s\n", _("Warning threshold range(s)"));
|
||||
printf (" %s\n", "-c, --critical=THRESHOLD(s)");
|
||||
printf (" %s\n", _("Critical threshold range(s)"));
|
||||
|
||||
/* Tests Against Strings */
|
||||
printf (" %s\n", "-s, --string=STRING");
|
||||
printf (" %s\n", _("Return OK state (for that OID) if STRING is an exact match"));
|
||||
printf (" %s\n", "-r, --ereg=REGEX");
|
||||
printf (" %s\n", _("Return OK state (for that OID) if extended regular expression REGEX matches"));
|
||||
printf (" %s\n", "-R, --eregi=REGEX");
|
||||
printf (" %s\n", _("Return OK state (for that OID) if case-insensitive extended REGEX matches"));
|
||||
printf (" %s\n", "-l, --label=STRING");
|
||||
printf (" %s\n", _("Prefix label for output from plugin (default -s 'SNMP')"));
|
||||
printf (" %s\n", _("Return OK state (for that OID) if STRING is an exact match"));
|
||||
printf (" %s\n", "-r, --ereg=REGEX");
|
||||
printf (" %s\n", _("Return OK state (for that OID) if extended regular expression REGEX matches"));
|
||||
printf (" %s\n", "-R, --eregi=REGEX");
|
||||
printf (" %s\n", _("Return OK state (for that OID) if case-insensitive extended REGEX matches"));
|
||||
printf (" %s\n", "-l, --label=STRING");
|
||||
printf (" %s\n", _("Prefix label for output from plugin (default -s 'SNMP')"));
|
||||
|
||||
/* Output Formatting */
|
||||
printf (" %s\n", "-u, --units=STRING");
|
||||
printf (" %s\n", _("Units label(s) for output data (e.g., 'sec.')."));
|
||||
printf (" %s\n", "-D, --output-delimiter=STRING");
|
||||
printf (" %s\n", _("Separates output on multiple OID requests"));
|
||||
printf (" %s\n", _("Units label(s) for output data (e.g., 'sec.')."));
|
||||
printf (" %s\n", "-D, --output-delimiter=STRING");
|
||||
printf (" %s\n", _("Separates output on multiple OID requests"));
|
||||
|
||||
printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (" %s\n", "-e, --retries=INTEGER");
|
||||
printf (" %s\n", _("Number of retries to be used in the requests"));
|
||||
|
||||
printf (_(UT_VERBOSE));
|
||||
|
||||
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 ("\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 ("\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 ("\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", _(UT_THRESHOLDS_NOTES));
|
||||
|
||||
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", _("- 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));
|
||||
printf (" -%s", _(UT_EXTRA_OPTS_NOTES));
|
||||
#endif
|
||||
|
||||
printf (_(UT_SUPPORT));
|
||||
|
@ -1033,10 +892,10 @@ print_help (void)
|
|||
void
|
||||
print_usage (void)
|
||||
{
|
||||
printf (_("Usage:"));
|
||||
printf (_("Usage:"));
|
||||
printf ("%s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range]\n",progname);
|
||||
printf ("[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]\n");
|
||||
printf ("[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]\n");
|
||||
printf ("[-m miblist] [-P snmp version] [-L seclevel] [-U secname] [-a authproto]\n");
|
||||
printf ("[-A authpasswd] [-X privpasswd]\n");
|
||||
printf ("[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]\n");
|
||||
printf ("[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]\n");
|
||||
printf ("[-m miblist] [-P snmp version] [-L seclevel] [-U secname] [-a authproto]\n");
|
||||
printf ("[-A authpasswd] [-x privproto] [-X privpasswd]\n");
|
||||
}
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* 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_ssh plugin
|
||||
|
@ -27,12 +25,10 @@
|
|||
* 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: 1991 $";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -78,7 +74,7 @@ main (int argc, char **argv)
|
|||
|
||||
/* initialize alarm signal handling */
|
||||
signal (SIGALRM, socket_timeout_alarm_handler);
|
||||
|
||||
|
||||
alarm (socket_timeout);
|
||||
|
||||
/* ssh_connect exits if error is found */
|
||||
|
@ -129,7 +125,7 @@ process_arguments (int argc, char **argv)
|
|||
case '?': /* help */
|
||||
usage5 ();
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
|
@ -218,9 +214,7 @@ ssh_connect (char *haddr, int hport, char *remote_version)
|
|||
char *buffer = NULL;
|
||||
char *ssh_proto = NULL;
|
||||
char *ssh_server = NULL;
|
||||
char rev_no[20];
|
||||
|
||||
sscanf ("$Revision: 1991 $", "$Revision: %[0123456789.]", rev_no);
|
||||
static char *rev_no = VERSION;
|
||||
|
||||
result = my_tcp_connect (haddr, hport, &sd);
|
||||
|
||||
|
@ -255,7 +249,7 @@ ssh_connect (char *haddr, int hport, char *remote_version)
|
|||
close(sd);
|
||||
exit (STATE_WARNING);
|
||||
}
|
||||
|
||||
|
||||
printf
|
||||
(_("SSH OK - %s (protocol %s)\n"),
|
||||
ssh_server, ssh_proto);
|
||||
|
@ -272,7 +266,7 @@ print_help (void)
|
|||
char *myport;
|
||||
asprintf (&myport, "%d", SSH_DFL_PORT);
|
||||
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Remi Paulmier <remi@sinfomic.fr>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
@ -294,7 +288,7 @@ print_help (void)
|
|||
|
||||
printf (" %s\n", "-r, --remote-version=STRING");
|
||||
printf (" %s\n", _("Warn if string doesn't match expected server version (ex: OpenSSH_3.9p1)"));
|
||||
|
||||
|
||||
printf (_(UT_VERBOSE));
|
||||
|
||||
#ifdef NP_EXTRA_OPTS
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
* Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net)
|
||||
* 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
|
||||
|
@ -26,12 +24,10 @@
|
|||
* 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_swap.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_swap";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -463,7 +459,7 @@ process_arguments (int argc, char **argv)
|
|||
verbose++;
|
||||
break;
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
|
@ -507,7 +503,7 @@ validate_arguments (void)
|
|||
return ERROR;
|
||||
}
|
||||
else if (warn_percent < crit_percent) {
|
||||
usage4
|
||||
usage4
|
||||
(_("Warning percentage should be more than critical percentage"));
|
||||
}
|
||||
else if (warn_size_bytes < crit_size_bytes) {
|
||||
|
@ -522,7 +518,7 @@ validate_arguments (void)
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf (_(COPYRIGHT), copyright, email);
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* License: GPL
|
||||
* 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
|
||||
|
@ -24,14 +22,13 @@
|
|||
*
|
||||
* 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_tcp.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
* $Id: check_tcp.c 2153 2009-02-21 09:59:24Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/* progname "check_tcp" changes depending on symlink called */
|
||||
char *progname;
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "1999-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -315,7 +312,7 @@ main (int argc, char **argv)
|
|||
}
|
||||
#ifdef HAVE_SSL
|
||||
np_net_ssl_cleanup();
|
||||
#endif
|
||||
#endif
|
||||
if (sd) close (sd);
|
||||
|
||||
microsec = deltime (tv);
|
||||
|
@ -395,10 +392,10 @@ process_arguments (int argc, char **argv)
|
|||
{"critical-codes", required_argument, 0, 'C'},
|
||||
{"warning-codes", required_argument, 0, 'W'},
|
||||
{"timeout", required_argument, 0, 't'},
|
||||
{"protocol", required_argument, 0, 'P'},
|
||||
{"protocol", required_argument, 0, 'P'}, /* FIXME: Unhandled */
|
||||
{"port", required_argument, 0, 'p'},
|
||||
{"escape", required_argument, 0, 'E'},
|
||||
{"all", required_argument, 0, 'A'},
|
||||
{"escape", no_argument, 0, 'E'},
|
||||
{"all", no_argument, 0, 'A'},
|
||||
{"send", required_argument, 0, 's'},
|
||||
{"expect", required_argument, 0, 'e'},
|
||||
{"maxbytes", required_argument, 0, 'm'},
|
||||
|
@ -412,10 +409,8 @@ process_arguments (int argc, char **argv)
|
|||
{"verbose", no_argument, 0, 'v'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
#ifdef HAVE_SSL
|
||||
{"ssl", no_argument, 0, 'S'},
|
||||
{"certificate", required_argument, 0, 'D'},
|
||||
#endif
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
@ -453,7 +448,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'v': /* verbose mode */
|
||||
flags |= FLAG_VERBOSE;
|
||||
|
@ -594,7 +589,7 @@ process_arguments (int argc, char **argv)
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
@ -623,7 +618,7 @@ print_help (void)
|
|||
printf (" %s\n", "-q, --quit=STRING");
|
||||
printf (" %s\n", _("String to send server to initiate a clean close of the connection"));
|
||||
printf (" %s\n", "-r, --refuse=ok|warn|crit");
|
||||
printf (" %s\n", _("Accept tcp refusals with states ok, warn, crit (default: crit)"));
|
||||
printf (" %s\n", _("Accept TCP refusals with states ok, warn, crit (default: crit)"));
|
||||
printf (" %s\n", "-M, --mismatch=ok|warn|crit");
|
||||
printf (" %s\n", _("Accept expected string mismatches with states ok, warn, crit (default: warn)"));
|
||||
printf (" %s\n", "-j, --jail");
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* License: GPL
|
||||
* 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
|
||||
|
@ -27,12 +25,10 @@
|
|||
* 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: 1991 $";
|
||||
const char *copyright = "1999-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -115,7 +111,7 @@ main (int argc, char **argv)
|
|||
result = STATE_WARNING;
|
||||
else
|
||||
result = STATE_UNKNOWN;
|
||||
die (result,
|
||||
die (result,
|
||||
_("TIME UNKNOWN - could not send UDP request to server %s, port %d\n"),
|
||||
server_address, server_port);
|
||||
}
|
||||
|
@ -237,7 +233,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'H': /* hostname */
|
||||
if (is_host (optarg) == FALSE)
|
||||
|
@ -335,7 +331,7 @@ print_help (void)
|
|||
char *myport;
|
||||
asprintf (&myport, "%d", TIME_PORT);
|
||||
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Ethan Galstad\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
|
|
@ -8,14 +8,12 @@
|
|||
* 2004 Arnaud Quette <arnaud.quette@mgeups.com>
|
||||
* 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.
|
||||
* This plugin tests the UPS service on the specified host. Network UPS Tools
|
||||
* from www.networkupstools.org must be running for this plugin to work.
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
@ -31,12 +29,10 @@
|
|||
* 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_ups.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_ups";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -398,12 +394,15 @@ get_ups_variable (const char *varname, char *buf, size_t buflen)
|
|||
char temp_buffer[MAX_INPUT_BUFFER];
|
||||
char send_buffer[MAX_INPUT_BUFFER];
|
||||
char *ptr;
|
||||
char *logout = "OK Goodbye\n";
|
||||
int logout_len = strlen(logout);
|
||||
int len;
|
||||
|
||||
*buf=0;
|
||||
|
||||
|
||||
/* create the command string to send to the UPS daemon */
|
||||
sprintf (send_buffer, "GET VAR %s %s\n", ups_name, varname);
|
||||
/* Add LOGOUT to avoid read failure logs */
|
||||
sprintf (send_buffer, "GET VAR %s %s\nLOGOUT\n", ups_name, varname);
|
||||
|
||||
/* send the command to the daemon and get a response back */
|
||||
if (process_tcp_request
|
||||
|
@ -415,9 +414,10 @@ get_ups_variable (const char *varname, char *buf, size_t buflen)
|
|||
|
||||
ptr = temp_buffer;
|
||||
len = strlen(ptr);
|
||||
if (len > logout_len && strcmp (ptr + len - logout_len, logout) == 0) len -= logout_len;
|
||||
if (len > 0 && ptr[len-1] == '\n') ptr[len-1]=0;
|
||||
if (strcmp (ptr, "ERR UNKNOWN-UPS") == 0) {
|
||||
printf (_("CRITICAL - no such ups '%s' on that host\n"), ups_name);
|
||||
printf (_("CRITICAL - no such UPS '%s' on that host\n"), ups_name);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
@ -449,7 +449,7 @@ get_ups_variable (const char *varname, char *buf, size_t buflen)
|
|||
}
|
||||
|
||||
|
||||
/* Command line: CHECK_UPS -H <host_address> -u ups [-p port] [-v variable]
|
||||
/* Command line: CHECK_UPS -H <host_address> -u ups [-p port] [-v variable]
|
||||
[-wv warn_value] [-cv crit_value] [-to to_sec] */
|
||||
|
||||
|
||||
|
@ -504,7 +504,7 @@ process_arguments (int argc, char **argv)
|
|||
usage2 (_("Invalid hostname/address"), optarg);
|
||||
}
|
||||
break;
|
||||
case 'T': /* FIXME: to be improved (ie "-T C" for Celsius or "-T F" for Farenheit) */
|
||||
case 'T': /* FIXME: to be improved (ie "-T C" for Celsius or "-T F" for Farenheit) */
|
||||
temp_output_c = 1;
|
||||
break;
|
||||
case 'u': /* ups name */
|
||||
|
@ -557,7 +557,7 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
break;
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
|
@ -584,7 +584,7 @@ int
|
|||
validate_arguments (void)
|
||||
{
|
||||
if (! ups_name) {
|
||||
printf ("%s\n", _("Error : no ups indicated"));
|
||||
printf ("%s\n", _("Error : no UPS indicated"));
|
||||
return ERROR;
|
||||
}
|
||||
return OK;
|
||||
|
@ -597,7 +597,7 @@ print_help (void)
|
|||
char *myport;
|
||||
asprintf (&myport, "%d", PORT);
|
||||
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 2000 Tom Shields\n");
|
||||
printf ("Copyright (c) 2004 Alain Richard <alain.richard@equation.fr>\n");
|
||||
|
@ -605,7 +605,7 @@ print_help (void)
|
|||
printf (COPYRIGHT, copyright, email);
|
||||
|
||||
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 ("%s\n", _("from www.networkupstools.org must be running for this plugin to work."));
|
||||
|
||||
printf ("\n\n");
|
||||
|
||||
|
@ -635,18 +635,18 @@ print_help (void)
|
|||
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", _("state. If the UPS is off or has a low battery the plugin will return a CRITICAL"));
|
||||
printf ("%s\n", _("state."));
|
||||
|
||||
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", _("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", _("This plugin requires that the UPSD daemon distributed with Russell Kroll's"));
|
||||
printf (" %s\n", _("Network 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
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* 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_users plugin
|
||||
|
@ -29,12 +27,10 @@
|
|||
* 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_users.c 1991 2008-05-07 10:02:42Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_users";
|
||||
const char *revision = "$Revision: 1991 $";
|
||||
const char *copyright = "2000-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -108,9 +104,9 @@ main (int argc, char **argv)
|
|||
result = possibly_set (result, STATE_UNKNOWN);
|
||||
|
||||
/* else check the user count against warning and critical thresholds */
|
||||
if (users >= cusers)
|
||||
if (users > cusers)
|
||||
result = STATE_CRITICAL;
|
||||
else if (users >= wusers)
|
||||
else if (users > wusers)
|
||||
result = STATE_WARNING;
|
||||
else if (users >= 0)
|
||||
result = STATE_OK;
|
||||
|
@ -163,7 +159,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (STATE_OK);
|
||||
case 'c': /* critical */
|
||||
if (!is_intnonneg (optarg))
|
||||
|
@ -203,7 +199,7 @@ process_arguments (int argc, char **argv)
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 1999 Ethan Galstad\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
* 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
|
||||
|
@ -27,7 +25,6 @@
|
|||
* 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 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* License: GPL
|
||||
* 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
|
||||
|
@ -28,12 +26,10 @@
|
|||
* 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: negate.c 1989 2008-05-02 09:28:15Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "negate";
|
||||
const char *revision = "$Revision: 1989 $";
|
||||
const char *copyright = "2002-2008";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -71,6 +67,8 @@ main (int argc, char **argv)
|
|||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
timeout_interval = DEFAULT_TIMEOUT;
|
||||
|
||||
command_line = (char **) process_arguments (argc, argv);
|
||||
|
||||
/* Set signal handling and alarm */
|
||||
|
@ -132,6 +130,7 @@ process_arguments (int argc, char **argv)
|
|||
{"help", no_argument, 0, 'h'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{"timeout", required_argument, 0, 't'},
|
||||
{"timeout-result", required_argument, 0, 'T'},
|
||||
{"ok", required_argument, 0, 'o'},
|
||||
{"warning", required_argument, 0, 'w'},
|
||||
{"critical", required_argument, 0, 'c'},
|
||||
|
@ -141,7 +140,7 @@ process_arguments (int argc, char **argv)
|
|||
};
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "+hVt:o:w:c:u:s", longopts, &option);
|
||||
c = getopt_long (argc, argv, "+hVt:T:o:w:c:u:s", longopts, &option);
|
||||
|
||||
if (c == -1 || c == EOF)
|
||||
break;
|
||||
|
@ -155,7 +154,7 @@ process_arguments (int argc, char **argv)
|
|||
exit (EXIT_SUCCESS);
|
||||
break;
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
case 't': /* timeout period */
|
||||
if (!is_integer (optarg))
|
||||
|
@ -163,6 +162,10 @@ process_arguments (int argc, char **argv)
|
|||
else
|
||||
timeout_interval = atoi (optarg);
|
||||
break;
|
||||
case 'T': /* Result to return on timeouts */
|
||||
if ((timeout_state = translate_state(optarg)) == ERROR)
|
||||
usage4 (_("timeout result must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3)."));
|
||||
break;
|
||||
case 'o': /* replacement for OK */
|
||||
if ((state[STATE_OK] = translate_state(optarg)) == ERROR)
|
||||
usage4 (_("Ok must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3)."));
|
||||
|
@ -233,7 +236,7 @@ translate_state (char *state_text)
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
||||
|
@ -246,8 +249,10 @@ print_help (void)
|
|||
|
||||
printf (_(UT_HELP_VRSN));
|
||||
|
||||
printf (_(UT_TIMEOUT), DEFAULT_TIMEOUT);
|
||||
printf (_(UT_TIMEOUT), timeout_interval);
|
||||
printf (" %s\n", _("Keep timeout longer than the plugin timeout to retain CRITICAL status."));
|
||||
printf (" -T, --timeout-result=STATUS\n");
|
||||
printf (" %s\n", _("Custom result on Negate timeouts; see below for STATUS definition\n"));
|
||||
|
||||
printf(" -o, --ok=STATUS\n");
|
||||
printf(" -w, --warning=STATUS\n");
|
||||
|
@ -272,6 +277,9 @@ print_help (void)
|
|||
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 ("\n");
|
||||
printf (" %s\n", _("Using timeout-result, it is possible to override the timeout behaviour or a"));
|
||||
printf (" %s\n", _("plugin by setting the negate timeout a bit lower."));
|
||||
|
||||
printf (_(UT_SUPPORT));
|
||||
}
|
||||
|
@ -282,5 +290,5 @@ void
|
|||
print_usage (void)
|
||||
{
|
||||
printf (_("Usage:"));
|
||||
printf ("%s [-t timeout] [-owcu STATE] [-s] <definition of wrapped plugin>\n", progname);
|
||||
printf ("%s [-t timeout] [-Towcu STATE] [-s] <definition of wrapped plugin>\n", progname);
|
||||
}
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
* Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)
|
||||
* 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.
|
||||
|
@ -26,7 +24,6 @@
|
|||
* 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: netutils.c 1918 2008-01-31 11:27:22Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
@ -35,7 +32,6 @@
|
|||
#include "common.h"
|
||||
#include "netutils.h"
|
||||
|
||||
unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT;
|
||||
int econn_refuse_state = STATE_CRITICAL;
|
||||
int was_refused = FALSE;
|
||||
#if USE_IPV6
|
||||
|
@ -49,16 +45,16 @@ void
|
|||
socket_timeout_alarm_handler (int sig)
|
||||
{
|
||||
if (sig == SIGALRM)
|
||||
printf (_("CRITICAL - Socket timeout after %d seconds\n"), socket_timeout);
|
||||
printf (_("%s - Socket timeout after %d seconds\n"), state_text(socket_timeout_state), socket_timeout);
|
||||
else
|
||||
printf (_("CRITICAL - Abnormal timeout after %d seconds\n"), socket_timeout);
|
||||
printf (_("%s - Abnormal timeout after %d seconds\n"), state_text(socket_timeout_state), socket_timeout);
|
||||
|
||||
exit (STATE_CRITICAL);
|
||||
exit (socket_timeout_state);
|
||||
}
|
||||
|
||||
|
||||
/* connects to a host on a specified tcp port, sends a string, and gets a
|
||||
response. loops on select-recv until timeout or eof to get all of a
|
||||
/* connects to a host on a specified tcp port, sends a string, and gets a
|
||||
response. loops on select-recv until timeout or eof to get all of a
|
||||
multi-packet answer */
|
||||
int
|
||||
process_tcp_request2 (const char *server_address, int server_port,
|
||||
|
@ -106,7 +102,7 @@ process_tcp_request2 (const char *server_address, int server_port,
|
|||
}
|
||||
else { /* it has */
|
||||
recv_result =
|
||||
recv (sd, recv_buffer + recv_length,
|
||||
recv (sd, recv_buffer + recv_length,
|
||||
(size_t)recv_size - recv_length - 1, 0);
|
||||
if (recv_result == -1) {
|
||||
/* recv failed, bail out */
|
||||
|
@ -137,7 +133,7 @@ process_tcp_request2 (const char *server_address, int server_port,
|
|||
}
|
||||
|
||||
|
||||
/* connects to a host on a specified port, sends a string, and gets a
|
||||
/* connects to a host on a specified port, sends a string, and gets a
|
||||
response */
|
||||
int
|
||||
process_request (const char *server_address, int server_port, int proto,
|
||||
|
@ -229,7 +225,7 @@ np_net_connect (const char *host_name, int port, int *sd, int proto)
|
|||
r = r->ai_next;
|
||||
}
|
||||
freeaddrinfo (res);
|
||||
}
|
||||
}
|
||||
/* else the hostname is interpreted as a path to a unix socket */
|
||||
else {
|
||||
if(strlen(host_name) >= UNIX_PATH_MAX){
|
||||
|
@ -251,7 +247,7 @@ np_net_connect (const char *host_name, int port, int *sd, int proto)
|
|||
return STATE_OK;
|
||||
else if (was_refused) {
|
||||
switch (econn_refuse_state) { /* a user-defined expected outcome */
|
||||
case STATE_OK:
|
||||
case STATE_OK:
|
||||
case STATE_WARNING: /* user wants WARN or OK on refusal */
|
||||
return econn_refuse_state;
|
||||
break;
|
||||
|
@ -285,7 +281,7 @@ send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int
|
|||
result = STATE_WARNING;
|
||||
}
|
||||
|
||||
/* wait up to the number of seconds for socket timeout minus one
|
||||
/* wait up to the number of seconds for socket timeout minus one
|
||||
for data from the host */
|
||||
tv.tv_sec = socket_timeout - 1;
|
||||
tv.tv_usec = 0;
|
||||
|
@ -340,7 +336,7 @@ is_addr (const char *address)
|
|||
#ifdef USE_IPV6
|
||||
if (address_family == AF_INET && is_inet_addr (address))
|
||||
return TRUE;
|
||||
else if (address_family == AF_INET6 && is_inet6_addr (address))
|
||||
else if (address_family == AF_INET6 && is_inet6_addr (address))
|
||||
return TRUE;
|
||||
#else
|
||||
if (is_inet_addr (address))
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
* Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)
|
||||
* 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
|
||||
|
@ -27,7 +25,6 @@
|
|||
* 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: netutils.h 1919 2008-01-31 11:45:28Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
@ -38,7 +35,7 @@
|
|||
#include "utils.h"
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include "getaddrinfo.h"
|
||||
#include <netdb.h>
|
||||
|
||||
#ifdef HAVE_SYS_UN_H
|
||||
# include <sys/un.h>
|
||||
|
@ -48,8 +45,6 @@
|
|||
# endif /* UNIX_PATH_MAX */
|
||||
#endif /* HAVE_SYS_UN_H */
|
||||
|
||||
RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
|
||||
|
||||
/* process_request and wrapper macros */
|
||||
#define process_tcp_request(addr, port, sbuf, rbuf, rsize) \
|
||||
process_request(addr, port, IPPROTO_TCP, sbuf, rbuf, rsize)
|
||||
|
@ -86,7 +81,16 @@ void host_or_die(const char *str);
|
|||
# define is_hostname(addr) resolve_host_or_addr(addr, AF_INET)
|
||||
#endif
|
||||
|
||||
#ifdef LOCAL_TIMEOUT_ALARM_HANDLER
|
||||
extern unsigned int socket_timeout;
|
||||
extern int socket_timeout_state;
|
||||
RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
|
||||
#else
|
||||
unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT;
|
||||
unsigned int socket_timeout_state = STATE_CRITICAL;
|
||||
extern RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
|
||||
#endif
|
||||
|
||||
extern int econn_refuse_state;
|
||||
extern int was_refused;
|
||||
extern int address_family;
|
||||
|
@ -95,6 +99,7 @@ extern int address_family;
|
|||
#ifdef HAVE_SSL
|
||||
/* maybe this could be merged with the above np_net_connect, via some flags */
|
||||
int np_net_ssl_init(int sd);
|
||||
int np_net_ssl_init_with_hostname(int sd, char *host_name);
|
||||
void np_net_ssl_cleanup();
|
||||
int np_net_ssl_write(const void *buf, int num);
|
||||
int np_net_ssl_read(void *buf, int num);
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* 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
|
||||
|
@ -37,7 +35,6 @@
|
|||
* 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 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
@ -140,7 +137,7 @@ spopen (const char *cmdstring)
|
|||
/* there cannot be more args than characters */
|
||||
argc = strlen (cmdstring) + 1; /* add 1 for NULL termination */
|
||||
argv = malloc (sizeof(char*)*argc);
|
||||
|
||||
|
||||
if (argv == NULL) {
|
||||
printf ("%s\n", _("Could not malloc argv array in popen()"));
|
||||
return NULL;
|
||||
|
@ -165,7 +162,7 @@ spopen (const char *cmdstring)
|
|||
}
|
||||
else if (strcspn(str,"'") < strcspn (str, " \t\r\n")) {
|
||||
/* handle --option='foo bar' strings */
|
||||
tmp = str + strcspn(str, "'") + 1;
|
||||
tmp = str + strcspn(str, "'") + 1;
|
||||
if (!strstr (tmp, "'"))
|
||||
return NULL; /* balanced? */
|
||||
tmp += strcspn(tmp,"'") + 1;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* $Id: popen.h 1919 2008-01-31 11:45:28Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* 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
|
||||
|
@ -35,7 +33,6 @@
|
|||
* 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 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
* 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 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* 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:
|
||||
*
|
||||
* This file contains common functions for plugins that require SSL.
|
||||
|
@ -25,7 +23,6 @@
|
|||
* 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: sslutils.c 1918 2008-01-31 11:27:22Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
@ -38,7 +35,11 @@ static SSL_CTX *c=NULL;
|
|||
static SSL *s=NULL;
|
||||
static int initialized=0;
|
||||
|
||||
int np_net_ssl_init (int sd){
|
||||
int np_net_ssl_init (int sd) {
|
||||
return np_net_ssl_init_with_hostname(sd, NULL);
|
||||
}
|
||||
|
||||
int np_net_ssl_init_with_hostname (int sd, char *host_name) {
|
||||
if (!initialized) {
|
||||
/* Initialize SSL context */
|
||||
SSLeay_add_ssl_algorithms ();
|
||||
|
@ -51,6 +52,10 @@ int np_net_ssl_init (int sd){
|
|||
return STATE_CRITICAL;
|
||||
}
|
||||
if ((s = SSL_new (c)) != NULL){
|
||||
#ifdef SSL_set_tlsext_host_name
|
||||
if (host_name != NULL)
|
||||
SSL_set_tlsext_host_name(s, host_name);
|
||||
#endif
|
||||
SSL_set_fd (s, sd);
|
||||
if (SSL_connect(s) == 1){
|
||||
return OK;
|
||||
|
@ -68,6 +73,9 @@ int np_net_ssl_init (int sd){
|
|||
|
||||
void np_net_ssl_cleanup (){
|
||||
if(s){
|
||||
#ifdef SSL_set_tlsext_host_name
|
||||
SSL_set_tlsext_host_name(s, NULL);
|
||||
#endif
|
||||
SSL_shutdown (s);
|
||||
SSL_free (s);
|
||||
if(c) {
|
||||
|
@ -89,9 +97,10 @@ int np_net_ssl_read(void *buf, int num){
|
|||
int np_net_ssl_check_cert(int days_till_exp){
|
||||
# ifdef USE_OPENSSL
|
||||
X509 *certificate=NULL;
|
||||
ASN1_STRING *tm;
|
||||
ASN1_STRING *tm;
|
||||
int offset;
|
||||
struct tm stamp;
|
||||
float time_left;
|
||||
int days_left;
|
||||
char timestamp[17] = "";
|
||||
|
||||
|
@ -138,7 +147,8 @@ int np_net_ssl_check_cert(int days_till_exp){
|
|||
stamp.tm_sec = 0;
|
||||
stamp.tm_isdst = -1;
|
||||
|
||||
days_left = (mktime (&stamp) - time (NULL)) / 86400;
|
||||
time_left = difftime(timegm(&stamp), time(NULL));
|
||||
days_left = time_left / 86400;
|
||||
snprintf
|
||||
(timestamp, 17, "%02d/%02d/%04d %02d:%02d",
|
||||
stamp.tm_mon + 1,
|
||||
|
@ -147,7 +157,7 @@ int np_net_ssl_check_cert(int days_till_exp){
|
|||
if (days_left > 0 && days_left <= days_till_exp) {
|
||||
printf (_("WARNING - Certificate expires in %d day(s) (%s).\n"), days_left, timestamp);
|
||||
return STATE_WARNING;
|
||||
} else if (days_left < 0) {
|
||||
} else if (time_left < 0) {
|
||||
printf (_("CRITICAL - Certificate expired on %s.\n"), timestamp);
|
||||
return STATE_CRITICAL;
|
||||
} else if (days_left == 0) {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# check_by_ssh tests
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
@ -92,7 +91,7 @@ $result = NPTest->testCmd(
|
|||
);
|
||||
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");
|
||||
cmp_ok(scalar(@lines), '==', 8, "Correct number of output lines for multiple checks");
|
||||
my %linemap = (
|
||||
'0' => '1',
|
||||
'2' => '0',
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# check_cluster tests
|
||||
#
|
||||
# $Id: check_cluster.t 1702 2007-04-28 21:57:17Z psychotrahe $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
|
84
plugins/t/check_dig.t
Normal file
84
plugins/t/check_dig.t
Normal file
|
@ -0,0 +1,84 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# Domain Name Server (DNS) Tests via check_dig
|
||||
#
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test::More;
|
||||
use NPTest;
|
||||
|
||||
plan skip_all => "check_dig not compiled" unless (-x "check_dig");
|
||||
|
||||
plan tests => 12;
|
||||
|
||||
my $successOutput = '/DNS OK - [\.0-9]+ seconds? response time/';
|
||||
|
||||
my $hostname_valid = getTestParameter(
|
||||
"NP_HOSTNAME_VALID",
|
||||
"A valid (known to DNS) hostname",
|
||||
"nagios.com"
|
||||
);
|
||||
|
||||
my $hostname_valid_ip = getTestParameter(
|
||||
"NP_HOSTNAME_VALID_IP",
|
||||
"The IP address of the valid hostname $hostname_valid",
|
||||
"66.118.156.50",
|
||||
);
|
||||
|
||||
my $hostname_valid_reverse = getTestParameter(
|
||||
"NP_HOSTNAME_VALID_REVERSE",
|
||||
"The hostname of $hostname_valid_ip",
|
||||
"66-118-156-50.static.sagonet.net.",
|
||||
);
|
||||
|
||||
my $hostname_invalid = getTestParameter(
|
||||
"NP_HOSTNAME_INVALID",
|
||||
"An invalid (not known to DNS) hostname",
|
||||
"nosuchhost.altinity.com",
|
||||
);
|
||||
|
||||
my $dns_server = getTestParameter(
|
||||
"NP_DNS_SERVER",
|
||||
"A non default (remote) DNS server",
|
||||
);
|
||||
|
||||
my $res;
|
||||
|
||||
SKIP: {
|
||||
skip "check_dig.t: not enough parameters given",
|
||||
12 unless ($hostname_valid && $hostname_valid_ip && $hostname_valid_reverse && $hostname_invalid && $dns_server);
|
||||
|
||||
$res = NPTest->testCmd("./check_dig -H $dns_server -l $hostname_valid -t 5");
|
||||
cmp_ok( $res->return_code, '==', 0, "Found $hostname_valid");
|
||||
like ( $res->output, $successOutput, "Output OK" );
|
||||
|
||||
$res = NPTest->testCmd("./check_dig -H $dns_server -l $hostname_valid -t 5 -w 0.000001 -c 0.00001");
|
||||
cmp_ok( $res->return_code, '==', 2, "Critical threshold passed");
|
||||
|
||||
$res = NPTest->testCmd("./check_dig -H $dns_server -l $hostname_valid -t 5 -w 0.000001 -c 5");
|
||||
cmp_ok( $res->return_code, '==', 1, "Warning threshold passed");
|
||||
|
||||
$res = NPTest->testCmd("./check_dig -H $dns_server -t 1");
|
||||
cmp_ok( $res->return_code, '==', 3, "Invalid command line -l missing");
|
||||
|
||||
$res = NPTest->testCmd("./check_dig -H $dns_server -l $hostname_invalid -t 1");
|
||||
cmp_ok( $res->return_code, '==', 2, "Invalid $hostname_invalid");
|
||||
|
||||
$res = NPTest->testCmd("./check_dig -H $dns_server -l $hostname_valid -t 5");
|
||||
cmp_ok( $res->return_code, '==', 0, "Found $hostname_valid on $dns_server");
|
||||
like ( $res->output, $successOutput, "Output OK" );
|
||||
|
||||
$res = NPTest->testCmd("./check_dig -H $dns_server -l $hostname_valid -a $hostname_valid_ip -t 5");
|
||||
cmp_ok( $res->return_code, '==', 0, "Got expected address");
|
||||
|
||||
$res = NPTest->testCmd("./check_dig -H $dns_server -l $hostname_valid -a 10.10.10.10 -t 5");
|
||||
cmp_ok( $res->return_code, '==', 1, "Got wrong address");
|
||||
|
||||
my $ip_reverse = $hostname_valid_ip;
|
||||
$ip_reverse =~ s/(\d+)\.(\d+)\.(\d+)\.(\d+)/$4.$3.$2.$1.in-addr.arpa/;
|
||||
$res = NPTest->testCmd("./check_dig -H $dns_server -l $ip_reverse -a $hostname_valid_reverse -T PTR -t 5");
|
||||
cmp_ok( $res->return_code, '==', 0, "Got expected fqdn");
|
||||
like ( $res->output, $successOutput, "Output OK");
|
||||
|
||||
}
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# Disk Space Tests via check_disk
|
||||
#
|
||||
# $Id: check_disk.t 1786 2007-09-22 17:40:35Z psychotrahe $
|
||||
#
|
||||
|
||||
# TODO: Add in tests for perf data. Need to beef up Nagios::Plugin::Performance to cater for max, min, etc
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# Domain Name Server (DNS) Tests via check_dns
|
||||
#
|
||||
# $Id: check_dns.t 1902 2008-01-08 16:05:36Z tonvoon $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# check_dummy tests
|
||||
#
|
||||
# $Id: check_dummy.t 1716 2007-05-24 08:35:53Z tonvoon $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# FPing Tests via check_fping
|
||||
#
|
||||
# $Id: check_fping.t 1207 2005-07-25 01:47:15Z illumino $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# File Transfer Protocol (FTP) Test via check_ftp
|
||||
#
|
||||
# $Id: check_ftp.t 1901 2008-01-08 11:57:24Z tonvoon $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# HP JetDirect Test via check_hpjd
|
||||
#
|
||||
# $Id: check_hpjd.t 1354 2006-03-24 16:13:40Z tonvoon $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# HyperText Transfer Protocol (HTTP) Test via check_http
|
||||
#
|
||||
# $Id: check_http.t 1669 2007-04-01 14:21:09Z psychotrahe $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
@ -35,7 +34,7 @@ my $host_tcp_http2;
|
|||
if ($internet_access eq "no") {
|
||||
$host_tcp_http2 = getTestParameter( "NP_HOST_TCP_HTTP2",
|
||||
"A host providing an index page containing the string 'nagios'",
|
||||
"altinity.com" );
|
||||
"www.nagios.com" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,7 +73,7 @@ SKIP: {
|
|||
skip "No internet access and no host serving nagios in index file",
|
||||
7 if $internet_access eq "no" && ! $host_tcp_http2;
|
||||
|
||||
$host_tcp_http2 = "altinity.com" if (! $host_tcp_http2);
|
||||
$host_tcp_http2 = "www.nagios.com" if (! $host_tcp_http2);
|
||||
|
||||
$res = NPTest->testCmd( "./check_http -H $host_tcp_http2 -r 'nagios'" );
|
||||
cmp_ok( $res->return_code, "==", 0, "Got a reference to 'nagios'");
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# Internet Mail Access Protocol (IMAP) Server Tests via check_imap
|
||||
#
|
||||
# $Id: check_imap.t 1901 2008-01-08 11:57:24Z tonvoon $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# Jabber Server Tests via check_jabber
|
||||
#
|
||||
# $Id: check_jabber.t 1901 2008-01-08 11:57:24Z tonvoon $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# Load Average Tests via check_load
|
||||
#
|
||||
# $Id: check_load.t 1851 2007-12-10 00:19:27Z psychotrahe $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# MySQL Database Server Tests via check_mysql
|
||||
#
|
||||
# $Id: check_mysql.t 1988 2008-04-30 12:50:52Z dermoth $
|
||||
#
|
||||
#
|
||||
# These are the database permissions required for this test:
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# MySQL Database Server Tests via check_mysql
|
||||
#
|
||||
# $Id: check_mysql_query.t 1315 2006-02-01 13:23:38Z tonvoon $
|
||||
#
|
||||
#
|
||||
# These are the database permissions required for this test:
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# check_nagios tests
|
||||
#
|
||||
# $Id: check_nagios.t 1953 2008-03-17 23:08:21Z tonvoon $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# Testing NTP
|
||||
#
|
||||
# $Id: check_ntp.t 1865 2007-12-11 13:54:23Z dermoth $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# Ping Response Tests via check_ping
|
||||
#
|
||||
# $Id: check_ping.t 1639 2007-03-12 10:51:06Z tonvoon $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# Post Office Protocol (POP) Server Tests via check_pop
|
||||
#
|
||||
# $Id: check_pop.t 1901 2008-01-08 11:57:24Z tonvoon $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# Process Tests via check_procs
|
||||
#
|
||||
# $Id: check_procs.t 1937 2008-02-28 16:21:59Z tonvoon $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
@ -11,7 +10,7 @@ use NPTest;
|
|||
|
||||
my $t;
|
||||
|
||||
if (`uname -s` eq "SunOS\n") {
|
||||
if (`uname -s` eq "SunOS\n" && ! -x "/usr/local/nagios/libexec/pst3") {
|
||||
plan skip_all => "Ignoring tests on solaris because of pst3";
|
||||
} else {
|
||||
plan tests => 12;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# Simple Mail Transfer Protocol (SMTP) Test via check_smtp
|
||||
#
|
||||
# $Id: check_smtp.t 1500 2006-10-19 11:56:34Z tonvoon $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
|
|
@ -2,56 +2,132 @@
|
|||
#
|
||||
# Simple Network Management Protocol (SNMP) Test via check_snmp
|
||||
#
|
||||
# $Id: check_snmp.t 1557 2006-12-23 18:59:36Z dermoth $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use Test::More;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
BEGIN {$tests = 12; plan tests => $tests}
|
||||
my $tests = 44;
|
||||
plan tests => $tests;
|
||||
my $res;
|
||||
|
||||
my $t;
|
||||
SKIP: {
|
||||
skip "check_snmp is not compiled", $tests if ( ! -x "./check_snmp" );
|
||||
|
||||
if ( -x "./check_snmp" )
|
||||
{
|
||||
my $host_snmp = getTestParameter( "host_snmp", "NP_HOST_SNMP", "localhost",
|
||||
"A host providing an SNMP Service");
|
||||
my $host_snmp = getTestParameter( "host_snmp", "NP_HOST_SNMP", "localhost",
|
||||
"A host providing an SNMP Service");
|
||||
|
||||
my $snmp_community = getTestParameter( "snmp_community", "NP_SNMP_COMMUNITY", "public",
|
||||
"The SNMP Community string for SNMP Testing" );
|
||||
my $snmp_community = getTestParameter( "snmp_community", "NP_SNMP_COMMUNITY", "public",
|
||||
"The SNMP Community string for SNMP Testing (assumes snmp v1)" );
|
||||
|
||||
my $host_nonresponsive = getTestParameter( "host_nonresponsive", "NP_HOST_NONRESPONSIVE", "10.0.0.1",
|
||||
"The hostname of system not responsive to network requests" );
|
||||
my $host_nonresponsive = getTestParameter( "host_nonresponsive", "NP_HOST_NONRESPONSIVE", "10.0.0.1",
|
||||
"The hostname of system not responsive to network requests" );
|
||||
|
||||
my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost",
|
||||
"An invalid (not known to DNS) hostname" );
|
||||
my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost",
|
||||
"An invalid (not known to DNS) hostname" );
|
||||
|
||||
my %exceptions = ( 3 => "No SNMP Server present?" );
|
||||
$res = NPTest->testCmd( "./check_snmp -t 1" );
|
||||
is( $res->return_code, 3, "No host name" );
|
||||
is( $res->output, "No host specified" );
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H fakehostname" );
|
||||
is( $res->return_code, 3, "No OIDs specified" );
|
||||
is( $res->output, "No OIDs specified" );
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H fakehost -o oids -P 3 --seclevel=rubbish" );
|
||||
is( $res->return_code, 3, "Invalid seclevel" );
|
||||
like( $res->output, "/check_snmp: Invalid seclevel - rubbish/" );
|
||||
|
||||
$t += checkCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:",
|
||||
{ 0 => 'continue', 3 => 'skip' }, '/^SNMP OK - \d+/', %exceptions );
|
||||
$res = NPTest->testCmd( "./check_snmp -H fakehost -o oids -P 3c" );
|
||||
is( $res->return_code, 3, "Invalid protocol" );
|
||||
like( $res->output, "/check_snmp: Invalid SNMP version - 3c/" );
|
||||
|
||||
$t += checkCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w 1:1 -c 1:1",
|
||||
{ 0 => 'continue', 3 => 'skip' }, '/^SNMP OK - 1\s.*$/', %exceptions );
|
||||
SKIP: {
|
||||
skip "no snmp host defined", 32 if ( ! $host_snmp );
|
||||
|
||||
$t += checkCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w 0 -c 1:",
|
||||
{ 1 => 'continue', 3 => 'skip' }, '/^SNMP WARNING - \*1\*\s.*$/', %exceptions );
|
||||
$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:");
|
||||
cmp_ok( $res->return_code, '==', 0, "Exit OK when querying uptime" );
|
||||
like($res->output, '/^SNMP OK - (\d+)/', "String contains SNMP OK");
|
||||
$res->output =~ /^SNMP OK - (\d+)/;
|
||||
my $value = $1;
|
||||
cmp_ok( $value, ">", 0, "Got a time value" );
|
||||
like($res->perf_output, "/sysUpTime.*$1/", "Got perfdata with value '$1' in it");
|
||||
|
||||
$t += checkCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w :0 -c 0",
|
||||
{ 2 => 'continue', 3 => 'skip' }, '/^SNMP CRITICAL - \*1\*\s.*$/', %exceptions );
|
||||
$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysDescr.0");
|
||||
cmp_ok( $res->return_code, '==', 0, "Exit OK when querying sysDescr" );
|
||||
unlike($res->perf_output, '/sysDescr/', "Perfdata doesn't contain string values");
|
||||
|
||||
$t += checkCmd( "./check_snmp -H $host_nonresponsive -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:", 3, '/SNMP problem - /' );
|
||||
$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w 1:1 -c 1:1");
|
||||
cmp_ok( $res->return_code, '==', 0, "Exit OK when querying hrSWRunIndex.1" );
|
||||
like($res->output, '/^SNMP OK - 1\s.*$/', "String fits SNMP OK and output format");
|
||||
|
||||
$t += checkCmd( "./check_snmp -H $hostname_invalid -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:", 3, '/SNMP problem - /' );
|
||||
$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w 0 -c 1:");
|
||||
cmp_ok( $res->return_code, '==', 1, "Exit WARNING when querying hrSWRunIndex.1 and warn-th doesn't apply " );
|
||||
like($res->output, '/^SNMP WARNING - \*1\*\s.*$/', "String matches SNMP WARNING and output format");
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w :0 -c 0");
|
||||
cmp_ok( $res->return_code, '==', 2, "Exit CRITICAL when querying hrSWRunIndex.1 and crit-th doesn't apply" );
|
||||
like($res->output, '/^SNMP CRITICAL - \*1\*\s.*$/', "String matches SNMP CRITICAL and output format");
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o ifIndex.2,ifIndex.1 -w 1:2 -c 1:2");
|
||||
cmp_ok( $res->return_code, '==', 0, "Checking two OIDs at once" );
|
||||
like($res->output, "/^SNMP OK - 2 1/", "Got two values back" );
|
||||
like( $res->perf_output, "/ifIndex.2=2/", "Got 1st perf data" );
|
||||
like( $res->perf_output, "/ifIndex.1=1/", "Got 2nd perf data" );
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o ifIndex.2,ifIndex.1 -w 1:2,1:2 -c 2:2,2:2");
|
||||
cmp_ok( $res->return_code, '==', 2, "Checking critical threshold is passed if any one value crosses" );
|
||||
like($res->output, "/^SNMP CRITICAL - 2 *1*/", "Got two values back" );
|
||||
like( $res->perf_output, "/ifIndex.2=2/", "Got 1st perf data" );
|
||||
like( $res->perf_output, "/ifIndex.1=1/", "Got 2nd perf data" );
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrStorage.hrMemorySize.0,host.hrSystem.hrSystemProcesses.0 -w 1:,1: -c 1:,1:");
|
||||
cmp_ok( $res->return_code, '==', 0, "Exit OK when querying hrMemorySize and hrSystemProcesses");
|
||||
like($res->output, '/^SNMP OK - \d+ \d+/', "String contains hrMemorySize and hrSystemProcesses");
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w \@:0 -c \@0");
|
||||
cmp_ok( $res->return_code, '==', 0, "Exit OK with inside-range thresholds");
|
||||
like($res->output, '/^SNMP OK - 1\s.*$/', "String matches SNMP OK and output format");
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o enterprises.ucdavis.laTable.laEntry.laLoad.3");
|
||||
$res->output =~ m/^SNMP OK - (\d+\.\d{2})\s.*$/;
|
||||
my $lower = $1 - 0.05;
|
||||
my $higher = $1 + 0.05;
|
||||
$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o enterprises.ucdavis.laTable.laEntry.laLoad.3 -w $lower -c $higher");
|
||||
cmp_ok( $res->return_code, '==', 1, "Exit WARNING with fractionnal arcuments");
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysUpTime.0,host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w ,:0 -c ,:2");
|
||||
cmp_ok( $res->return_code, '==', 1, "Exit WARNING on 2nd threshold");
|
||||
like($res->output, '/^SNMP WARNING - Timeticks:\s\(\d+\)\s.*,\s.*\s\*1\*\s.*$/', "First OID returned as string, 2nd checked for thresholds");
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunIndex.1 -w '' -c ''");
|
||||
cmp_ok( $res->return_code, '==', 0, "Empty thresholds doesn't crash");
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrStorage.hrMemorySize.0,host.hrSystem.hrSystemProcesses.0 -w ,,1 -c ,,2");
|
||||
cmp_ok( $res->return_code, '==', 0, "Skipping first two thresholds on 2 OID check");
|
||||
like($res->output, '/^SNMP OK - \d+ \w+ \d+\s.*$/', "Skipping first two thresholds, result printed rather than parsed");
|
||||
|
||||
$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o host.hrStorage.hrMemorySize.0,host.hrSystem.hrSystemProcesses.0 -w ,, -c ,,");
|
||||
cmp_ok( $res->return_code, '==', 0, "Skipping all thresholds");
|
||||
like($res->output, '/^SNMP OK - \d+ \w+ \d+\s.*$/', "Skipping all thresholds, result printed rather than parsed");
|
||||
|
||||
}
|
||||
|
||||
# These checks need a complete command line. An invalid community is used so
|
||||
# the tests can run on hosts w/o snmp host/community in NPTest.cache. Execution will fail anyway
|
||||
SKIP: {
|
||||
skip "no non responsive host defined", 2 if ( ! $host_nonresponsive );
|
||||
$res = NPTest->testCmd( "./check_snmp -H $host_nonresponsive -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:");
|
||||
cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" );
|
||||
like($res->output, '/External command error: Timeout: No Response from /', "String matches timeout problem");
|
||||
}
|
||||
|
||||
SKIP: {
|
||||
skip "no non invalid host defined", 2 if ( ! $hostname_invalid );
|
||||
$res = NPTest->testCmd( "./check_snmp -H $hostname_invalid -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:");
|
||||
cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" );
|
||||
like($res->output, '/External command error: .*(nosuchhost|Name or service not known|Unknown host)/', "String matches invalid host");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$t += skipMissingCmd( "./check_snmp", $tests );
|
||||
}
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# Swap Space Tests via check_swap
|
||||
#
|
||||
# $Id: check_swap.t 1279 2005-11-09 16:40:12Z tonvoon $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# TCP Connection Based Tests via check_tcp
|
||||
#
|
||||
# $Id: check_tcp.t 1901 2008-01-08 11:57:24Z tonvoon $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# System Time Tests via check_time
|
||||
#
|
||||
# $Id: check_time.t 1270 2005-11-03 15:04:16Z tonvoon $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#
|
||||
# UDP Connection Based Tests via check_udp
|
||||
#
|
||||
# $Id: check_udp.t 1459 2006-07-28 22:44:11Z tonvoon $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
#
|
||||
# Logged in Users Tests via check_users
|
||||
#
|
||||
# $Id: check_users.t 1207 2005-07-25 01:47:15Z illumino $
|
||||
# Trick: This ckeck requires at least 1 user logged in. These commands should
|
||||
# leave a session open forever in the background:
|
||||
#
|
||||
# $ ssh -tt localhost </dev/null >/dev/null 2>/dev/null &
|
||||
# $ disown %1
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
|
|
|
@ -3,15 +3,13 @@
|
|||
# negate checks
|
||||
# Need check_dummy to work for testing
|
||||
#
|
||||
# $Id: negate.pl 1717 2007-05-24 08:53:50Z tonvoon $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test::More;
|
||||
use NPTest;
|
||||
|
||||
# 15 tests in the first part and 32 in the last loop
|
||||
plan tests => 47;
|
||||
# 15 tests in the first part, 9 in timeout tests and 2 * 32 in the last loops
|
||||
plan tests => 88;
|
||||
|
||||
my $res;
|
||||
|
||||
|
@ -55,18 +53,37 @@ is( $res->output, "No data returned from command", "Bad command, as expected (tr
|
|||
$res = NPTest->testCmd( './negate $PWD/check_dummy 0 \'$$ a dummy okay\'' );
|
||||
is( $res->output, 'OK: $$ a dummy okay', 'Proves that $$ is not being expanded again' );
|
||||
|
||||
|
||||
my %state = (
|
||||
ok => 0,
|
||||
warning => 1,
|
||||
critical => 2,
|
||||
unknown => 3,
|
||||
);
|
||||
foreach my $current_state (qw(ok warning critical unknown)) {
|
||||
foreach my $new_state (qw(ok warning critical unknown)) {
|
||||
|
||||
# Timeout tests
|
||||
$res = NPTest->testCmd( "./negate -t 2 /bin/sh -c 'sleep 5'" );
|
||||
is( $res->output, 'CRITICAL - Plugin timed out after 2 seconds' );
|
||||
|
||||
foreach my $state (keys(%state)) {
|
||||
$res = NPTest->testCmd( "./negate -t 2 -T $state /bin/sh -c 'sleep 5'" );
|
||||
is( $res->return_code, $state{$state}, "Got timeout state $state" );
|
||||
is( $res->output, uc($state)." - Plugin timed out after 2 seconds", "Timeout state $state output");
|
||||
}
|
||||
|
||||
foreach my $current_state (keys(%state)) {
|
||||
foreach my $new_state (keys(%state)) {
|
||||
$res = NPTest->testCmd( "./negate --$current_state=$new_state ./check_dummy ".$state{$current_state}." 'Fake $new_state'" );
|
||||
is( $res->return_code, $state{$new_state}, "Got fake $new_state" );
|
||||
is( $res->output, uc($current_state).": Fake $new_state" );
|
||||
is( $res->output, uc($current_state).": Fake $new_state", "Fake $new_state output");
|
||||
}
|
||||
}
|
||||
|
||||
# Same as aboce with substitute
|
||||
foreach my $current_state (keys(%state)) {
|
||||
foreach my $new_state (keys(%state)) {
|
||||
$res = NPTest->testCmd( "./negate -s --$current_state=$new_state ./check_dummy ".$state{$current_state}." 'Fake $new_state'" );
|
||||
is( $res->return_code, $state{$new_state}, "Got fake $new_state (with substitute)" );
|
||||
is( $res->output, uc($new_state).": Fake $new_state", "Substitued fake $new_state output");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,15 +5,13 @@
|
|||
* License: GPL
|
||||
* 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.
|
||||
* tags, thus displaying the child plugin's output as a clickable link in the
|
||||
* Nagios status screen. This plugin returns the status of the invoked plugin.
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
@ -29,12 +27,10 @@
|
|||
* 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: urlize.c 1918 2008-01-31 11:27:22Z dermoth $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "urlize";
|
||||
const char *revision = "$Revision: 1918 $";
|
||||
const char *copyright = "2000-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -79,7 +75,7 @@ main (int argc, char **argv)
|
|||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "+hVu:", longopts, &option);
|
||||
|
||||
|
||||
if (c == -1 || c == EOF)
|
||||
break;
|
||||
|
||||
|
@ -89,7 +85,7 @@ main (int argc, char **argv)
|
|||
exit (EXIT_SUCCESS);
|
||||
break;
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
exit (EXIT_SUCCESS);
|
||||
break;
|
||||
case 'u':
|
||||
|
@ -144,7 +140,7 @@ main (int argc, char **argv)
|
|||
printf ("%s", nstr);
|
||||
printf ("</A>");
|
||||
nstr = strtok(NULL, PERF_CHARACTER);
|
||||
if (nstr != NULL)
|
||||
if (nstr != NULL)
|
||||
printf (" | %s", nstr);
|
||||
|
||||
/* close the pipe */
|
||||
|
@ -165,14 +161,14 @@ main (int argc, char **argv)
|
|||
void
|
||||
print_help (void)
|
||||
{
|
||||
print_revision (progname, revision);
|
||||
print_revision (progname, NP_VERSION);
|
||||
|
||||
printf ("Copyright (c) 2000 Karl DeBisschop <kdebisschop@users.sourceforge.net>\n");
|
||||
printf (COPYRIGHT, copyright, email);
|
||||
|
||||
printf ("%s\n", _("This plugin wraps the text output of another command (plugin)"));
|
||||
printf ("%s\n", _("in HTML <A> tags, thus displaying the plugin output in as a clickable link in"));
|
||||
printf ("%s\n", _("the Nagios status screen. The return status is the same as the invoked plugin."));
|
||||
printf ("%s\n", _("in HTML <A> tags, thus displaying the child plugin's output as a clickable link in"));
|
||||
printf ("%s\n", _("the Nagios status screen. This plugin returns the status of the invoked plugin."));
|
||||
|
||||
printf ("\n\n");
|
||||
|
||||
|
|
|
@ -6,9 +6,6 @@
|
|||
* 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
|
||||
|
@ -22,7 +19,6 @@
|
|||
* 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 $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
@ -142,24 +138,13 @@ usage5 (void)
|
|||
exit (STATE_UNKNOWN);
|
||||
}
|
||||
|
||||
char *
|
||||
clean_revstring (const char *revstring)
|
||||
{
|
||||
char plugin_revision[STRLEN];
|
||||
plugin_revision[0] = 'v';
|
||||
if (sscanf (revstring,"$Revision: %[0-9.]", plugin_revision + 1) == 1)
|
||||
return strscpy (NULL, plugin_revision);
|
||||
else
|
||||
return strscpy (NULL, "N/A");
|
||||
}
|
||||
|
||||
void
|
||||
print_revision (const char *command_name, const char *revision_string)
|
||||
print_revision (const char *command_name, const char *revision)
|
||||
{
|
||||
char plugin_revision[STRLEN];
|
||||
|
||||
printf ("%s %s (%s %s)\n",
|
||||
command_name, clean_revstring(revision_string), PACKAGE, VERSION);
|
||||
printf ("%s v%s (%s %s)\n",
|
||||
command_name, revision, PACKAGE, VERSION);
|
||||
}
|
||||
|
||||
const char *
|
||||
|
@ -183,9 +168,9 @@ void
|
|||
timeout_alarm_handler (int signo)
|
||||
{
|
||||
if (signo == SIGALRM) {
|
||||
printf (_("CRITICAL - Plugin timed out after %d seconds\n"),
|
||||
timeout_interval);
|
||||
exit (STATE_CRITICAL);
|
||||
printf (_("%s - Plugin timed out after %d seconds\n"),
|
||||
state_text(timeout_state), timeout_interval);
|
||||
exit (timeout_state);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,18 +26,17 @@ suite of plugins. */
|
|||
|
||||
/* Standardize version information, termination */
|
||||
|
||||
/* $Id: utils.h 1991 2008-05-07 10:02:42Z dermoth $ */
|
||||
|
||||
void support (void);
|
||||
char *clean_revstring (const char *);
|
||||
void print_revision (const char *, const char *);
|
||||
|
||||
/* Handle timeouts */
|
||||
|
||||
#ifdef LOCAL_TIMEOUT_ALARM_HANDLER
|
||||
extern unsigned int timeout_state;
|
||||
extern unsigned int timeout_interval;
|
||||
RETSIGTYPE timeout_alarm_handler (int);
|
||||
#else
|
||||
unsigned int timeout_state = STATE_CRITICAL;
|
||||
unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT;
|
||||
extern RETSIGTYPE timeout_alarm_handler (int);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue