Imported Upstream version 1.4.8
This commit is contained in:
parent
6a280f6f24
commit
6dd54dd8e2
352 changed files with 42813 additions and 27251 deletions
|
@ -2,12 +2,12 @@
|
|||
|
||||
VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plugins/t
|
||||
|
||||
INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/intl @LDAPINCLUDE@ @PGINCLUDE@ @SSLINCLUDE@
|
||||
INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I$(top_srcdir)/intl @LDAPINCLUDE@ @PGINCLUDE@ @SSLINCLUDE@
|
||||
|
||||
datadir = @datadir@
|
||||
localedir = $(datadir)/locale
|
||||
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
|
||||
LIBS = @LIBINTL@ @LIBS@ @SSLLIBS@
|
||||
LIBS = @LIBINTL@ @LIBS@
|
||||
MATHLIBS = @MATHLIBS@
|
||||
|
||||
# This is not portable. Run ". tools/devmode" to get development compile flags
|
||||
|
@ -28,12 +28,11 @@ EXTRA_PROGRAMS = check_mysql check_radius check_pgsql check_snmp check_hpjd \
|
|||
check_procs check_mysql_query check_apt
|
||||
|
||||
EXTRA_DIST = t utils.c netutils.c sslutils.c popen.c utils.h netutils.h \
|
||||
popen.h common.h getaddrinfo.c getaddrinfo.h \
|
||||
gethostbyname.c gethostbyname.h runcmd.c runcmd.h
|
||||
popen.h common.h runcmd.c runcmd.h
|
||||
|
||||
PLUGINHDRS = common.h
|
||||
|
||||
BASEOBJS = utils.o ../lib/libnagiosplug.a ../lib/libcoreutils.a
|
||||
BASEOBJS = utils.o ../lib/libnagiosplug.a ../gl/libgnu.a
|
||||
NETOBJS = netutils.o $(BASEOBJS) $(EXTRA_NETOBJS)
|
||||
SSLOBJS = sslutils.o
|
||||
NETLIBS = $(NETOBJS) $(SOCKETLIBS)
|
||||
|
@ -55,7 +54,7 @@ check_dns_LDADD = $(NETLIBS) runcmd.o
|
|||
check_dummy_LDADD = $(BASEOBJS)
|
||||
check_fping_LDADD = $(NETLIBS) popen.o
|
||||
check_game_LDADD = $(BASEOBJS) runcmd.o
|
||||
check_http_LDADD = $(SSLOBJS) $(NETLIBS)
|
||||
check_http_LDADD = $(SSLOBJS) $(NETLIBS) $(SSLLIBS)
|
||||
check_hpjd_LDADD = $(NETLIBS) popen.o
|
||||
check_ldap_LDADD = $(NETLIBS) $(LDAPLIBS)
|
||||
check_load_LDADD = $(BASEOBJS) popen.o
|
||||
|
@ -78,10 +77,10 @@ check_procs_LDADD = $(BASEOBJS) popen.o
|
|||
check_radius_LDADD = $(NETLIBS) $(RADIUSLIBS)
|
||||
check_real_LDADD = $(NETLIBS)
|
||||
check_snmp_LDADD = $(BASEOBJS) popen.o
|
||||
check_smtp_LDADD = $(SSLOBJS) $(NETLIBS)
|
||||
check_smtp_LDADD = $(SSLOBJS) $(NETLIBS) $(SSLLIBS)
|
||||
check_ssh_LDADD = $(NETLIBS)
|
||||
check_swap_LDADD = $(MATHLIBS) $(BASEOBJS) popen.o
|
||||
check_tcp_LDADD = $(SSLOBJS) $(NETLIBS)
|
||||
check_tcp_LDADD = $(SSLOBJS) $(NETLIBS) $(SSLLIBS)
|
||||
check_time_LDADD = $(NETLIBS)
|
||||
check_ups_LDADD = $(NETLIBS)
|
||||
check_users_LDADD = $(BASEOBJS) popen.o
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# Makefile.in generated by automake 1.9.4 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.9.6 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004 Free Software Foundation, Inc.
|
||||
# 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
@ -14,8 +14,6 @@
|
|||
|
||||
@SET_MAKE@
|
||||
|
||||
SOURCES = check_apt.c check_by_ssh.c check_dig.c check_disk.c check_dns.c check_dummy.c check_fping.c check_game.c check_hpjd.c check_http.c check_ide_smart.c check_ldap.c check_load.c check_mrtg.c check_mrtgtraf.c check_mysql.c check_mysql_query.c check_nagios.c check_nt.c check_ntp.c check_nwstat.c check_overcr.c check_pgsql.c check_ping.c check_procs.c check_radius.c check_real.c check_smtp.c check_snmp.c check_ssh.c check_swap.c check_tcp.c check_time.c check_ups.c check_users.c negate.c urlize.c
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
|
@ -54,28 +52,64 @@ EXTRA_PROGRAMS = check_mysql$(EXEEXT) check_radius$(EXEEXT) \
|
|||
subdir = plugins
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/afs.m4 \
|
||||
$(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/basename.m4 \
|
||||
$(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/codeset.m4 \
|
||||
$(top_srcdir)/m4/dos.m4 $(top_srcdir)/m4/exitfail.m4 \
|
||||
$(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/fcntl-safer.m4 \
|
||||
$(top_srcdir)/m4/fstypename.m4 $(top_srcdir)/m4/fsusage.m4 \
|
||||
$(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gettext.m4 \
|
||||
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/inttypes_h.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/ls-mntd-fs.m4 \
|
||||
$(top_srcdir)/m4/mountlist.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
$(top_srcdir)/m4/np_coreutils.m4 $(top_srcdir)/m4/np_curl.m4 \
|
||||
$(top_srcdir)/m4/onceonly_2_57.m4 $(top_srcdir)/m4/po.m4 \
|
||||
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/regex.m4 \
|
||||
$(top_srcdir)/m4/restrict.m4 $(top_srcdir)/m4/stdbool.m4 \
|
||||
$(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/m4/unistd-safer.m4 \
|
||||
$(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/xalloc.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.in
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/np_mysqlclient.m4 \
|
||||
$(top_srcdir)/gl/m4/absolute-header.m4 \
|
||||
$(top_srcdir)/gl/m4/alloca.m4 \
|
||||
$(top_srcdir)/gl/m4/arpa_inet_h.m4 \
|
||||
$(top_srcdir)/gl/m4/c-strtod.m4 $(top_srcdir)/gl/m4/cloexec.m4 \
|
||||
$(top_srcdir)/gl/m4/codeset.m4 $(top_srcdir)/gl/m4/dirname.m4 \
|
||||
$(top_srcdir)/gl/m4/dos.m4 \
|
||||
$(top_srcdir)/gl/m4/double-slash-root.m4 \
|
||||
$(top_srcdir)/gl/m4/eoverflow.m4 $(top_srcdir)/gl/m4/error.m4 \
|
||||
$(top_srcdir)/gl/m4/exitfail.m4 \
|
||||
$(top_srcdir)/gl/m4/extensions.m4 \
|
||||
$(top_srcdir)/gl/m4/fcntl-safer.m4 \
|
||||
$(top_srcdir)/gl/m4/fstypename.m4 \
|
||||
$(top_srcdir)/gl/m4/fsusage.m4 \
|
||||
$(top_srcdir)/gl/m4/getaddrinfo.m4 \
|
||||
$(top_srcdir)/gl/m4/gethostname.m4 \
|
||||
$(top_srcdir)/gl/m4/getloadavg.m4 \
|
||||
$(top_srcdir)/gl/m4/getopt.m4 $(top_srcdir)/gl/m4/gettext.m4 \
|
||||
$(top_srcdir)/gl/m4/gnulib-common.m4 \
|
||||
$(top_srcdir)/gl/m4/gnulib-comp.m4 \
|
||||
$(top_srcdir)/gl/m4/iconv.m4 $(top_srcdir)/gl/m4/inet_ntop.m4 \
|
||||
$(top_srcdir)/gl/m4/inline.m4 $(top_srcdir)/gl/m4/intmax_t.m4 \
|
||||
$(top_srcdir)/gl/m4/inttypes_h.m4 \
|
||||
$(top_srcdir)/gl/m4/lib-ld.m4 $(top_srcdir)/gl/m4/lib-link.m4 \
|
||||
$(top_srcdir)/gl/m4/lib-prefix.m4 $(top_srcdir)/gl/m4/lock.m4 \
|
||||
$(top_srcdir)/gl/m4/longdouble.m4 \
|
||||
$(top_srcdir)/gl/m4/longlong.m4 \
|
||||
$(top_srcdir)/gl/m4/ls-mntd-fs.m4 \
|
||||
$(top_srcdir)/gl/m4/mbchar.m4 $(top_srcdir)/gl/m4/mbiter.m4 \
|
||||
$(top_srcdir)/gl/m4/mbrtowc.m4 $(top_srcdir)/gl/m4/memchr.m4 \
|
||||
$(top_srcdir)/gl/m4/minmax.m4 $(top_srcdir)/gl/m4/mountlist.m4 \
|
||||
$(top_srcdir)/gl/m4/netinet_in_h.m4 $(top_srcdir)/gl/m4/nls.m4 \
|
||||
$(top_srcdir)/gl/m4/onceonly_2_57.m4 $(top_srcdir)/gl/m4/po.m4 \
|
||||
$(top_srcdir)/gl/m4/progtest.m4 $(top_srcdir)/gl/m4/regex.m4 \
|
||||
$(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/snprintf.m4 $(top_srcdir)/gl/m4/socklen.m4 \
|
||||
$(top_srcdir)/gl/m4/sockpfaf.m4 $(top_srcdir)/gl/m4/ssize_t.m4 \
|
||||
$(top_srcdir)/gl/m4/stdbool.m4 $(top_srcdir)/gl/m4/stdint.m4 \
|
||||
$(top_srcdir)/gl/m4/stdint_h.m4 $(top_srcdir)/gl/m4/strcase.m4 \
|
||||
$(top_srcdir)/gl/m4/strdup.m4 $(top_srcdir)/gl/m4/strndup.m4 \
|
||||
$(top_srcdir)/gl/m4/strnlen.m4 \
|
||||
$(top_srcdir)/gl/m4/sys_socket_h.m4 \
|
||||
$(top_srcdir)/gl/m4/ulonglong.m4 \
|
||||
$(top_srcdir)/gl/m4/unistd-safer.m4 \
|
||||
$(top_srcdir)/gl/m4/unistd_h.m4 \
|
||||
$(top_srcdir)/gl/m4/vasnprintf.m4 \
|
||||
$(top_srcdir)/gl/m4/vasprintf.m4 \
|
||||
$(top_srcdir)/gl/m4/vsnprintf.m4 $(top_srcdir)/gl/m4/wchar.m4 \
|
||||
$(top_srcdir)/gl/m4/wchar_t.m4 $(top_srcdir)/gl/m4/wctype.m4 \
|
||||
$(top_srcdir)/gl/m4/wcwidth.m4 $(top_srcdir)/gl/m4/wint_t.m4 \
|
||||
$(top_srcdir)/gl/m4/xalloc.m4 $(top_srcdir)/gl/m4/xsize.m4 \
|
||||
$(top_srcdir)/gl/m4/xstrndup.m4 $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(libexecdir)"
|
||||
|
@ -83,8 +117,7 @@ libexecPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
|
|||
PROGRAMS = $(libexec_PROGRAMS)
|
||||
check_apt_SOURCES = check_apt.c
|
||||
check_apt_OBJECTS = check_apt.$(OBJEXT)
|
||||
am__DEPENDENCIES_1 = utils.o ../lib/libnagiosplug.a \
|
||||
../lib/libcoreutils.a
|
||||
am__DEPENDENCIES_1 = utils.o ../lib/libnagiosplug.a ../gl/libgnu.a
|
||||
check_by_ssh_SOURCES = check_by_ssh.c
|
||||
check_by_ssh_OBJECTS = check_by_ssh.$(OBJEXT)
|
||||
am__DEPENDENCIES_2 =
|
||||
|
@ -164,7 +197,7 @@ negate_OBJECTS = negate.$(OBJEXT)
|
|||
urlize_SOURCES = urlize.c
|
||||
urlize_OBJECTS = urlize.$(OBJEXT)
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
|
@ -197,6 +230,10 @@ CTAGS = ctags
|
|||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plugins/t
|
||||
INSTALL = @INSTALL@
|
||||
ABSOLUTE_STDINT_H = @ABSOLUTE_STDINT_H@
|
||||
ABSOLUTE_UNISTD_H = @ABSOLUTE_UNISTD_H@
|
||||
ABSOLUTE_WCHAR_H = @ABSOLUTE_WCHAR_H@
|
||||
ABSOLUTE_WCTYPE_H = @ABSOLUTE_WCTYPE_H@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALLOCA = @ALLOCA@
|
||||
ALLOCA_H = @ALLOCA_H@
|
||||
|
@ -204,11 +241,17 @@ AMDEP_FALSE = @AMDEP_FALSE@
|
|||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
ARPA_INET_H = @ARPA_INET_H@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
BASENAME = @BASENAME@
|
||||
BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@
|
||||
BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
|
||||
BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
|
||||
BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
|
||||
BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
|
@ -227,6 +270,7 @@ ECHO_C = @ECHO_C@
|
|||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EOVERFLOW = @EOVERFLOW@
|
||||
EXEEXT = @EXEEXT@
|
||||
EXTRAS = @EXTRAS@
|
||||
EXTRAS_ROOT = @EXTRAS_ROOT@
|
||||
|
@ -236,7 +280,22 @@ F77 = @F77@
|
|||
FFLAGS = @FFLAGS@
|
||||
GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
|
||||
GETOPT_H = @GETOPT_H@
|
||||
GL_COND_LIBTOOL_FALSE = @GL_COND_LIBTOOL_FALSE@
|
||||
GL_COND_LIBTOOL_TRUE = @GL_COND_LIBTOOL_TRUE@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GMSGFMT_015 = @GMSGFMT_015@
|
||||
HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
|
||||
HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
|
||||
HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
|
||||
HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
|
||||
HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
|
||||
HAVE_STDINT_H = @HAVE_STDINT_H@
|
||||
HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
|
||||
HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
|
||||
HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
|
||||
HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
|
||||
HAVE_WCTYPE_H = @HAVE_WCTYPE_H@
|
||||
HAVE_WINT_T = @HAVE_WINT_T@
|
||||
HAVE__BOOL = @HAVE__BOOL@
|
||||
HOSTNAME = @HOSTNAME@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
@ -251,10 +310,12 @@ LDAPINCLUDE = @LDAPINCLUDE@
|
|||
LDAPLIBS = @LDAPLIBS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@
|
||||
LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@
|
||||
LIBGNU_LTLIBDEPS = @LIBGNU_LTLIBDEPS@
|
||||
LIBICONV = @LIBICONV@
|
||||
LIBINTL = @LIBINTL@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBINTL@ @LIBS@ @SSLLIBS@
|
||||
LIBS = @LIBINTL@ @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
|
@ -262,15 +323,15 @@ LTLIBINTL = @LTLIBINTL@
|
|||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MATHLIBS = @MATHLIBS@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MSGFMT = @MSGFMT@
|
||||
MSGFMT_015 = @MSGFMT_015@
|
||||
MSGMERGE = @MSGMERGE@
|
||||
MYSQLCFLAGS = @MYSQLCFLAGS@
|
||||
MYSQLCONFIG = @MYSQLCONFIG@
|
||||
MYSQLINCLUDE = @MYSQLINCLUDE@
|
||||
MYSQLLIBS = @MYSQLLIBS@
|
||||
NEED_SETGID = @NEED_SETGID@
|
||||
NEED_VA_LIST = @NEED_VA_LIST@
|
||||
NETINET_IN_H = @NETINET_IN_H@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
|
@ -308,6 +369,7 @@ PKG_ARCH = @PKG_ARCH@
|
|||
PLUGIN_TEST = @PLUGIN_TEST@
|
||||
POSUB = @POSUB@
|
||||
POW_LIB = @POW_LIB@
|
||||
PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
|
||||
PYTHON = @PYTHON@
|
||||
RADIUSLIBS = @RADIUSLIBS@
|
||||
RANLIB = @RANLIB@
|
||||
|
@ -318,16 +380,26 @@ SCRIPT_TEST = @SCRIPT_TEST@
|
|||
SET_MAKE = @SET_MAKE@
|
||||
SH = @SH@
|
||||
SHELL = @SHELL@
|
||||
SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
|
||||
SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
|
||||
SOCKETLIBS = @SOCKETLIBS@
|
||||
SSLINCLUDE = @SSLINCLUDE@
|
||||
SSLLIBS = @SSLLIBS@
|
||||
STDBOOL_H = @STDBOOL_H@
|
||||
STDINT_H = @STDINT_H@
|
||||
STRIP = @STRIP@
|
||||
SUPPORT = @SUPPORT@
|
||||
SYS_SOCKET_H = @SYS_SOCKET_H@
|
||||
UNISTD_H = @UNISTD_H@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
WARRANTY = @WARRANTY@
|
||||
WCHAR_H = @WCHAR_H@
|
||||
WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
|
||||
WCTYPE_H = @WCTYPE_H@
|
||||
WINT_T_SUFFIX = @WINT_T_SUFFIX@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
XGETTEXT_015 = @XGETTEXT_015@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
|
@ -352,6 +424,8 @@ build_vendor = @build_vendor@
|
|||
check_tcp_ssl = @check_tcp_ssl@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
gl_LIBOBJS = @gl_LIBOBJS@
|
||||
gl_LTLIBOBJS = @gl_LTLIBOBJS@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
|
@ -362,9 +436,11 @@ infodir = @infodir@
|
|||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = $(datadir)/locale
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
np_mysql_config = @np_mysql_config@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
|
@ -373,17 +449,15 @@ sharedstatedir = @sharedstatedir@
|
|||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
with_trusted_path = @with_trusted_path@
|
||||
INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/intl @LDAPINCLUDE@ @PGINCLUDE@ @SSLINCLUDE@
|
||||
localedir = $(datadir)/locale
|
||||
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@
|
||||
|
||||
EXTRA_DIST = t utils.c netutils.c sslutils.c popen.c utils.h netutils.h \
|
||||
popen.h common.h getaddrinfo.c getaddrinfo.h \
|
||||
gethostbyname.c gethostbyname.h runcmd.c runcmd.h
|
||||
popen.h common.h runcmd.c runcmd.h
|
||||
|
||||
PLUGINHDRS = common.h
|
||||
BASEOBJS = utils.o ../lib/libnagiosplug.a ../lib/libcoreutils.a
|
||||
BASEOBJS = utils.o ../lib/libnagiosplug.a ../gl/libgnu.a
|
||||
NETOBJS = netutils.o $(BASEOBJS) $(EXTRA_NETOBJS)
|
||||
SSLOBJS = sslutils.o
|
||||
NETLIBS = $(NETOBJS) $(SOCKETLIBS)
|
||||
|
@ -399,7 +473,7 @@ check_dns_LDADD = $(NETLIBS) runcmd.o
|
|||
check_dummy_LDADD = $(BASEOBJS)
|
||||
check_fping_LDADD = $(NETLIBS) popen.o
|
||||
check_game_LDADD = $(BASEOBJS) runcmd.o
|
||||
check_http_LDADD = $(SSLOBJS) $(NETLIBS)
|
||||
check_http_LDADD = $(SSLOBJS) $(NETLIBS) $(SSLLIBS)
|
||||
check_hpjd_LDADD = $(NETLIBS) popen.o
|
||||
check_ldap_LDADD = $(NETLIBS) $(LDAPLIBS)
|
||||
check_load_LDADD = $(BASEOBJS) popen.o
|
||||
|
@ -422,10 +496,10 @@ check_procs_LDADD = $(BASEOBJS) popen.o
|
|||
check_radius_LDADD = $(NETLIBS) $(RADIUSLIBS)
|
||||
check_real_LDADD = $(NETLIBS)
|
||||
check_snmp_LDADD = $(BASEOBJS) popen.o
|
||||
check_smtp_LDADD = $(SSLOBJS) $(NETLIBS)
|
||||
check_smtp_LDADD = $(SSLOBJS) $(NETLIBS) $(SSLLIBS)
|
||||
check_ssh_LDADD = $(NETLIBS)
|
||||
check_swap_LDADD = $(MATHLIBS) $(BASEOBJS) popen.o
|
||||
check_tcp_LDADD = $(SSLOBJS) $(NETLIBS)
|
||||
check_tcp_LDADD = $(SSLOBJS) $(NETLIBS) $(SSLLIBS)
|
||||
check_time_LDADD = $(NETLIBS)
|
||||
check_ups_LDADD = $(NETLIBS)
|
||||
check_users_LDADD = $(BASEOBJS) popen.o
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* Original author: sean finney
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/22 22:03:31 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:40 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -31,12 +31,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: check_apt.c,v 1.9 2006/10/22 22:03:31 opensides Exp $
|
||||
* $Id: check_apt.c,v 1.10 2007/01/28 21:46:40 hweiss Exp $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_apt";
|
||||
const char *revision = "$Revision: 1.9 $";
|
||||
const char *revision = "$Revision: 1.10 $";
|
||||
const char *copyright = "2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -201,7 +201,7 @@ int process_arguments (int argc, char **argv) {
|
|||
break;
|
||||
default:
|
||||
/* print short usage statement if args not parsable */
|
||||
usage_va(_("Unknown argument - %s"), optarg);
|
||||
usage5();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 00:25:16 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:40 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -27,12 +27,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: check_by_ssh.c,v 1.39 2006/10/19 00:25:16 opensides Exp $
|
||||
* $Id: check_by_ssh.c,v 1.41 2007/01/28 21:46:40 hweiss Exp $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_by_ssh";
|
||||
const char *revision = "$Revision: 1.39 $";
|
||||
const char *revision = "$Revision: 1.41 $";
|
||||
const char *copyright = "2000-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -166,6 +166,8 @@ process_arguments (int argc, char **argv)
|
|||
{"proto2", no_argument, 0, '2'},
|
||||
{"use-ipv4", no_argument, 0, '4'},
|
||||
{"use-ipv6", no_argument, 0, '6'},
|
||||
{"ssh-option", required_argument, 0, 'o'},
|
||||
{"quiet", no_argument, 0, 'q'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
@ -177,7 +179,7 @@ process_arguments (int argc, char **argv)
|
|||
strcpy (argv[c], "-t");
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "Vvh1246ft:H:O:p:i:u:l:C:S:n:s:", longopts,
|
||||
c = getopt_long (argc, argv, "Vvh1246fqt:H:O:p:i:u:l:C:S:n:s:o:", longopts,
|
||||
&option);
|
||||
|
||||
if (c == -1 || c == EOF)
|
||||
|
@ -253,8 +255,14 @@ process_arguments (int argc, char **argv)
|
|||
else
|
||||
skip = atoi (optarg);
|
||||
break;
|
||||
case 'o': /* Extra options for the ssh command */
|
||||
asprintf (&comm, "%s -%c '%s'", comm, c, optarg);
|
||||
break;
|
||||
case 'q': /* Tell the ssh command to be quiet */
|
||||
asprintf (&comm, "%s -%c", comm, c);
|
||||
break;
|
||||
default: /* help */
|
||||
usage_va(_("Unknown argument - %s"), optarg);
|
||||
usage5();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -344,6 +352,10 @@ print_help (void)
|
|||
printf (" %s\n", _("list of nagios service names, separated by ':' [optional]"));
|
||||
printf (" %s\n","-n, --name=NAME");
|
||||
printf (" %s\n", _("short name of host in nagios configuration [optional]"));
|
||||
printf (" %s\n","-o, --ssh-option=OPTION");
|
||||
printf (" %s\n", _("Call ssh with '-o OPTION' (may be used multiple times) [optional]"));
|
||||
printf (" %s\n","-q, --quiet");
|
||||
printf (" %s\n", _("Tell ssh to suppress warning and diagnostic messages [optional]"));
|
||||
printf (_(UT_WARN_CRIT));
|
||||
printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (" %s\n", _("The most common mode of use is to refer to a local identity file with"));
|
||||
|
@ -371,6 +383,6 @@ void
|
|||
print_usage (void)
|
||||
{
|
||||
printf (_("Usage:"));
|
||||
printf(" %s [-f46] [-t timeout] [-i identity] [-l user] -H <host> -C <command>",progname);
|
||||
printf(" [-n name] [-s servicelist] [-O outputfile] [-p port]\n");
|
||||
printf(" %s [-fq46] [-t timeout] [-i identity] [-l user] -H <host> -C <command>",progname);
|
||||
printf(" [-n name] [-s servicelist] [-O outputfile] [-p port] [-o ssh-option]\n");
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 00:25:16 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:40 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -27,7 +27,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: check_dig.c,v 1.45 2006/10/19 00:25:16 opensides Exp $
|
||||
* $Id: check_dig.c,v 1.46 2007/01/28 21:46:40 hweiss Exp $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
|||
* because on some architectures those strings are in non-writable memory */
|
||||
|
||||
const char *progname = "check_dig";
|
||||
const char *revision = "$Revision: 1.45 $";
|
||||
const char *revision = "$Revision: 1.46 $";
|
||||
const char *copyright = "2002-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -265,8 +265,8 @@ process_arguments (int argc, char **argv)
|
|||
case 'a':
|
||||
expected_address = optarg;
|
||||
break;
|
||||
default: /* usage_va */
|
||||
usage_va(_("Unknown argument - %s"), optarg);
|
||||
default: /* usage5 */
|
||||
usage5();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/26 20:51:24 $
|
||||
* Last Modified: $Date: 2007/03/30 08:56:47 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -27,18 +27,21 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: check_disk.c,v 1.79 2006/10/26 20:51:24 tonvoon Exp $
|
||||
* $Id: check_disk.c,v 1.90 2007/03/30 08:56:47 psychotrahe Exp $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_disk";
|
||||
const char *program_name = "check_disk"; /* Required for coreutils libs */
|
||||
const char *revision = "$Revision: 1.79 $";
|
||||
const char *revision = "$Revision: 1.90 $";
|
||||
const char *copyright = "1999-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
||||
#include "common.h"
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
#if HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
@ -53,6 +56,7 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
|||
#if HAVE_LIMITS_H
|
||||
# include <limits.h>
|
||||
#endif
|
||||
#include "regex.h"
|
||||
|
||||
|
||||
/* If nonzero, show inode information. */
|
||||
|
@ -118,6 +122,7 @@ 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);
|
||||
int validate_arguments (uintmax_t, uintmax_t, double, double, double, double, char *);
|
||||
void print_help (void);
|
||||
void print_usage (void);
|
||||
|
@ -143,6 +148,10 @@ char *warn_usedspace_percent = NULL;
|
|||
char *crit_usedspace_percent = NULL;
|
||||
char *warn_usedinodes_percent = NULL;
|
||||
char *crit_usedinodes_percent = NULL;
|
||||
char *warn_freeinodes_percent = NULL;
|
||||
char *crit_freeinodes_percent = NULL;
|
||||
bool path_selected = false;
|
||||
char *group = NULL;
|
||||
|
||||
|
||||
int
|
||||
|
@ -159,12 +168,12 @@ main (int argc, char **argv)
|
|||
double dfree_pct = -1, dused_pct = -1;
|
||||
double dused_units, dfree_units, dtotal_units;
|
||||
double dused_inodes_percent, dfree_inodes_percent;
|
||||
double warning_high_tide = UINT_MAX;
|
||||
double critical_high_tide = UINT_MAX;
|
||||
double warning_high_tide;
|
||||
double critical_high_tide;
|
||||
int temp_result;
|
||||
|
||||
struct mount_entry *me;
|
||||
struct fs_usage fsp;
|
||||
struct fs_usage fsp, tmpfsp;
|
||||
struct parameter_list *temp_list, *path;
|
||||
struct name_list *seen = NULL;
|
||||
|
||||
|
@ -185,32 +194,38 @@ 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_select_list) {
|
||||
if (path_selected == false) {
|
||||
for (me = mount_list; me; me = me->me_next) {
|
||||
path = np_add_parameter(&path_select_list, me->me_mountdir);
|
||||
path->best_match = me;
|
||||
set_thresholds(&path->freespace_units, warn_freespace_units, crit_freespace_units);
|
||||
set_thresholds(&path->freespace_percent, warn_freespace_percent, crit_freespace_percent);
|
||||
set_thresholds(&path->usedspace_units, warn_usedspace_units, crit_usedspace_units);
|
||||
set_thresholds(&path->usedspace_percent, warn_usedspace_percent, crit_usedspace_percent);
|
||||
set_thresholds(&path->usedinodes_percent, warn_usedinodes_percent, crit_usedinodes_percent);
|
||||
}
|
||||
} else {
|
||||
np_set_best_match(path_select_list, mount_list, exact_match);
|
||||
|
||||
/* Error if no match found for specified paths */
|
||||
temp_list = path_select_list;
|
||||
while (temp_list) {
|
||||
if (! temp_list->best_match) {
|
||||
die (STATE_CRITICAL, _("DISK %s: %s not found\n"), _("CRITICAL"), temp_list->name);
|
||||
if (! (path = np_find_parameter(path_select_list, me->me_mountdir))) {
|
||||
path = np_add_parameter(&path_select_list, me->me_mountdir);
|
||||
}
|
||||
temp_list = temp_list->name_next;
|
||||
path->best_match = me;
|
||||
path->group = group;
|
||||
set_all_thresholds(path);
|
||||
}
|
||||
}
|
||||
np_set_best_match(path_select_list, mount_list, exact_match);
|
||||
|
||||
/* Error if no match found for specified paths */
|
||||
temp_list = path_select_list;
|
||||
while (temp_list) {
|
||||
if (! temp_list->best_match) {
|
||||
die (STATE_CRITICAL, _("DISK %s: %s not found\n"), _("CRITICAL"), temp_list->name);
|
||||
}
|
||||
temp_list = temp_list->name_next;
|
||||
}
|
||||
|
||||
|
||||
/* Process for every path in list */
|
||||
for (path = path_select_list; path; path=path->name_next) {
|
||||
|
||||
if (verbose > 3 && path->freespace_percent->warning != NULL && path->freespace_percent->critical != NULL)
|
||||
printf("Thresholds(pct) for %s warn: %f crit %f\n",path->name, path->freespace_percent->warning->end,
|
||||
path->freespace_percent->critical->end);
|
||||
|
||||
if (verbose > 3 && path->group != NULL)
|
||||
printf("Group of %s: %s\n",path->name,path->group);
|
||||
|
||||
/* reset disk result */
|
||||
disk_result = STATE_UNKNOWN;
|
||||
|
||||
|
@ -222,25 +237,62 @@ main (int argc, char **argv)
|
|||
if (np_seen_name(seen, me->me_mountdir)) {
|
||||
continue;
|
||||
} else {
|
||||
np_add_name(&seen, me->me_mountdir);
|
||||
}
|
||||
/* Skip remote filesystems if we're not interested in them */
|
||||
if (me->me_remote && show_local_fs) {
|
||||
continue;
|
||||
/* Skip pseudo fs's if we haven't asked for all fs's */
|
||||
} else if (me->me_dummy && !show_all_fs) {
|
||||
continue;
|
||||
/* 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 &&
|
||||
(np_find_name (dp_exclude_list, me->me_devname) ||
|
||||
np_find_name (dp_exclude_list, me->me_mountdir))) {
|
||||
continue;
|
||||
if (path->group != NULL) {
|
||||
/* find all group members */
|
||||
fsp.fsu_blocksize = 0;
|
||||
fsp.fsu_blocks = 0;
|
||||
fsp.fsu_bfree = 0;
|
||||
fsp.fsu_bavail = 0;
|
||||
fsp.fsu_files = 0;
|
||||
fsp.fsu_ffree = 0;
|
||||
|
||||
|
||||
for (temp_list = path_select_list; temp_list; temp_list=temp_list->name_next) {
|
||||
if (temp_list->group && ! (strcmp(temp_list->group, path->group))) {
|
||||
|
||||
get_fs_usage (temp_list->best_match->me_mountdir, temp_list->best_match->me_devname, &tmpfsp);
|
||||
|
||||
/* possibly differing blocksizes if disks are grouped. Calculating average */
|
||||
fsp.fsu_blocksize = (fsp.fsu_blocksize * fsp.fsu_blocks + tmpfsp.fsu_blocksize * tmpfsp.fsu_blocks) / \
|
||||
(fsp.fsu_blocks + tmpfsp.fsu_blocks); /* Size of a block. */
|
||||
fsp.fsu_blocks += tmpfsp.fsu_blocks; /* Total blocks. */
|
||||
fsp.fsu_bfree += tmpfsp.fsu_bfree; /* Free blocks available to superuser. */
|
||||
fsp.fsu_bavail += tmpfsp.fsu_bavail; /* Free blocks available to non-superuser. */
|
||||
fsp.fsu_files += tmpfsp.fsu_files; /* Total file nodes. */
|
||||
fsp.fsu_ffree += tmpfsp.fsu_ffree; /* Free file nodes. */
|
||||
|
||||
if (verbose > 3)
|
||||
printf("Group %s: add %llu blocks (%s) \n", path->group, tmpfsp.fsu_bavail, temp_list->name);
|
||||
// printf("Group %s: add %u blocks (%s)\n", temp_list->name); // path->group, tmpfsp.fsu_bavail, temp_list->name);
|
||||
|
||||
np_add_name(&seen, temp_list->best_match->me_mountdir);
|
||||
}
|
||||
}
|
||||
/* modify devname and mountdir for output */
|
||||
me->me_mountdir = me->me_devname = path->group;
|
||||
} else
|
||||
np_add_name(&seen, me->me_mountdir);
|
||||
}
|
||||
|
||||
get_fs_usage (me->me_mountdir, me->me_devname, &fsp);
|
||||
if (path->group == NULL) {
|
||||
/* Skip remote filesystems if we're not interested in them */
|
||||
if (me->me_remote && show_local_fs) {
|
||||
continue;
|
||||
/* Skip pseudo fs's if we haven't asked for all fs's */
|
||||
} else if (me->me_dummy && !show_all_fs) {
|
||||
continue;
|
||||
/* 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 &&
|
||||
(np_find_name (dp_exclude_list, me->me_devname) ||
|
||||
np_find_name (dp_exclude_list, me->me_mountdir))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
get_fs_usage (me->me_mountdir, me->me_devname, &fsp);
|
||||
}
|
||||
|
||||
if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) {
|
||||
total = fsp.fsu_blocks;
|
||||
|
@ -258,8 +310,8 @@ 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\n",
|
||||
me->me_mountdir, dused_pct, dfree_pct, dused_units, dfree_units, dtotal_units, dused_inodes_percent);
|
||||
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\n",
|
||||
me->me_mountdir, dused_pct, dfree_pct, dused_units, dfree_units, dtotal_units, dused_inodes_percent, dfree_inodes_percent);
|
||||
}
|
||||
|
||||
/* Threshold comparisons */
|
||||
|
@ -284,12 +336,21 @@ main (int argc, char **argv)
|
|||
if (verbose >=3) printf("Usedinodes_percent result=%d\n", temp_result);
|
||||
disk_result = max_state( disk_result, temp_result );
|
||||
|
||||
temp_result = get_status(dfree_inodes_percent, path->freeinodes_percent);
|
||||
if (verbose >=3) printf("Freeinodes_percent result=%d\n", temp_result);
|
||||
disk_result = max_state( disk_result, temp_result );
|
||||
|
||||
result = max_state(result, disk_result);
|
||||
|
||||
/* What a mess of units. The output shows free space, the perf data shows used space. Yikes!
|
||||
Hack here. Trying to get warn/crit levels from freespace_(units|percent) for perf
|
||||
data. Assumption that start=0. Roll on new syntax...
|
||||
*/
|
||||
|
||||
/* *_high_tide must be reinitialized at each run */
|
||||
warning_high_tide = UINT_MAX;
|
||||
critical_high_tide = UINT_MAX;
|
||||
|
||||
if (path->freespace_units->warning != NULL) {
|
||||
warning_high_tide = dtotal_units - path->freespace_units->warning->end;
|
||||
}
|
||||
|
@ -306,8 +367,8 @@ main (int argc, char **argv)
|
|||
asprintf (&perf, "%s %s", perf,
|
||||
perfdata ((!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir,
|
||||
dused_units, units,
|
||||
TRUE, warning_high_tide,
|
||||
TRUE, critical_high_tide,
|
||||
(warning_high_tide != UINT_MAX ? TRUE : FALSE), warning_high_tide,
|
||||
(critical_high_tide != UINT_MAX ? TRUE : FALSE), critical_high_tide,
|
||||
TRUE, 0,
|
||||
TRUE, dtotal_units));
|
||||
|
||||
|
@ -377,11 +438,17 @@ double calculate_percent(uintmax_t value, uintmax_t total) {
|
|||
int
|
||||
process_arguments (int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
struct parameter_list *se;
|
||||
int c, err;
|
||||
struct parameter_list *se, *se2;
|
||||
struct parameter_list *temp_list;
|
||||
struct parameter_list *temp_path_select_list = NULL;
|
||||
struct mount_entry *me;
|
||||
int result = OK;
|
||||
struct stat *stat_buf;
|
||||
regex_t re;
|
||||
int cflags = REG_NOSUB | REG_EXTENDED;
|
||||
char errbuf[MAX_INPUT_BUFFER];
|
||||
bool fnd = false;
|
||||
|
||||
int option = 0;
|
||||
static struct option longopts[] = {
|
||||
|
@ -399,6 +466,11 @@ process_arguments (int argc, char **argv)
|
|||
{"partition", required_argument, 0, 'p'},
|
||||
{"exclude_device", required_argument, 0, 'x'},
|
||||
{"exclude-type", required_argument, 0, 'X'},
|
||||
{"group", required_argument, 0, 'g'},
|
||||
{"eregi-path", required_argument, 0, 'R'},
|
||||
{"eregi-partition", required_argument, 0, 'R'},
|
||||
{"ereg-path", required_argument, 0, 'r'},
|
||||
{"ereg-partition", required_argument, 0, 'r'},
|
||||
{"mountpoint", no_argument, 0, 'M'},
|
||||
{"errors-only", no_argument, 0, 'e'},
|
||||
{"exact-match", no_argument, 0, 'E'},
|
||||
|
@ -420,7 +492,7 @@ process_arguments (int argc, char **argv)
|
|||
strcpy (argv[c], "-t");
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "+?VqhveCt:c:w:K:W:u:p:x:X:mklME", longopts, &option);
|
||||
c = getopt_long (argc, argv, "+?VqhveCt:c:w:K:W:u:p:x:X:mklg:R:r:ME", longopts, &option);
|
||||
|
||||
if (c == -1 || c == EOF)
|
||||
break;
|
||||
|
@ -474,10 +546,18 @@ process_arguments (int argc, char **argv)
|
|||
break;
|
||||
|
||||
case 'W': /* warning inode threshold */
|
||||
warn_usedinodes_percent = optarg;
|
||||
if (*optarg == '@') {
|
||||
warn_freeinodes_percent = optarg;
|
||||
} else {
|
||||
asprintf(&warn_freeinodes_percent, "@%s", optarg);
|
||||
}
|
||||
break;
|
||||
case 'K': /* critical inode threshold */
|
||||
crit_usedinodes_percent = optarg;
|
||||
if (*optarg == '@') {
|
||||
crit_freeinodes_percent = optarg;
|
||||
} else {
|
||||
asprintf(&crit_freeinodes_percent, "@%s", optarg);
|
||||
}
|
||||
break;
|
||||
case 'u':
|
||||
if (units)
|
||||
|
@ -522,15 +602,23 @@ process_arguments (int argc, char **argv)
|
|||
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)) {
|
||||
crit_usedinodes_percent || warn_freeinodes_percent || crit_freeinodes_percent )) {
|
||||
die (STATE_UNKNOWN, "DISK %s: %s", _("UNKNOWN"), _("Must set a threshold value before using -p\n"));
|
||||
}
|
||||
se = np_add_parameter(&path_select_list, optarg);
|
||||
set_thresholds(&se->freespace_units, warn_freespace_units, crit_freespace_units);
|
||||
set_thresholds(&se->freespace_percent, warn_freespace_percent, crit_freespace_percent);
|
||||
set_thresholds(&se->usedspace_units, warn_usedspace_units, crit_usedspace_units);
|
||||
set_thresholds(&se->usedspace_percent, warn_usedspace_percent, crit_usedspace_percent);
|
||||
set_thresholds(&se->usedinodes_percent, warn_usedinodes_percent, crit_usedinodes_percent);
|
||||
|
||||
/* get the real mountdir of the specified path. np_find_parameter won't find an entry if -p is not
|
||||
* exactly the same string as the mountdir */
|
||||
se2 = np_add_parameter(&temp_path_select_list, optarg);
|
||||
np_set_best_match(se2, mount_list, FALSE);
|
||||
|
||||
|
||||
/* add parameter if not found. overwrite thresholds if path has already been added */
|
||||
if (! (se = np_find_parameter(path_select_list, optarg))) {
|
||||
se = np_add_parameter(&path_select_list, optarg);
|
||||
}
|
||||
se->group = group;
|
||||
set_all_thresholds(se);
|
||||
path_selected = true;
|
||||
break;
|
||||
case 'x': /* exclude path or partition */
|
||||
np_add_name(&dp_exclude_list, optarg);
|
||||
|
@ -550,10 +638,65 @@ process_arguments (int argc, char **argv)
|
|||
case 'E':
|
||||
exact_match = TRUE;
|
||||
break;
|
||||
case 'g':
|
||||
if (path_selected)
|
||||
die (STATE_UNKNOWN, "DISK %s: %s", _("UNKNOWN"), _("Must set group value before using -p\n"));
|
||||
group = optarg;
|
||||
break;
|
||||
case 'R':
|
||||
cflags |= REG_ICASE;
|
||||
case 'r':
|
||||
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 )) {
|
||||
die (STATE_UNKNOWN, "DISK %s: %s", _("UNKNOWN"), _("Must set a threshold value before using -r/-R\n"));
|
||||
}
|
||||
|
||||
err = regcomp(&re, optarg, cflags);
|
||||
if (err != 0) {
|
||||
regerror (err, &re, errbuf, MAX_INPUT_BUFFER);
|
||||
die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"), _("Could not compile regular expression"), errbuf);
|
||||
}
|
||||
|
||||
for (me = mount_list; me; me = me->me_next) {
|
||||
if (np_regex_match_mount_entry(me, &re)) {
|
||||
fnd = true;
|
||||
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 */
|
||||
if (! (se = np_find_parameter(path_select_list, me->me_mountdir))) {
|
||||
se = np_add_parameter(&path_select_list, me->me_mountdir);
|
||||
}
|
||||
se->group = group;
|
||||
set_all_thresholds(se);
|
||||
}
|
||||
}
|
||||
|
||||
if (!fnd)
|
||||
die (STATE_UNKNOWN, "DISK %s: %s - %s\n",_("UNKNOWN"),
|
||||
_("Regular expression did not match any path or disk"), optarg);
|
||||
|
||||
fnd = false;
|
||||
path_selected = true;
|
||||
break;
|
||||
case 'M': /* display mountpoint */
|
||||
display_mntp = TRUE;
|
||||
break;
|
||||
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)))
|
||||
path = np_add_parameter(&path_select_list, me->me_mountdir);
|
||||
path->best_match = me;
|
||||
path->group = group;
|
||||
set_all_thresholds(path);
|
||||
}
|
||||
}
|
||||
warn_freespace_units = NULL;
|
||||
crit_freespace_units = NULL;
|
||||
warn_usedspace_units = NULL;
|
||||
|
@ -564,6 +707,11 @@ process_arguments (int argc, char **argv)
|
|||
crit_usedspace_percent = NULL;
|
||||
warn_usedinodes_percent = NULL;
|
||||
crit_usedinodes_percent = NULL;
|
||||
warn_freeinodes_percent = NULL;
|
||||
crit_freeinodes_percent = NULL;
|
||||
|
||||
path_selected = false;
|
||||
group = NULL;
|
||||
break;
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
|
@ -586,11 +734,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
if (argc > c && path == NULL) {
|
||||
se = np_add_parameter(&path_select_list, strdup(argv[c++]));
|
||||
set_thresholds(&se->freespace_units, warn_freespace_units, crit_freespace_units);
|
||||
set_thresholds(&se->freespace_percent, warn_freespace_percent, crit_freespace_percent);
|
||||
set_thresholds(&se->usedspace_units, warn_usedspace_units, crit_usedspace_units);
|
||||
set_thresholds(&se->usedspace_percent, warn_usedspace_percent, crit_usedspace_percent);
|
||||
set_thresholds(&se->usedinodes_percent, warn_usedinodes_percent, crit_usedinodes_percent);
|
||||
set_all_thresholds(se);
|
||||
}
|
||||
|
||||
if (units == NULL) {
|
||||
|
@ -638,6 +782,16 @@ print_path (const char *mypath)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
set_all_thresholds (struct parameter_list *path)
|
||||
{
|
||||
set_thresholds(&path->freespace_units, warn_freespace_units, crit_freespace_units);
|
||||
set_thresholds(&path->freespace_percent, warn_freespace_percent, crit_freespace_percent);
|
||||
set_thresholds(&path->usedspace_units, warn_usedspace_units, crit_usedspace_units);
|
||||
set_thresholds(&path->usedspace_percent, warn_usedspace_percent, crit_usedspace_percent);
|
||||
set_thresholds(&path->usedinodes_percent, warn_usedinodes_percent, crit_usedinodes_percent);
|
||||
set_thresholds(&path->freeinodes_percent, warn_freeinodes_percent, crit_freeinodes_percent);
|
||||
}
|
||||
|
||||
/* TODO: Remove?
|
||||
|
||||
|
@ -725,11 +879,17 @@ print_help (void)
|
|||
printf (" %s\n", _("Only check local filesystems"));
|
||||
printf (" %s\n", "-p, --path=PATH, --partition=PARTITION");
|
||||
printf (" %s\n", _("Path or partition (may be repeated)"));
|
||||
printf (" %s\n", "-r, --ereg-path=PATH, --ereg-partition=PARTITION");
|
||||
printf (" %s\n", _("Regular expression for path or partition (may be repeated)"));
|
||||
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", "-g, --group=NAME");
|
||||
printf (" %s\n", _("Group pathes. Thresholds apply to (free-)space of all partitions together"));
|
||||
printf (" %s\n", "-x, --exclude_device=PATH <STRING>");
|
||||
printf (" %s\n", _("Ignore device (only works if -p unspecified)"));
|
||||
printf (" %s\n", _("-X, --exclude-type=TYPE <STRING>"));
|
||||
printf (" %s\n", "-X, --exclude-type=TYPE <STRING>");
|
||||
printf (" %s\n", _("Ignore all filesystems of indicated type (may be repeated)"));
|
||||
printf (" %s\n", "-m, --mountpoint");
|
||||
printf (" %s\n", "-M, --mountpoint");
|
||||
printf (" %s\n", _("Display the mountpoint instead of the partition"));
|
||||
printf (" %s\n", "-E, --exact-match");
|
||||
printf (" %s\n", _("For paths or partitions specified with -p, only check for exact paths"));
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 00:25:16 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:40 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -31,12 +31,12 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*
|
||||
* $Id: check_dns.c,v 1.54 2006/10/19 00:25:16 opensides Exp $
|
||||
* $Id: check_dns.c,v 1.55 2007/01/28 21:46:40 hweiss Exp $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_dns";
|
||||
const char *revision = "$Revision: 1.54 $";
|
||||
const char *revision = "$Revision: 1.55 $";
|
||||
const char *copyright = "2000-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -370,7 +370,7 @@ process_arguments (int argc, char **argv)
|
|||
critical = optarg;
|
||||
break;
|
||||
default: /* args not parsable */
|
||||
usage_va(_("Unknown argument - %s"), optarg);
|
||||
usage5();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 00:25:16 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:40 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -30,12 +30,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: check_fping.c,v 1.27 2006/10/19 00:25:16 opensides Exp $
|
||||
$Id: check_fping.c,v 1.28 2007/01/28 21:46:40 hweiss Exp $
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_fping";
|
||||
const char *revision = "$Revision: 1.27 $";
|
||||
const char *revision = "$Revision: 1.28 $";
|
||||
const char *copyright = "2000-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -258,7 +258,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* print short usage statement if args not parsable */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 00:25:16 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:40 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -30,11 +30,11 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: check_game.c,v 1.28 2006/10/19 00:25:16 opensides Exp $
|
||||
* $Id: check_game.c,v 1.29 2007/01/28 21:46:40 hweiss Exp $
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_game";
|
||||
const char *revision = "$Revision: 1.28 $";
|
||||
const char *revision = "$Revision: 1.29 $";
|
||||
const char *copyright = "2002-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -249,7 +249,7 @@ process_arguments (int argc, char **argv)
|
|||
return ERROR;
|
||||
break;
|
||||
default: /* args not parsable */
|
||||
usage_va(_("Unknown argument - %s"), optarg);
|
||||
usage5();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 00:25:16 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:40 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -31,11 +31,11 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: check_hpjd.c,v 1.34 2006/10/19 00:25:16 opensides Exp $
|
||||
* $Id: check_hpjd.c,v 1.35 2007/01/28 21:46:40 hweiss Exp $
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_hpjd";
|
||||
const char *revision = "$Revision: 1.34 $";
|
||||
const char *revision = "$Revision: 1.35 $";
|
||||
const char *copyright = "2000-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -351,7 +351,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case '?': /* help */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/26 20:51:24 $
|
||||
* Last Modified: $Date: 2007/03/06 22:45:57 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -33,13 +33,13 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: check_http.c,v 1.96 2006/10/26 20:51:24 tonvoon Exp $
|
||||
$Id: check_http.c,v 1.101 2007/03/06 22:45:57 tonvoon Exp $
|
||||
|
||||
******************************************************************************/
|
||||
/* splint -I. -I../../plugins -I../../lib/ -I/usr/kerberos/include/ ../../plugins/check_http.c */
|
||||
|
||||
const char *progname = "check_http";
|
||||
const char *revision = "$Revision: 1.96 $";
|
||||
const char *revision = "$Revision: 1.101 $";
|
||||
const char *copyright = "1999-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -88,7 +88,6 @@ struct timeval tv;
|
|||
#define HTTP_URL "/"
|
||||
#define CRLF "\r\n"
|
||||
|
||||
char timestamp[17] = "";
|
||||
int specify_port = FALSE;
|
||||
int server_port = HTTP_PORT;
|
||||
char server_port_text[6] = "";
|
||||
|
@ -147,13 +146,6 @@ main (int argc, char **argv)
|
|||
if (process_arguments (argc, argv) == ERROR)
|
||||
usage4 (_("Could not parse arguments"));
|
||||
|
||||
if (strstr (timestamp, ":")) {
|
||||
if (strstr (server_url, "?"))
|
||||
asprintf (&server_url, "%s&%s", server_url, timestamp);
|
||||
else
|
||||
asprintf (&server_url, "%s?%s", server_url, timestamp);
|
||||
}
|
||||
|
||||
if (display_html == TRUE)
|
||||
printf ("<A HREF=\"%s://%s:%d%s\" target=\"_blank\">",
|
||||
use_ssl ? "https" : "http", host_name,
|
||||
|
@ -183,15 +175,16 @@ process_arguments (int argc, char **argv)
|
|||
int option = 0;
|
||||
static struct option longopts[] = {
|
||||
STD_LONG_OPTS,
|
||||
{"file",required_argument,0,'F'},
|
||||
{"link", no_argument, 0, 'L'},
|
||||
{"nohtml", no_argument, 0, 'n'},
|
||||
{"ssl", no_argument, 0, 'S'},
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
{"post", required_argument, 0, 'P'},
|
||||
{"IP-address", required_argument, 0, 'I'},
|
||||
{"url", required_argument, 0, 'u'},
|
||||
{"port", required_argument, 0, 'p'},
|
||||
{"authorization", required_argument, 0, 'a'},
|
||||
{"string", required_argument, 0, 's'},
|
||||
{"expect", required_argument, 0, 'e'},
|
||||
{"regex", required_argument, 0, 'r'},
|
||||
{"ereg", required_argument, 0, 'r'},
|
||||
{"eregi", required_argument, 0, 'R'},
|
||||
|
@ -233,7 +226,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* usage */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
break;
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
|
@ -861,7 +854,7 @@ check_http (void)
|
|||
|
||||
/* return a CRITICAL status if we couldn't read any data */
|
||||
if (pagesize == (size_t) 0)
|
||||
die (STATE_CRITICAL, _("No data received %s\n"), timestamp);
|
||||
die (STATE_CRITICAL, _("No data received from host\n"));
|
||||
|
||||
/* close the connection */
|
||||
#ifdef HAVE_SSL
|
||||
|
@ -967,8 +960,8 @@ check_http (void)
|
|||
microsec = deltime (tv);
|
||||
elapsed_time = (double)microsec / 1.0e6;
|
||||
die (onredirect,
|
||||
_(" - %s - %.3f second response time %s%s|%s %s\n"),
|
||||
status_line, elapsed_time, timestamp,
|
||||
_(" - %s - %.3f second response time %s|%s %s\n"),
|
||||
status_line, elapsed_time,
|
||||
(display_html ? "</A>" : ""),
|
||||
perfd_time (elapsed_time), perfd_size (pagesize));
|
||||
} /* end if (http_status >= 300) */
|
||||
|
@ -983,8 +976,8 @@ check_http (void)
|
|||
microsec = deltime (tv);
|
||||
elapsed_time = (double)microsec / 1.0e6;
|
||||
asprintf (&msg,
|
||||
_("HTTP WARNING: %s - %.3f second response time %s%s|%s %s\n"),
|
||||
status_line, elapsed_time, timestamp,
|
||||
_("HTTP WARNING: %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)
|
||||
|
@ -997,9 +990,9 @@ check_http (void)
|
|||
|
||||
if (strlen (string_expect)) {
|
||||
if (strstr (page, string_expect)) {
|
||||
printf (_("HTTP OK %s - %.3f second response time %s%s|%s %s\n"),
|
||||
printf (_("HTTP OK %s - %.3f second response time %s|%s %s\n"),
|
||||
status_line, elapsed_time,
|
||||
timestamp, (display_html ? "</A>" : ""),
|
||||
(display_html ? "</A>" : ""),
|
||||
perfd_time (elapsed_time), perfd_size (pagesize));
|
||||
exit (STATE_OK);
|
||||
}
|
||||
|
@ -1014,9 +1007,9 @@ check_http (void)
|
|||
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 %s\n"),
|
||||
printf (_("HTTP OK %s - %.3f second response time %s|%s %s\n"),
|
||||
status_line, elapsed_time,
|
||||
timestamp, (display_html ? "</A>" : ""),
|
||||
(display_html ? "</A>" : ""),
|
||||
perfd_time (elapsed_time), perfd_size (pagesize));
|
||||
exit (STATE_OK);
|
||||
}
|
||||
|
@ -1025,7 +1018,7 @@ check_http (void)
|
|||
msg = strdup(_("pattern not found"));
|
||||
else
|
||||
msg = strdup(_("pattern found"));
|
||||
printf (_("%s - %s%s|%s %s\n"),
|
||||
printf (("%s - %s%s|%s %s\n"),
|
||||
_("CRITICAL"),
|
||||
msg,
|
||||
(display_html ? "</A>" : ""),
|
||||
|
@ -1052,9 +1045,9 @@ check_http (void)
|
|||
exit (STATE_WARNING);
|
||||
}
|
||||
/* We only get here if all tests have been passed */
|
||||
asprintf (&msg, _("HTTP OK %s - %d bytes in %.3f seconds %s%s|%s %s\n"),
|
||||
asprintf (&msg, _("HTTP OK %s - %d bytes in %.3f seconds %s|%s %s\n"),
|
||||
status_line, page_len, elapsed_time,
|
||||
timestamp, (display_html ? "</A>" : ""),
|
||||
(display_html ? "</A>" : ""),
|
||||
perfd_time (elapsed_time), perfd_size (page_len));
|
||||
die (STATE_OK, "%s", msg);
|
||||
return STATE_UNKNOWN;
|
||||
|
@ -1263,21 +1256,21 @@ print_help (void)
|
|||
|
||||
#ifdef HAVE_SSL
|
||||
printf (" %s\n", "-S, --ssl");
|
||||
printf (" %s\n", _("Connect via SSL"));
|
||||
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."));
|
||||
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"));
|
||||
#endif
|
||||
|
||||
printf (" %s\n", "-e, --expect=STRING");
|
||||
printf (" %s\n", _("String to expect in first (status) line of server response (default: "));
|
||||
printf ("%s\n", HTTP_EXPECT);
|
||||
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");
|
||||
printf (" %s\n", _("String to expect in the content"));
|
||||
printf (" %s\n", "-u, --url=PATH");
|
||||
printf (" %s\n", _("URL to GET or POST (default: /)"));
|
||||
printf (" %s\n," "-P, --post=STRING");
|
||||
printf (" %s\n", "-P, --post=STRING");
|
||||
printf (" %s\n", _("URL encoded http POST data"));
|
||||
printf (" %s\n", "-N, --no-body");
|
||||
printf (" %s\n", _("Don't wait for document body: stop reading after headers."));
|
||||
|
@ -1303,7 +1296,7 @@ print_help (void)
|
|||
printf (" %s\n", _("String to be sent in http header as \"User Agent\""));
|
||||
printf (" %s\n", "-k, --header=STRING");
|
||||
printf (" %s\n", _(" Any other tags to be sent in http header. Use multiple times for additional headers"));
|
||||
printf (" %s\n", "-L, --link=URL");
|
||||
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"));
|
||||
|
@ -1329,13 +1322,13 @@ print_help (void)
|
|||
printf (" %s\n", _("serve content (optionally within a specified time) or whether the X509 "));
|
||||
printf (" %s\n", _("certificate is still valid for the specified number of days."));
|
||||
printf (_("Examples:"));
|
||||
printf (" %s\n\n", "CHECK CONTENT: check_http -w 5 -c 10 --ssl www.verisign.com");
|
||||
printf (" %s\n\n", "CHECK CONTENT: check_http -w 5 -c 10 --ssl -H www.verisign.com");
|
||||
printf (" %s\n", _("When the 'www.verisign.com' server returns its content within 5 seconds,"));
|
||||
printf (" %s\n", _("a STATE_OK will be returned. When the server returns its content but exceeds"));
|
||||
printf (" %s\n", _("the 5-second threshold, a STATE_WARNING will be returned. When an error occurs,"));
|
||||
printf (" %s\n\n", _("a STATE_CRITICAL will be returned."));
|
||||
|
||||
printf (" %s\n\n", "CHECK CERTIFICATE: check_http www.verisign.com -C 14");
|
||||
printf (" %s\n\n", "CHECK CERTIFICATE: check_http -H www.verisign.com -C 14");
|
||||
printf (" %s\n", _("When the certificate of 'www.verisign.com' is valid for more than 14 days,"));
|
||||
printf (" %s\n", _("a STATE_OK is returned. When the certificate is still valid, but for less than"));
|
||||
printf (" %s\n", _("14 days, a STATE_WARNING is returned. A STATE_CRITICAL will be returned when"));
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
* Copyright (c) 2000 Robert Dale <rdale@digital-mission.com>
|
||||
* Copyright (c) 2000-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 00:25:16 $
|
||||
* Last Modified: $Date: 2007/02/06 21:03:21 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -35,11 +35,11 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: check_ide_smart.c,v 1.12 2006/10/19 00:25:16 opensides Exp $
|
||||
* $Id: check_ide_smart.c,v 1.14 2007/02/06 21:03:21 opensides Exp $
|
||||
*/
|
||||
|
||||
const char *progname = "check_ide_smart";
|
||||
const char *revision = "$Revision: 1.12 $";
|
||||
const char *revision = "$Revision: 1.14 $";
|
||||
const char *copyright = "2000-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -212,7 +212,7 @@ main (int argc, char *argv[])
|
|||
print_revision (progname, revision);
|
||||
return STATE_OK;
|
||||
default:
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -522,7 +522,7 @@ print_help (void)
|
|||
printf (" %s\n", "-0, --auto-off");
|
||||
printf (" %s\n", _("Turn off automatic offline tests"));
|
||||
printf (" %s\n", "-n, --nagios");
|
||||
printf (" %s\n", _("Output suitable for Nagios\n"));
|
||||
printf (" %s\n\n", _("Output suitable for Nagios"));
|
||||
printf (_(UT_SUPPORT));
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 2000-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/22 22:24:27 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:40 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -27,13 +27,13 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: check_ldap.c,v 1.33 2006/10/22 22:24:27 opensides Exp $
|
||||
$Id: check_ldap.c,v 1.35 2007/01/28 21:46:40 hweiss Exp $
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
/* progname may be check_ldaps */
|
||||
char *progname = "check_ldap";
|
||||
const char *revision = "$Revision: 1.33 $";
|
||||
const char *revision = "$Revision: 1.35 $";
|
||||
const char *copyright = "2000-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -325,7 +325,7 @@ process_arguments (int argc, char **argv)
|
|||
#endif
|
||||
break;
|
||||
default:
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -378,9 +378,9 @@ print_help (void)
|
|||
printf (" %s\n", _("ldap attribute to search (default: \"(objectclass=*)\""));
|
||||
printf (" %s\n", "-b [--base]");
|
||||
printf (" %s\n", _("ldap base (eg. ou=my unit, o=my org, c=at"));
|
||||
printf (" %s\n," "-D [--bind]");
|
||||
printf (" %s\n", "-D [--bind]");
|
||||
printf (" %s\n", _("ldap bind DN (if required)"));
|
||||
printf (" %s\n," "-P [--pass]");
|
||||
printf (" %s\n", "-P [--pass]");
|
||||
printf (" %s\n", _("ldap password (if required)"));
|
||||
|
||||
#ifdef HAVE_LDAP_SET_OPTION
|
||||
|
@ -410,9 +410,9 @@ print_usage (void)
|
|||
{
|
||||
printf (_("Usage:"));
|
||||
printf (" %s -H <host> -b <base_dn> [-p <port>] [-a <attr>] [-D <binddn>]",progname);
|
||||
printf ("[-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n",
|
||||
printf ("\n [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]%s\n",
|
||||
#ifdef HAVE_LDAP_SET_OPTION
|
||||
" [-2|-3] [-4|-6]"
|
||||
"\n [-2|-3] [-4|-6]"
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 00:25:16 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:40 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -30,12 +30,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: check_load.c,v 1.32 2006/10/19 00:25:16 opensides Exp $
|
||||
$Id: check_load.c,v 1.33 2007/01/28 21:46:40 hweiss Exp $
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_load";
|
||||
const char *revision = "$Revision: 1.32 $";
|
||||
const char *revision = "$Revision: 1.33 $";
|
||||
const char *copyright = "1999-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -236,7 +236,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case '?': /* help */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/20 07:39:35 $
|
||||
* Last Modified: $Date: 2007/02/06 21:03:21 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -31,12 +31,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: check_mrtg.c,v 1.28 2006/10/20 07:39:35 opensides Exp $
|
||||
$Id: check_mrtg.c,v 1.30 2007/02/06 21:03:21 opensides Exp $
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_mrtg";
|
||||
const char *revision = "$Revision: 1.28 $";
|
||||
const char *revision = "$Revision: 1.30 $";
|
||||
const char *copyright = "1999-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -243,7 +243,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case '?': /* help */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -367,7 +367,7 @@ print_help (void)
|
|||
printf (" %s\n", _(" commands with different values for the <variable> argument. Of course,"));
|
||||
printf (" %s\n", _("you can always hack the code to make this plugin work for you..."));
|
||||
printf (" %s\n", _("- MRTG stands for the Multi Router Traffic Grapher. It can be downloaded from"));
|
||||
printf (" %s\n", _("http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html"));
|
||||
printf (" %s\n", "http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html");
|
||||
|
||||
printf (_(UT_SUPPORT));
|
||||
}
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
* Nagios check_mrtgtraf plugin
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
* Copyright (c) 1999-2007 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 00:25:16 $
|
||||
* Last Modified: $Date: 2007/03/02 01:38:04 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -31,7 +31,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: check_mrtgtraf.c,v 1.25 2006/10/19 00:25:16 opensides Exp $
|
||||
$Id: check_mrtgtraf.c,v 1.28 2007/03/02 01:38:04 egalstad Exp $
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
|
@ -39,8 +39,8 @@
|
|||
#include "utils.h"
|
||||
|
||||
const char *progname = "check_mrtgtraf";
|
||||
const char *revision = "$Revision: 1.25 $";
|
||||
const char *copyright = "1999-2006";
|
||||
const char *revision = "$Revision: 1.28 $";
|
||||
const char *copyright = "1999-2007";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
int process_arguments (int, char **);
|
||||
|
@ -60,7 +60,7 @@ unsigned long outgoing_critical_threshold = 0L;
|
|||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int result = STATE_UNKNOWN;
|
||||
int result = STATE_OK;
|
||||
FILE *fp;
|
||||
int line;
|
||||
char input_buffer[MAX_INPUT_BUFFER];
|
||||
|
@ -277,7 +277,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case '?': /* help */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -360,7 +360,7 @@ print_help (void)
|
|||
|
||||
printf ("%s\n", _("Notes:"));
|
||||
printf (" %s\n", _("- MRTG stands for Multi Router Traffic Grapher. It can be downloaded from"));
|
||||
printf (" %s\n", _(" http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html"));
|
||||
printf (" %s\n", " http://ee-staff.ethz.ch/~oetiker/webtools/mrtg/mrtg.html");
|
||||
printf (" %s\n", _("- While MRTG can monitor things other than traffic rates, this"));
|
||||
printf (" %s\n", _(" plugin probably won't work with much else without modification."));
|
||||
printf (" %s\n", _("- The calculated i/o rates are a little off from what MRTG actually"));
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
* Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net)
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 00:25:16 $
|
||||
* Last Modified: $Date: 2007/03/29 17:58:28 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -32,12 +32,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: check_mysql.c,v 1.33 2006/10/19 00:25:16 opensides Exp $
|
||||
* $Id: check_mysql.c,v 1.35 2007/03/29 17:58:28 hweiss Exp $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_mysql";
|
||||
const char *revision = "$Revision: 1.33 $";
|
||||
const char *revision = "$Revision: 1.35 $";
|
||||
const char *copyright = "1999-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -308,7 +308,7 @@ process_arguments (int argc, char **argv)
|
|||
verbose++;
|
||||
break;
|
||||
case '?': /* help */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -318,18 +318,18 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
while ( argc > c ) {
|
||||
|
||||
if (strlen(db_host) == 0)
|
||||
if (db_host == NULL)
|
||||
if (is_host (argv[c])) {
|
||||
db_host = argv[c++];
|
||||
}
|
||||
else {
|
||||
usage2 (_("Invalid hostname/address"), optarg);
|
||||
usage2 (_("Invalid hostname/address"), argv[c]);
|
||||
}
|
||||
else if (strlen(db_user) == 0)
|
||||
else if (db_user == NULL)
|
||||
db_user = argv[c++];
|
||||
else if (strlen(db_pass) == 0)
|
||||
else if (db_pass == NULL)
|
||||
db_pass = argv[c++];
|
||||
else if (strlen(db) == 0)
|
||||
else if (db == NULL)
|
||||
db = argv[c++];
|
||||
else if (is_intnonneg (argv[c]))
|
||||
db_port = atoi (argv[c++]);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 2006 nagios-plugins team, after Didi Rieder (check_mysql)
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 00:25:16 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:40 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -30,12 +30,12 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* CHECK_MYSQL_QUERY.C
|
||||
*
|
||||
* $Id: check_mysql_query.c,v 1.5 2006/10/19 00:25:16 opensides Exp $
|
||||
* $Id: check_mysql_query.c,v 1.6 2007/01/28 21:46:40 hweiss Exp $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_mysql_query";
|
||||
const char *revision = "$Revision: 1.5 $";
|
||||
const char *revision = "$Revision: 1.6 $";
|
||||
const char *copyright = "2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -240,7 +240,7 @@ process_arguments (int argc, char **argv)
|
|||
critical = optarg;
|
||||
break;
|
||||
case '?': /* help */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 00:25:16 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:40 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -33,12 +33,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: check_nagios.c,v 1.31 2006/10/19 00:25:16 opensides Exp $
|
||||
$Id: check_nagios.c,v 1.32 2007/01/28 21:46:40 hweiss Exp $
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_nagios";
|
||||
const char *revision = "$Revision: 1.31 $";
|
||||
const char *revision = "$Revision: 1.32 $";
|
||||
const char *copyright = "1999-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -258,7 +258,7 @@ process_arguments (int argc, char **argv)
|
|||
verbose++;
|
||||
break;
|
||||
default: /* print short usage_va statement if args not parsable */
|
||||
usage_va(_("Unknown argument - %s"), optarg);
|
||||
usage5();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Copyright (c) 2000-2002 Yves Rubin (rubiyz@yahoo.com)
|
||||
* Copyright (c) 2003-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/24 21:48:22 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:40 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -32,12 +32,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: check_nt.c,v 1.45 2006/10/24 21:48:22 opensides Exp $
|
||||
* $Id: check_nt.c,v 1.46 2007/01/28 21:46:40 hweiss Exp $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_nt";
|
||||
const char *revision = "$Revision: 1.45 $";
|
||||
const char *revision = "$Revision: 1.46 $";
|
||||
const char *copyright = "2003-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -492,7 +492,7 @@ int process_arguments(int argc, char **argv){
|
|||
switch (c)
|
||||
{
|
||||
case '?': /* print short usage statement if args not parsable */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
case 'h': /* help */
|
||||
print_help();
|
||||
exit(STATE_OK);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Copyright (c) 2006 sean finney <seanius@seanius.net>
|
||||
* Copyright (c) 2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 00:25:16 $
|
||||
* Last Modified: $Date: 2007/04/10 07:17:18 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -32,12 +32,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: check_ntp.c,v 1.11 2006/10/19 00:25:16 opensides Exp $
|
||||
$Id: check_ntp.c,v 1.25 2007/04/10 07:17:18 dermoth Exp $
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_ntp";
|
||||
const char *revision = "$Revision: 1.11 $";
|
||||
const char *revision = "$Revision: 1.25 $";
|
||||
const char *copyright = "2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -47,7 +47,6 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
|||
|
||||
static char *server_address=NULL;
|
||||
static int verbose=0;
|
||||
static int zero_offset_bad=0;
|
||||
static double owarn=60;
|
||||
static double ocrit=120;
|
||||
static short do_jitter=0;
|
||||
|
@ -139,8 +138,8 @@ typedef struct {
|
|||
#define OP_SET(x,y) do{ x |= (y&OP_MASK); }while(0)
|
||||
#define OP_READSTAT 0x01
|
||||
#define OP_READVAR 0x02
|
||||
/* In peer status bytes, bytes 6,7,8 determine clock selection status */
|
||||
#define PEER_SEL(x) (x&0x07)
|
||||
/* In peer status bytes, bits 6,7,8 determine clock selection status */
|
||||
#define PEER_SEL(x) ((ntohs(x)>>8)&0x07)
|
||||
#define PEER_INCLUDED 0x04
|
||||
#define PEER_SYNCSOURCE 0x06
|
||||
|
||||
|
@ -191,7 +190,7 @@ typedef struct {
|
|||
do{ if(!t.tv_usec && !t.tv_sec) n=0x0UL; \
|
||||
else { \
|
||||
L32(n)=htonl(t.tv_sec + EPOCHDIFF); \
|
||||
R32(n)=htonl((4294.967296*t.tv_usec)+.5); \
|
||||
R32(n)=htonl((uint64_t)((4294.967296*t.tv_usec)+.5)); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
|
@ -287,7 +286,7 @@ void setup_request(ntp_message *p){
|
|||
VN_SET(p->flags, 4);
|
||||
MODE_SET(p->flags, MODE_CLIENT);
|
||||
p->poll=4;
|
||||
p->precision=0xfa;
|
||||
p->precision=(int8_t)0xfa;
|
||||
L16(p->rtdelay)=htons(1);
|
||||
L16(p->rtdisp)=htons(1);
|
||||
|
||||
|
@ -476,7 +475,10 @@ double offset_request(const char *host, int *status){
|
|||
}
|
||||
|
||||
/* cleanup */
|
||||
for(j=0; j<num_hosts; j++){ close(socklist[j]); }
|
||||
/* FIXME: Not closing the socket to avoid re-use of the local port
|
||||
* which can cause old NTP packets to be read instead of NTP control
|
||||
* pactets in jitter_request(). THERE MUST BE ANOTHER WAY...
|
||||
* for(j=0; j<num_hosts; j++){ close(socklist[j]); } */
|
||||
free(socklist);
|
||||
free(ufds);
|
||||
free(servers);
|
||||
|
@ -502,11 +504,13 @@ setup_control_request(ntp_control_message *p, uint8_t opcode, uint16_t seq){
|
|||
double jitter_request(const char *host, int *status){
|
||||
int conn=-1, i, npeers=0, num_candidates=0, syncsource_found=0;
|
||||
int run=0, min_peer_sel=PEER_INCLUDED, num_selected=0, num_valid=0;
|
||||
int peer_offset=0;
|
||||
int peers_size=0, peer_offset=0;
|
||||
ntp_assoc_status_pair *peers=NULL;
|
||||
ntp_control_message req;
|
||||
const char *getvar = "jitter";
|
||||
double rval = 0.0, jitter = -1.0;
|
||||
char *startofvalue=NULL, *nptr=NULL;
|
||||
void *tmp;
|
||||
|
||||
/* Long-winded explanation:
|
||||
* Getting the jitter requires a number of steps:
|
||||
|
@ -539,9 +543,12 @@ double jitter_request(const char *host, int *status){
|
|||
/* Each peer identifier is 4 bytes in the data section, which
|
||||
* we represent as a ntp_assoc_status_pair datatype.
|
||||
*/
|
||||
npeers+=(ntohs(req.count)/sizeof(ntp_assoc_status_pair));
|
||||
peers=(ntp_assoc_status_pair*)realloc(peers, sizeof(ntp_assoc_status_pair)*npeers);
|
||||
memcpy((void*)peers+peer_offset, (void*)req.data, sizeof(ntp_assoc_status_pair)*npeers);
|
||||
peers_size+=ntohs(req.count);
|
||||
if((tmp=realloc(peers, peers_size)) == NULL)
|
||||
free(peers), die(STATE_UNKNOWN, "can not (re)allocate 'peers' buffer\n");
|
||||
peers=tmp;
|
||||
memcpy((void*)((ptrdiff_t)peers+peer_offset), (void*)req.data, ntohs(req.count));
|
||||
npeers=peers_size/sizeof(ntp_assoc_status_pair);
|
||||
peer_offset+=ntohs(req.count);
|
||||
} while(req.op&REM_MORE);
|
||||
|
||||
|
@ -559,7 +566,10 @@ double jitter_request(const char *host, int *status){
|
|||
}
|
||||
if(verbose) printf("%d candiate peers available\n", num_candidates);
|
||||
if(verbose && syncsource_found) printf("synchronization source found\n");
|
||||
if(! syncsource_found) *status = STATE_WARNING;
|
||||
if(! syncsource_found){
|
||||
*status = STATE_WARNING;
|
||||
if(verbose) printf("warning: no synchronization source found\n");
|
||||
}
|
||||
|
||||
|
||||
for (run=0; run<AVG_NUM; run++){
|
||||
|
@ -575,8 +585,10 @@ double jitter_request(const char *host, int *status){
|
|||
* thus reducing net traffic, guaranteeing us only a single
|
||||
* datagram in reply, and making intepretation much simpler
|
||||
*/
|
||||
strncpy(req.data, "jitter", 6);
|
||||
req.count = htons(6);
|
||||
/* Older servers doesn't know what jitter is, so if we get an
|
||||
* error on the first pass we redo it with "dispersion" */
|
||||
strncpy(req.data, getvar, MAX_CM_SIZE-1);
|
||||
req.count = htons(strlen(getvar));
|
||||
DBG(printf("sending READVAR request...\n"));
|
||||
write(conn, &req, SIZEOF_NTPCM(req));
|
||||
DBG(print_ntp_control_message(&req));
|
||||
|
@ -586,12 +598,21 @@ double jitter_request(const char *host, int *status){
|
|||
read(conn, &req, SIZEOF_NTPCM(req));
|
||||
DBG(print_ntp_control_message(&req));
|
||||
|
||||
if(req.op&REM_ERROR && strstr(getvar, "jitter")) {
|
||||
if(verbose) printf("The 'jitter' command failed (old ntp server?)\nRestarting with 'dispersion'...\n");
|
||||
getvar = "dispersion";
|
||||
num_selected--;
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* get to the float value */
|
||||
if(verbose) {
|
||||
printf("parsing jitter from peer %.2x: ", peers[i].assoc);
|
||||
printf("parsing jitter from peer %.2x: ", ntohs(peers[i].assoc));
|
||||
}
|
||||
startofvalue = strchr(req.data, '=') + 1;
|
||||
startofvalue = strchr(req.data, '=');
|
||||
if(startofvalue != NULL) {
|
||||
startofvalue++;
|
||||
jitter = strtod(startofvalue, &nptr);
|
||||
}
|
||||
if(startofvalue == NULL || startofvalue==nptr){
|
||||
|
@ -609,10 +630,10 @@ double jitter_request(const char *host, int *status){
|
|||
}
|
||||
}
|
||||
|
||||
rval /= num_valid;
|
||||
rval = num_valid ? rval / num_valid : -1.0;
|
||||
|
||||
close(conn);
|
||||
free(peers);
|
||||
if(peers!=NULL) free(peers);
|
||||
/* If we return -1.0, it means no synchronization source was found */
|
||||
return rval;
|
||||
}
|
||||
|
@ -628,7 +649,6 @@ int process_arguments(int argc, char **argv){
|
|||
{"use-ipv6", no_argument, 0, '6'},
|
||||
{"warning", required_argument, 0, 'w'},
|
||||
{"critical", required_argument, 0, 'c'},
|
||||
{"zero-offset", no_argument, 0, 'O'},
|
||||
{"jwarn", required_argument, 0, 'j'},
|
||||
{"jcrit", required_argument, 0, 'k'},
|
||||
{"timeout", required_argument, 0, 't'},
|
||||
|
@ -641,7 +661,7 @@ int process_arguments(int argc, char **argv){
|
|||
usage ("\n");
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "Vhv46w:c:Oj:k:t:H:", longopts, &option);
|
||||
c = getopt_long (argc, argv, "Vhv46w:c:j:k:t:H:", longopts, &option);
|
||||
if (c == -1 || c == EOF || c == 1)
|
||||
break;
|
||||
|
||||
|
@ -679,9 +699,6 @@ int process_arguments(int argc, char **argv){
|
|||
case 't':
|
||||
socket_timeout=atoi(optarg);
|
||||
break;
|
||||
case 'O':
|
||||
zero_offset_bad=1;
|
||||
break;
|
||||
case '4':
|
||||
address_family = AF_INET;
|
||||
break;
|
||||
|
@ -694,7 +711,7 @@ int process_arguments(int argc, char **argv){
|
|||
break;
|
||||
case '?':
|
||||
/* print short usage statement if args not parsable */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -714,9 +731,26 @@ int process_arguments(int argc, char **argv){
|
|||
return 0;
|
||||
}
|
||||
|
||||
char *perfd_offset (double offset)
|
||||
{
|
||||
return fperfdata ("offset", offset, "s",
|
||||
TRUE, owarn,
|
||||
TRUE, ocrit,
|
||||
FALSE, 0, FALSE, 0);
|
||||
}
|
||||
|
||||
char *perfd_jitter (double jitter)
|
||||
{
|
||||
return fperfdata ("jitter", jitter, "s",
|
||||
do_jitter, jwarn,
|
||||
do_jitter, jcrit,
|
||||
TRUE, 0, FALSE, 0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
int result, offset_result, jitter_result;
|
||||
double offset=0, jitter=0;
|
||||
char *result_line, *perfdata_line;
|
||||
|
||||
result=offset_result=jitter_result=STATE_UNKNOWN;
|
||||
|
||||
|
@ -760,28 +794,32 @@ int main(int argc, char *argv[]){
|
|||
|
||||
switch (result) {
|
||||
case STATE_CRITICAL :
|
||||
printf("NTP CRITICAL: ");
|
||||
asprintf(&result_line, "NTP CRITICAL:");
|
||||
break;
|
||||
case STATE_WARNING :
|
||||
printf("NTP WARNING: ");
|
||||
asprintf(&result_line, "NTP WARNING:");
|
||||
break;
|
||||
case STATE_OK :
|
||||
printf("NTP OK: ");
|
||||
asprintf(&result_line, "NTP OK:");
|
||||
break;
|
||||
default :
|
||||
printf("NTP UNKNOWN: ");
|
||||
asprintf(&result_line, "NTP UNKNOWN:");
|
||||
break;
|
||||
}
|
||||
if(offset_result==STATE_CRITICAL){
|
||||
printf("Offset unknown|offset=unknown");
|
||||
asprintf(&result_line, "%s %s", result_line, _("Offset unknown"));
|
||||
} else {
|
||||
if(offset_result==STATE_WARNING){
|
||||
printf("Unable to fully sample sync server. ");
|
||||
asprintf(&result_line, "%s %s", result_line, _("Unable to fully sample sync server"));
|
||||
}
|
||||
printf("Offset %.10g secs|offset=%.10g", offset, offset);
|
||||
asprintf(&result_line, "%s Offset %.10g secs", result_line, offset);
|
||||
asprintf(&perfdata_line, "%s", perfd_offset(offset));
|
||||
}
|
||||
if (do_jitter) printf(" jitter=%f", jitter);
|
||||
printf("\n");
|
||||
if (do_jitter) {
|
||||
asprintf(&result_line, "%s, jitter=%f", result_line, jitter);
|
||||
asprintf(&perfdata_line, "%s %s", perfdata_line, perfd_jitter(jitter));
|
||||
}
|
||||
printf("%s|%s\n", result_line, perfdata_line);
|
||||
|
||||
if(server_address!=NULL) free(server_address);
|
||||
return result;
|
||||
|
@ -802,7 +840,14 @@ void print_help(void){
|
|||
print_usage();
|
||||
printf (_(UT_HELP_VRSN));
|
||||
printf (_(UT_HOST_PORT), 'p', "123");
|
||||
printf (_(UT_WARN_CRIT));
|
||||
printf (" %s\n", "-w, --warning=DOUBLE");
|
||||
printf (" %s\n", _("Offset to result in warning status (seconds)"));
|
||||
printf (" %s\n", "-c, --critical=DOUBLE");
|
||||
printf (" %s\n", _("Offset to result in critical status (seconds)"));
|
||||
printf (" %s\n", "-j, --warning=DOUBLE");
|
||||
printf (" %s\n", _("Warning value for jitter"));
|
||||
printf (" %s\n", "-k, --critical=DOUBLE");
|
||||
printf (" %s\n", _("Critical value for jitter"));
|
||||
printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
|
||||
printf (_(UT_VERBOSE));
|
||||
printf (_(UT_SUPPORT));
|
||||
|
@ -812,5 +857,5 @@ void
|
|||
print_usage(void)
|
||||
{
|
||||
printf (_("Usage:"));
|
||||
printf("%s -H <host> [-O] [-w <warn>] [-c <crit>] [-j <warn>] [-k <crit>] [-v verbose]\n", progname);
|
||||
printf("%s -H <host> [-w <warn>] [-c <crit>] [-j <warn>] [-k <crit>] [-v verbose]\n", progname);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 2000-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 00:25:16 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:40 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -31,12 +31,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: check_nwstat.c,v 1.34 2006/10/19 00:25:16 opensides Exp $
|
||||
$Id: check_nwstat.c,v 1.35 2007/01/28 21:46:40 hweiss Exp $
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_nwstat";
|
||||
const char *revision = "$Revision: 1.34 $";
|
||||
const char *revision = "$Revision: 1.35 $";
|
||||
const char *copyright = "2000-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -1355,7 +1355,7 @@ int process_arguments(int argc, char **argv) {
|
|||
switch (c)
|
||||
{
|
||||
case '?': /* print short usage statement if args not parsable */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
case 'h': /* help */
|
||||
print_help();
|
||||
exit(STATE_OK);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 2000-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 00:25:16 $
|
||||
* Last Modified: $Date: 2007/02/06 21:03:21 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -31,12 +31,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: check_overcr.c,v 1.21 2006/10/19 00:25:16 opensides Exp $
|
||||
$Id: check_overcr.c,v 1.23 2007/02/06 21:03:21 opensides Exp $
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_overcr";
|
||||
const char *revision = "$Revision: 1.21 $";
|
||||
const char *revision = "$Revision: 1.23 $";
|
||||
const char *copyright = "2000-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -341,7 +341,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* print short usage statement if args not parsable */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
@ -451,15 +451,15 @@ print_help (void)
|
|||
printf ("\n");
|
||||
printf ("%s\n", _("Notes:"));
|
||||
|
||||
printf ("%s\n", _("For the available options, the critical threshold value should always be"));
|
||||
printf ("%s\n", _("For the available options, the critical threshold value should always be"));
|
||||
printf ("%s\n\n", _("higher than the warning threshold value, EXCEPT with the uptime variable"));
|
||||
|
||||
printf ("%s\n", _("This plugin requres that Eric Molitors' Over-CR collector daemon be"));
|
||||
printf ("%s\n", _("running on the remote server. Over-CR can be downloaded from"));
|
||||
printf ("%s\n", _("http://www.molitor.org/overcr (This plugin was tested with version 0.99.53"));
|
||||
printf ("%s\n", _("of the Over-CR collector)"));
|
||||
printf ("%s\n", _("This plugin requres that Eric Molitors' Over-CR collector daemon be"));
|
||||
printf ("%s\n", _("running on the remote server."));
|
||||
printf ("%s\n", " Over-CR can be downloaded from http://www.molitor.org/overcr");
|
||||
printf ("%s\n", _("This plugin was tested with version 0.99.53 of the Over-CR collector"));
|
||||
|
||||
printf (_(UT_SUPPORT));
|
||||
printf (_(UT_SUPPORT));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 00:25:16 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:40 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -30,12 +30,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: check_pgsql.c,v 1.34 2006/10/19 00:25:16 opensides Exp $
|
||||
$Id: check_pgsql.c,v 1.35 2007/01/28 21:46:40 hweiss Exp $
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_pgsql";
|
||||
const char *revision = "$Revision: 1.34 $";
|
||||
const char *revision = "$Revision: 1.35 $";
|
||||
const char *copyright = "1999-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -225,7 +225,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* usage */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 2000-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 00:25:16 $
|
||||
* Last Modified: $Date: 2007/03/12 10:51:05 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -30,12 +30,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: check_ping.c,v 1.52 2006/10/19 00:25:16 opensides Exp $
|
||||
$Id: check_ping.c,v 1.60 2007/03/12 10:51:05 tonvoon Exp $
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_ping";
|
||||
const char *revision = "$Revision: 1.52 $";
|
||||
const char *revision = "$Revision: 1.60 $";
|
||||
const char *copyright = "2000-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -103,13 +103,18 @@ main (int argc, char **argv)
|
|||
usage4 (_("Cannot catch SIGALRM"));
|
||||
}
|
||||
|
||||
/* handle timeouts gracefully */
|
||||
/* If ./configure finds ping has timeout values, set plugin alarm slightly
|
||||
* higher so that we can use response from command line ping */
|
||||
#ifdef PING_PACKETS_FIRST && PING_HAS_TIMEOUT
|
||||
alarm (timeout_interval + 1);
|
||||
#else
|
||||
alarm (timeout_interval);
|
||||
#endif
|
||||
|
||||
for (i = 0 ; i < n_addresses ; i++) {
|
||||
|
||||
#ifdef PING6_COMMAND
|
||||
if (is_inet6_addr(addresses[i]) && address_family != AF_INET)
|
||||
if (address_family != AF_INET && is_inet6_addr(addresses[i]))
|
||||
rawcmd = strdup(PING6_COMMAND);
|
||||
else
|
||||
rawcmd = strdup(PING_COMMAND);
|
||||
|
@ -211,7 +216,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* usage */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
@ -503,10 +508,22 @@ run_ping (const char *cmd, const char *addr)
|
|||
int
|
||||
error_scan (char buf[MAX_INPUT_BUFFER], const char *addr)
|
||||
{
|
||||
if (strstr (buf, "Network is unreachable"))
|
||||
die (STATE_CRITICAL, _("CRITICAL - Network unreachable (%s)"), addr);
|
||||
if (strstr (buf, "Network is unreachable") ||
|
||||
strstr (buf, "Destination Net Unreachable")
|
||||
)
|
||||
die (STATE_CRITICAL, _("CRITICAL - Network Unreachable (%s)"), addr);
|
||||
else if (strstr (buf, "Destination Host Unreachable"))
|
||||
die (STATE_CRITICAL, _("CRITICAL - Host Unreachable (%s)"), addr);
|
||||
else if (strstr (buf, "Destination Port Unreachable"))
|
||||
die (STATE_CRITICAL, _("CRITICAL - Bogus ICMP: Port Unreachable (%s)"), addr);
|
||||
else if (strstr (buf, "Destination Protocol Unreachable"))
|
||||
die (STATE_CRITICAL, _("CRITICAL - Bogus ICMP: Protocol Unreachable (%s)"), addr);
|
||||
else if (strstr (buf, "Destination Net Prohibited"))
|
||||
die (STATE_CRITICAL, _("CRITICAL - Network Prohibited (%s)"), addr);
|
||||
else if (strstr (buf, "Destination Host Prohibited"))
|
||||
die (STATE_CRITICAL, _("CRITICAL - Host Prohibited (%s)"), addr);
|
||||
else if (strstr (buf, "Packet filtered"))
|
||||
die (STATE_CRITICAL, _("CRITICAL - Packet Filtered (%s)"), addr);
|
||||
else if (strstr (buf, "unknown host" ))
|
||||
die (STATE_CRITICAL, _("CRITICAL - Host not found (%s)"), addr);
|
||||
else if (strstr (buf, "Time to live exceeded"))
|
||||
|
@ -551,14 +568,14 @@ print_help (void)
|
|||
printf (" %s\n", "-c, --critical=THRESHOLD");
|
||||
printf (" %s\n", _("critical threshold pair"));
|
||||
printf (" %s\n", "-p, --packets=INTEGER");
|
||||
printf (" %s\n", _("number of ICMP ECHO packets to send"));
|
||||
printf (_("(Default: %d)"), DEFAULT_MAX_PACKETS);
|
||||
printf (" %s ", _("number of ICMP ECHO packets to send"));
|
||||
printf (_("(Default: %d)\n"), DEFAULT_MAX_PACKETS);
|
||||
printf (" %s\n", "-L, --link");
|
||||
printf (" %s\n", _("show HTML in the plugin output (obsoleted by urlize)"));
|
||||
|
||||
printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
|
||||
|
||||
printf ("%s\n", _("THRESHOLD is <rta>,<pl>%% where <rta> is the round trip average travel"));
|
||||
printf ("%s\n", _("THRESHOLD is <rta>,<pl>% where <rta> is the round trip average travel"));
|
||||
printf ("%s\n", _("time (ms) which triggers a WARNING or CRITICAL state, and <pl> is the"));
|
||||
printf ("%s\n", _("percentage of packet loss to trigger an alarm state."));
|
||||
|
||||
|
@ -579,5 +596,5 @@ print_usage (void)
|
|||
{
|
||||
printf (_("Usage:"));
|
||||
printf ("%s -H <host_address> -w <wrta>,<wpl>%% -c <crta>,<cpl>%%\n", progname);
|
||||
printf (" [-p packets] [-t timeout] [-L] [-4|-6]\n");
|
||||
printf (" [-p packets] [-t timeout] [-4|-6]\n");
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/22 22:03:31 $
|
||||
* Last Modified: $Date: 2007/03/06 17:29:15 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -31,12 +31,13 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: check_procs.c,v 1.54 2006/10/22 22:03:31 opensides Exp $
|
||||
* $Id: check_procs.c,v 1.58 2007/03/06 17:29:15 tonvoon Exp $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_procs";
|
||||
const char *revision = "$Revision: 1.54 $";
|
||||
const char *program_name = "check_procs"; /* Required for coreutils libs */
|
||||
const char *revision = "$Revision: 1.58 $";
|
||||
const char *copyright = "2000-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -193,13 +194,13 @@ main (int argc, char **argv)
|
|||
strip (procargs);
|
||||
|
||||
/* Some ps return full pathname for command. This removes path */
|
||||
procprog = base_name(procprog);
|
||||
strcpy(procprog, base_name(procprog));
|
||||
|
||||
/* we need to convert the elapsed time to seconds */
|
||||
procseconds = convert_to_seconds(procetime);
|
||||
|
||||
if (verbose >= 3)
|
||||
printf ("%d %d %d %d %d %d %.2f %s %s %s %s\n",
|
||||
printf ("proc#=%d uid=%d vsz=%d rss=%d pid=%d ppid=%d pcpu=%.2f stat=%s etime=%s prog=%s args=%s\n",
|
||||
procs, procuid, procvsz, procrss,
|
||||
procpid, procppid, procpcpu, procstat,
|
||||
procetime, procprog, procargs);
|
||||
|
@ -358,7 +359,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* help */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 23:53:28 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:40 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -30,12 +30,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: check_radius.c,v 1.23 2006/10/19 23:53:28 opensides Exp $
|
||||
* $Id: check_radius.c,v 1.25 2007/01/28 21:46:40 hweiss Exp $
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
const char *progname = "check_radius";
|
||||
const char *revision = "$Revision: 1.23 $";
|
||||
const char *revision = "$Revision: 1.25 $";
|
||||
const char *copyright = "2000-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -139,6 +139,7 @@ main (int argc, char **argv)
|
|||
|
||||
service = PW_AUTHENTICATE_ONLY;
|
||||
|
||||
memset (&data, 0, sizeof(data));
|
||||
if (!(rc_avpair_add (&data.send_pairs, PW_SERVICE_TYPE, &service, 0) &&
|
||||
rc_avpair_add (&data.send_pairs, PW_USER_NAME, username, 0) &&
|
||||
rc_avpair_add (&data.send_pairs, PW_USER_PASSWORD, password, 0) &&
|
||||
|
@ -234,7 +235,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* print short usage statement if args not parsable */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (OK);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 23:53:28 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:40 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -31,12 +31,12 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*
|
||||
* $Id: check_real.c,v 1.27 2006/10/19 23:53:28 opensides Exp $
|
||||
* $Id: check_real.c,v 1.29 2007/01/28 21:46:40 hweiss Exp $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_real";
|
||||
const char *revision = "$Revision: 1.27 $";
|
||||
const char *revision = "$Revision: 1.29 $";
|
||||
const char *copyright = "2000-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -302,7 +302,7 @@ process_arguments (int argc, char **argv)
|
|||
}
|
||||
|
||||
while (1) {
|
||||
c = getopt_long (argc, argv, "+hVI:H:e:u:p:w:c:t:", longopts,
|
||||
c = getopt_long (argc, argv, "+hvVI:H:e:u:p:w:c:t:", longopts,
|
||||
&option);
|
||||
|
||||
if (c == -1 || c == EOF)
|
||||
|
@ -368,7 +368,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case '?': /* usage */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 23:53:28 $
|
||||
* Last Modified: $Date: 2007/03/06 22:29:27 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -31,12 +31,12 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*
|
||||
* $Id: check_smtp.c,v 1.54 2006/10/19 23:53:28 opensides Exp $
|
||||
* $Id: check_smtp.c,v 1.59 2007/03/06 22:29:27 tonvoon Exp $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_smtp";
|
||||
const char *revision = "$Revision: 1.54 $";
|
||||
const char *revision = "$Revision: 1.59 $";
|
||||
const char *copyright = "2000-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -169,9 +169,8 @@ main (int argc, char **argv)
|
|||
int result = STATE_UNKNOWN;
|
||||
char *cmd_str = NULL;
|
||||
char *helocmd = NULL;
|
||||
char *error_msg = NULL;
|
||||
char *error_msg = "";
|
||||
struct timeval tv;
|
||||
struct hostent *hp;
|
||||
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
|
@ -180,7 +179,7 @@ main (int argc, char **argv)
|
|||
if (process_arguments (argc, argv) == ERROR)
|
||||
usage4 (_("Could not parse arguments"));
|
||||
|
||||
/* initialize the HELO command with the localhostname */
|
||||
/* If localhostname not set on command line, use gethostname to set */
|
||||
if(! localhostname){
|
||||
localhostname = malloc (HOST_MAX_BYTES);
|
||||
if(!localhostname){
|
||||
|
@ -191,16 +190,14 @@ main (int argc, char **argv)
|
|||
printf(_("gethostname() failed!\n"));
|
||||
return STATE_CRITICAL;
|
||||
}
|
||||
hp = gethostbyname(localhostname);
|
||||
if(!hp) helocmd = localhostname;
|
||||
else helocmd = hp->h_name;
|
||||
} else {
|
||||
helocmd = localhostname;
|
||||
}
|
||||
if(use_ehlo)
|
||||
asprintf (&helocmd, "%s%s%s", SMTP_EHLO, helocmd, "\r\n");
|
||||
asprintf (&helocmd, "%s%s%s", SMTP_EHLO, localhostname, "\r\n");
|
||||
else
|
||||
asprintf (&helocmd, "%s%s%s", SMTP_HELO, helocmd, "\r\n");
|
||||
asprintf (&helocmd, "%s%s%s", SMTP_HELO, localhostname, "\r\n");
|
||||
|
||||
if (verbose)
|
||||
printf("HELOCMD: %s", helocmd);
|
||||
|
||||
/* initialize the MAIL command with optional FROM command */
|
||||
asprintf (&cmd_str, "%sFROM: %s%s", mail_command, from_arg, "\r\n");
|
||||
|
@ -298,14 +295,14 @@ main (int argc, char **argv)
|
|||
* we resent EHLO via TLS.
|
||||
*/
|
||||
if (my_send(helocmd, strlen(helocmd)) <= 0) {
|
||||
printf(_("SMTP UNKNOWN - Cannot send EHLO command via TLS.\n"));
|
||||
printf("%s\n", _("SMTP UNKNOWN - Cannot send EHLO command via TLS."));
|
||||
my_close();
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
if (verbose)
|
||||
printf(_("sent %s"), helocmd);
|
||||
if ((n = my_recv(buffer, MAX_INPUT_BUFFER - 1)) <= 0) {
|
||||
printf(_("SMTP UNKNOWN - Cannot read EHLO response via TLS.\n"));
|
||||
printf("%s\n", _("SMTP UNKNOWN - Cannot read EHLO response via TLS."));
|
||||
my_close();
|
||||
return STATE_UNKNOWN;
|
||||
}
|
||||
|
@ -318,7 +315,7 @@ main (int argc, char **argv)
|
|||
if ( check_cert ) {
|
||||
result = np_net_ssl_check_cert(days_till_exp);
|
||||
if(result != STATE_OK){
|
||||
printf (_("CRITICAL - Cannot retrieve server certificate.\n"));
|
||||
printf ("%s\n", _("CRITICAL - Cannot retrieve server certificate."));
|
||||
}
|
||||
my_close();
|
||||
return result;
|
||||
|
@ -383,12 +380,12 @@ main (int argc, char **argv)
|
|||
do {
|
||||
if (authuser == NULL) {
|
||||
result = STATE_CRITICAL;
|
||||
error_msg = _("no authuser specified, ");
|
||||
asprintf(&error_msg, _("no authuser specified, "));
|
||||
break;
|
||||
}
|
||||
if (authpass == NULL) {
|
||||
result = STATE_CRITICAL;
|
||||
error_msg = _("no authpass specified, ");
|
||||
asprintf(&error_msg, _("no authpass specified, "));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -398,7 +395,7 @@ main (int argc, char **argv)
|
|||
printf (_("sent %s\n"), "AUTH LOGIN");
|
||||
|
||||
if((ret = my_recv(buffer, MAXBUF - 1)) < 0){
|
||||
error_msg = _("recv() failed after AUTH LOGIN, \n");
|
||||
asprintf(&error_msg, _("recv() failed after AUTH LOGIN, "));
|
||||
result = STATE_WARNING;
|
||||
break;
|
||||
}
|
||||
|
@ -408,7 +405,7 @@ main (int argc, char **argv)
|
|||
|
||||
if (strncmp (buffer, "334", 3) != 0) {
|
||||
result = STATE_CRITICAL;
|
||||
error_msg = _("invalid response received after AUTH LOGIN, ");
|
||||
asprintf(&error_msg, _("invalid response received after AUTH LOGIN, "));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -421,7 +418,7 @@ main (int argc, char **argv)
|
|||
|
||||
if ((ret = my_recv(buffer, MAX_INPUT_BUFFER-1)) == -1) {
|
||||
result = STATE_CRITICAL;
|
||||
error_msg = _("recv() failed after sending authuser, ");
|
||||
asprintf(&error_msg, _("recv() failed after sending authuser, "));
|
||||
break;
|
||||
}
|
||||
buffer[ret] = 0;
|
||||
|
@ -430,7 +427,7 @@ main (int argc, char **argv)
|
|||
}
|
||||
if (strncmp (buffer, "334", 3) != 0) {
|
||||
result = STATE_CRITICAL;
|
||||
error_msg = _("invalid response received after authuser, ");
|
||||
asprintf(&error_msg, _("invalid response received after authuser, "));
|
||||
break;
|
||||
}
|
||||
/* encode authpass with base64 */
|
||||
|
@ -442,7 +439,7 @@ main (int argc, char **argv)
|
|||
}
|
||||
if ((ret = my_recv(buffer, MAX_INPUT_BUFFER-1)) == -1) {
|
||||
result = STATE_CRITICAL;
|
||||
error_msg = _("recv() failed after sending authpass, ");
|
||||
asprintf(&error_msg, _("recv() failed after sending authpass, "));
|
||||
break;
|
||||
}
|
||||
buffer[ret] = 0;
|
||||
|
@ -451,14 +448,14 @@ main (int argc, char **argv)
|
|||
}
|
||||
if (strncmp (buffer, "235", 3) != 0) {
|
||||
result = STATE_CRITICAL;
|
||||
error_msg = _("invalid response received after authpass, ");
|
||||
asprintf(&error_msg, _("invalid response received after authpass, "));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
} while (0);
|
||||
} else {
|
||||
result = STATE_CRITICAL;
|
||||
error_msg = _("only authtype LOGIN is supported, ");
|
||||
asprintf(&error_msg, _("only authtype LOGIN is supported, "));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -484,7 +481,7 @@ main (int argc, char **argv)
|
|||
|
||||
printf (_("SMTP %s - %s%.3f sec. response time%s%s|%s\n"),
|
||||
state_text (result),
|
||||
(error_msg == NULL ? "" : error_msg),
|
||||
error_msg,
|
||||
elapsed_time,
|
||||
verbose?", ":"", verbose?buffer:"",
|
||||
fperfdata ("time", elapsed_time, "s",
|
||||
|
@ -665,7 +662,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case '?': /* help */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/20 07:53:31 $
|
||||
* Last Modified: $Date: 2007/02/02 09:10:22 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -30,12 +30,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: check_snmp.c,v 1.67 2006/10/20 07:53:31 tonvoon Exp $
|
||||
* $Id: check_snmp.c,v 1.69 2007/02/02 09:10:22 dermoth Exp $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_snmp";
|
||||
const char *revision = "$Revision: 1.67 $";
|
||||
const char *revision = "$Revision: 1.69 $";
|
||||
const char *copyright = "1999-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -444,7 +444,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* usage */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
@ -527,11 +527,11 @@ process_arguments (int argc, char **argv)
|
|||
retries = atoi(optarg);
|
||||
break;
|
||||
case 'o': /* object identifier */
|
||||
if ( strspn( optarg, "0123456789." ) != strlen( optarg ) ) {
|
||||
if ( strspn( optarg, "0123456789.," ) != strlen( optarg ) ) {
|
||||
/*
|
||||
* we have something other than digits and periods, so we
|
||||
* have a mib variable, rather than just an SNMP OID, so
|
||||
* we have to actually read the mib files
|
||||
* we have something other than digits, periods and comas,
|
||||
* so we have a mib variable, rather than just an SNMP OID,
|
||||
* so we have to actually read the mib files
|
||||
*/
|
||||
needmibs = TRUE;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 23:53:28 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:40 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -31,12 +31,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: check_ssh.c,v 1.30 2006/10/19 23:53:28 opensides Exp $
|
||||
* $Id: check_ssh.c,v 1.32 2007/01/28 21:46:40 hweiss Exp $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_ssh";
|
||||
const char *revision = "$Revision: 1.30 $";
|
||||
const char *revision = "$Revision: 1.32 $";
|
||||
const char *copyright = "2000-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -102,7 +102,8 @@ process_arguments (int argc, char **argv)
|
|||
static struct option longopts[] = {
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{"host", required_argument, 0, 'H'},
|
||||
{"host", required_argument, 0, 'H'}, /* backward compatibility */
|
||||
{"hostname", required_argument, 0, 'H'},
|
||||
{"port", required_argument, 0, 'p'},
|
||||
{"use-ipv4", no_argument, 0, '4'},
|
||||
{"use-ipv6", no_argument, 0, '6'},
|
||||
|
@ -127,7 +128,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* help */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
case 'V': /* version */
|
||||
print_revision (progname, revision);
|
||||
exit (STATE_OK);
|
||||
|
@ -220,7 +221,7 @@ ssh_connect (char *haddr, int hport, char *remote_version)
|
|||
char *ssh_server = NULL;
|
||||
char rev_no[20];
|
||||
|
||||
sscanf ("$Revision: 1.30 $", "$Revision: %[0123456789.]", rev_no);
|
||||
sscanf ("$Revision: 1.32 $", "$Revision: %[0123456789.]", rev_no);
|
||||
|
||||
result = my_tcp_connect (haddr, hport, &sd);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Copyright (c) 2000 Karl DeBisschop (kdebisschop@users.sourceforge.net)
|
||||
* Copyright (c) 2000-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 23:53:28 $
|
||||
* Last Modified: $Date: 2007/02/07 14:06:11 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -28,12 +28,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: check_swap.c,v 1.56 2006/10/19 23:53:28 opensides Exp $
|
||||
* $Id: check_swap.c,v 1.59 2007/02/07 14:06:11 hweiss Exp $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_swap";
|
||||
const char *revision = "$Revision: 1.56 $";
|
||||
const char *revision = "$Revision: 1.59 $";
|
||||
const char *copyright = "2000-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -41,6 +41,22 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
|||
#include "popen.h"
|
||||
#include "utils.h"
|
||||
|
||||
#ifdef HAVE_DECL_SWAPCTL
|
||||
# ifdef HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
# endif
|
||||
# ifdef HAVE_SYS_SWAP_H
|
||||
# include <sys/swap.h>
|
||||
# endif
|
||||
# ifdef HAVE_SYS_STAT_H
|
||||
# include <sys/stat.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SWAP_CONVERSION
|
||||
# define SWAP_CONVERSION 1
|
||||
#endif
|
||||
|
||||
int check_swap (int usp, float free_swap_mb);
|
||||
int process_arguments (int argc, char **argv);
|
||||
int validate_arguments (void);
|
||||
|
@ -236,22 +252,33 @@ main (int argc, char **argv)
|
|||
# ifdef CHECK_SWAP_SWAPCTL_SVR4
|
||||
|
||||
/* get the number of active swap devices */
|
||||
nswaps=swapctl(SC_GETNSWP, NULL);
|
||||
if((nswaps=swapctl(SC_GETNSWP, NULL))== -1)
|
||||
die(STATE_UNKNOWN, _("Error getting swap devices\n") );
|
||||
|
||||
if(nswaps == 0)
|
||||
die(STATE_OK, _("SWAP OK: No swap devices defined\n"));
|
||||
|
||||
if(verbose >= 3)
|
||||
printf("Found %d swap device(s)\n", nswaps);
|
||||
|
||||
/* initialize swap table + entries */
|
||||
tbl=(swaptbl_t*)malloc(sizeof(swaptbl_t)+(sizeof(swapent_t)*nswaps));
|
||||
|
||||
if(tbl==NULL)
|
||||
die(STATE_UNKNOWN, _("malloc() failed!\n"));
|
||||
|
||||
memset(tbl, 0, sizeof(swaptbl_t)+(sizeof(swapent_t)*nswaps));
|
||||
tbl->swt_n=nswaps;
|
||||
for(i=0;i<nswaps;i++){
|
||||
ent=&tbl->swt_ent[i];
|
||||
ent->ste_path=(char*)malloc(sizeof(char)*MAXPATHLEN);
|
||||
if((tbl->swt_ent[i].ste_path=(char*)malloc(sizeof(char)*MAXPATHLEN)) == NULL)
|
||||
die(STATE_UNKNOWN, _("malloc() failed!\n"));
|
||||
}
|
||||
|
||||
/* and now, tally 'em up */
|
||||
swapctl_res=swapctl(SC_LIST, tbl);
|
||||
if(swapctl_res < 0){
|
||||
perror(_("swapctl failed: "));
|
||||
result = STATE_WARNING;
|
||||
die(STATE_UNKNOWN, _("Error in swapctl call\n"));
|
||||
}
|
||||
|
||||
for(i=0;i<nswaps;i++){
|
||||
|
@ -293,7 +320,7 @@ main (int argc, char **argv)
|
|||
swapctl_res=swapctl(SWAP_STATS, ent, nswaps);
|
||||
if(swapctl_res < 0){
|
||||
perror(_("swapctl failed: "));
|
||||
result = STATE_WARNING;
|
||||
die(STATE_UNKNOWN, _("Error in swapctl call\n"));
|
||||
}
|
||||
|
||||
for(i=0;i<nswaps;i++){
|
||||
|
@ -441,7 +468,7 @@ process_arguments (int argc, char **argv)
|
|||
print_help ();
|
||||
exit (STATE_OK);
|
||||
case '?': /* error */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 23:53:28 $
|
||||
* Last Modified: $Date: 2007/02/14 10:11:06 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -27,13 +27,13 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: check_tcp.c,v 1.80 2006/10/19 23:53:28 opensides Exp $
|
||||
* $Id: check_tcp.c,v 1.89 2007/02/14 10:11:06 tonvoon Exp $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/* progname "check_tcp" changes depending on symlink called */
|
||||
char *progname;
|
||||
const char *revision = "$Revision: 1.80 $";
|
||||
const char *revision = "$Revision: 1.89 $";
|
||||
const char *copyright = "1999-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -112,7 +112,7 @@ main (int argc, char **argv)
|
|||
|
||||
len = strlen(progname);
|
||||
if(len > 6 && !memcmp(progname, "check_", 6)) {
|
||||
SERVICE = progname + 6;
|
||||
SERVICE = strdup(progname + 6);
|
||||
for(i = 0; i < len - 6; i++)
|
||||
SERVICE[i] = toupper(SERVICE[i]);
|
||||
}
|
||||
|
@ -166,9 +166,9 @@ main (int argc, char **argv)
|
|||
}
|
||||
else if (!strncmp(SERVICE, "JABBER", 6)) {
|
||||
SEND = "<stream:stream to=\'host\' xmlns=\'jabber:client\' xmlns:stream=\'http://etherx.jabber.org/streams\'>\n";
|
||||
EXPECT = "<?xml version=\'1.0\'?><stream:stream xmlns:stream=\'http://etherx.jabber.org/streams\'";
|
||||
EXPECT = "<?xml version=\'1.0\'?><stream:stream xmlns=\'jabber:client\' xmlns:stream=\'http://etherx.jabber.org/streams\'";
|
||||
QUIT = "</stream:stream>\n";
|
||||
flags |= FLAG_SSL | FLAG_HIDE_OUTPUT;
|
||||
flags |= FLAG_HIDE_OUTPUT;
|
||||
PORT = 5222;
|
||||
}
|
||||
else if (!strncmp (SERVICE, "NNTPS", 5)) {
|
||||
|
@ -342,12 +342,15 @@ main (int argc, char **argv)
|
|||
/* this is a bit stupid, because we don't want to print the
|
||||
* response time (which can look ok to the user) if we didn't get
|
||||
* the response we were looking for. if-else */
|
||||
printf(_("%s %s - "), SERVICE, state_text(result));
|
||||
printf("%s %s - ", SERVICE, state_text(result));
|
||||
|
||||
if(match == -2 && len && !(flags & FLAG_HIDE_OUTPUT))
|
||||
printf("Unexpected response from host/socket: %s", status);
|
||||
else {
|
||||
printf("%.3f second response time on ", elapsed_time);
|
||||
if(match == -2)
|
||||
printf("Unexpected response from host/socket on ");
|
||||
else
|
||||
printf("%.3f second response time on ", elapsed_time);
|
||||
if(server_address[0] != '/')
|
||||
printf("port %d", server_port);
|
||||
else
|
||||
|
@ -358,17 +361,24 @@ main (int argc, char **argv)
|
|||
printf (" [%s]", status);
|
||||
|
||||
/* perf-data doesn't apply when server doesn't talk properly,
|
||||
* so print all zeroes on warn and crit */
|
||||
* so print all zeroes on warn and crit. Use fperfdata since
|
||||
* localisation settings can make different outputs */
|
||||
if(match == -2)
|
||||
printf ("|time=%fs;0.0;0.0;0.0;0.0", elapsed_time);
|
||||
printf ("|%s",
|
||||
fperfdata ("time", elapsed_time, "s",
|
||||
TRUE, 0,
|
||||
TRUE, 0,
|
||||
TRUE, 0,
|
||||
TRUE, socket_timeout)
|
||||
);
|
||||
else
|
||||
printf("|%s",
|
||||
fperfdata ("time", elapsed_time, "s",
|
||||
TRUE, warning_time,
|
||||
TRUE, critical_time,
|
||||
TRUE, 0,
|
||||
TRUE, socket_timeout)
|
||||
);
|
||||
TRUE, warning_time,
|
||||
TRUE, critical_time,
|
||||
TRUE, 0,
|
||||
TRUE, socket_timeout)
|
||||
);
|
||||
|
||||
putchar('\n');
|
||||
return result;
|
||||
|
@ -398,7 +408,7 @@ process_arguments (int argc, char **argv)
|
|||
{"expect", required_argument, 0, 'e'},
|
||||
{"maxbytes", required_argument, 0, 'm'},
|
||||
{"quit", required_argument, 0, 'q'},
|
||||
{"jail", required_argument, 0, 'j'},
|
||||
{"jail", no_argument, 0, 'j'},
|
||||
{"delay", required_argument, 0, 'd'},
|
||||
{"refuse", required_argument, 0, 'r'},
|
||||
{"mismatch", required_argument, 0, 'M'},
|
||||
|
@ -443,7 +453,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* print short usage statement if args not parsable */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
@ -520,6 +530,7 @@ process_arguments (int argc, char **argv)
|
|||
usage4 (_("Maxbytes must be a positive integer"));
|
||||
else
|
||||
maxbytes = strtol (optarg, NULL, 0);
|
||||
break;
|
||||
case 'q':
|
||||
if (escape)
|
||||
server_quit = np_escaped_string(optarg);
|
||||
|
@ -577,7 +588,7 @@ process_arguments (int argc, char **argv)
|
|||
if (server_address == NULL)
|
||||
usage4 (_("You must provide a server address"));
|
||||
else if (server_address[0] != '/' && is_host (server_address) == FALSE)
|
||||
die (STATE_CRITICAL, "%s: %s - %s\n", progname, _("Invalid hostname, address or socket"), server_address);
|
||||
die (STATE_CRITICAL, "%s %s - %s: %s\n", SERVICE, state_text(STATE_CRITICAL), _("Invalid hostname, address or socket"), server_address);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -603,7 +614,7 @@ print_help (void)
|
|||
printf (_(UT_IPv46));
|
||||
|
||||
printf (" %s\n", "-E, --escape");
|
||||
printf (" %s\n", _("Can use \\n, \\r, \\t or \\ in send or quit string."));
|
||||
printf (" %s\n", _("Can use \\n, \\r, \\t or \\ in send or quit string. Must come before send or quit option"));
|
||||
printf (" %s\n", _("Default: nothing added to send, \\r\\n added to end of quit"));
|
||||
printf (" %s\n", "-s, --send=STRING");
|
||||
printf (" %s\n", _("String to send to the server"));
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 23:53:28 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:40 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -30,12 +30,12 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*
|
||||
* $Id: check_time.c,v 1.28 2006/10/19 23:53:28 opensides Exp $
|
||||
* $Id: check_time.c,v 1.29 2007/01/28 21:46:40 hweiss Exp $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_time";
|
||||
const char *revision = "$Revision: 1.28 $";
|
||||
const char *revision = "$Revision: 1.29 $";
|
||||
const char *copyright = "1999-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -232,7 +232,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* print short usage statement if args not parsable */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* 2004 Arnaud Quette <arnaud.quette@mgeups.com>
|
||||
* Copyright (c) 2002-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 23:53:28 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:41 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -33,12 +33,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: check_ups.c,v 1.30 2006/10/19 23:53:28 opensides Exp $
|
||||
* $Id: check_ups.c,v 1.31 2007/01/28 21:46:41 hweiss Exp $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "check_ups";
|
||||
const char *revision = "$Revision: 1.30 $";
|
||||
const char *revision = "$Revision: 1.31 $";
|
||||
const char *copyright = "2002-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -494,7 +494,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* help */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
case 'H': /* hostname */
|
||||
if (is_host (optarg)) {
|
||||
server_address = optarg;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 2000-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 23:53:28 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:41 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -30,12 +30,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: check_users.c,v 1.21 2006/10/19 23:53:28 opensides Exp $
|
||||
* $Id: check_users.c,v 1.22 2007/01/28 21:46:41 hweiss Exp $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
const char *progname = "check_users";
|
||||
const char *revision = "$Revision: 1.21 $";
|
||||
const char *revision = "$Revision: 1.22 $";
|
||||
const char *copyright = "2000-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -156,7 +156,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* print short usage statement if args not parsable */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
exit (STATE_OK);
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: common.h,v 1.24 2006/07/29 01:43:34 tonvoon Exp $
|
||||
* $Id: common.h,v 1.28 2007/03/22 17:54:16 hweiss Exp $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
@ -36,6 +36,12 @@
|
|||
#define _COMMON_H_
|
||||
|
||||
#include "config.h"
|
||||
/* This needs to be removed for Solaris servers, where 64 bit files, but 32 bit architecture
|
||||
This needs to be done early on because subsequent system includes use _FILE_OFFSET_BITS
|
||||
Cannot remove from config.h because is included by regex.c from lib/ */
|
||||
#if __sun__ && !defined(_LP64) && _FILE_OFFSET_BITS == 64
|
||||
#undef _FILE_OFFSET_BITS
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FEATURES_H
|
||||
#include <features.h>
|
||||
|
@ -97,44 +103,17 @@
|
|||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
/* GNU Libraries */
|
||||
#include <getopt.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_LWRES_NETDB_H
|
||||
#include <lwres/netdb.h>
|
||||
#else
|
||||
# if !HAVE_GETADDRINFO
|
||||
# include "getaddrinfo.h"
|
||||
# else
|
||||
# include <netdb.h>
|
||||
# endif
|
||||
#endif
|
||||
#include "dirname.h"
|
||||
#include "vasprintf.h"
|
||||
#include "snprintf.h"
|
||||
#include "vsnprintf.h"
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
/* Fixes "Cannot use swapctl in the large files compilation environment" error on Solaris */
|
||||
#ifdef _FILE_OFFSET_BITS
|
||||
#undef _FILE_OFFSET_BITS
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DECL_SWAPCTL
|
||||
# ifdef HAVE_SYS_SWAP_H
|
||||
# include <sys/swap.h>
|
||||
# endif
|
||||
# ifdef HAVE_SYS_STAT_H
|
||||
# include <sys/stat.h>
|
||||
# endif
|
||||
# ifdef HAVE_SYS_PARAM_H
|
||||
# include <sys/param.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SWAP_CONVERSION
|
||||
# define SWAP_CONVERSION 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_POLL_H
|
||||
# include "sys/poll.h"
|
||||
#endif
|
||||
|
@ -153,22 +132,6 @@
|
|||
# define strtoul(a,b,c) (unsigned long)atol((a))
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ASPRINTF
|
||||
int asprintf(char **strp, const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_VASPRINTF
|
||||
/* int vasprintf(char **strp, const char *fmt, va_list ap); */
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SNPRINTF
|
||||
int snprintf(char *str, size_t size, const char *format, ...);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_VSNPRINTF
|
||||
int vsnprintf(char *str, size_t size, const char *format, va_list ap);
|
||||
#endif
|
||||
|
||||
/* SSL implementations */
|
||||
#ifdef HAVE_GNUTLS_OPENSSL_H
|
||||
# include <gnutls/openssl.h>
|
||||
|
@ -226,7 +189,7 @@ enum {
|
|||
|
||||
enum {
|
||||
DEFAULT_SOCKET_TIMEOUT = 10, /* timeout after 10 seconds */
|
||||
MAX_INPUT_BUFFER = 1024, /* max size of most buffers we use */
|
||||
MAX_INPUT_BUFFER = 8192, /* max size of most buffers we use */
|
||||
MAX_HOST_ADDRESS_LENGTH = 256 /* max size of a host address */
|
||||
};
|
||||
|
||||
|
|
|
@ -1,305 +0,0 @@
|
|||
/*
|
||||
* This file is part of libESMTP, a library for submission of RFC 2822
|
||||
* formatted electronic mail messages using the SMTP protocol described
|
||||
* in RFC 2821.
|
||||
* Modified by Jeremy T. Bouse for use in Nagios plugins
|
||||
*
|
||||
* Copyright (C) 2001,2002 Brian Stafford <brian@stafford.uklinux.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* An emulation of the RFC 2553 / Posix getaddrinfo resolver interface.
|
||||
*
|
||||
* $Id: getaddrinfo.c,v 1.2 2004/12/01 23:54:51 opensides Exp $
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
/* Need to turn off Posix features in glibc to build this */
|
||||
#undef _POSIX_C_SOURCE
|
||||
#undef _XOPEN_SOURCE
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <netdb.h>
|
||||
|
||||
#include "gethostbyname.h"
|
||||
#include "getaddrinfo.h"
|
||||
|
||||
static struct addrinfo *
|
||||
dup_addrinfo (struct addrinfo *info, void *addr, size_t addrlen)
|
||||
{
|
||||
struct addrinfo *ret;
|
||||
|
||||
ret = malloc (sizeof (struct addrinfo));
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
memcpy (ret, info, sizeof (struct addrinfo));
|
||||
ret->ai_addr = malloc (addrlen);
|
||||
if (ret->ai_addr == NULL)
|
||||
{
|
||||
free (ret);
|
||||
return NULL;
|
||||
}
|
||||
memcpy (ret->ai_addr, addr, addrlen);
|
||||
ret->ai_addrlen = addrlen;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
getaddrinfo (const char *nodename, const char *servname,
|
||||
const struct addrinfo *hints, struct addrinfo **res)
|
||||
{
|
||||
struct hostent *hp;
|
||||
struct servent *servent;
|
||||
const char *socktype;
|
||||
int port;
|
||||
struct addrinfo hint, result;
|
||||
struct addrinfo *ai, *sai, *eai;
|
||||
struct ghbnctx ghbnctx;
|
||||
char **addrs;
|
||||
int code;
|
||||
|
||||
memset (&result, 0, sizeof result);
|
||||
|
||||
/* default for hints */
|
||||
if (hints == NULL)
|
||||
{
|
||||
memset (&hint, 0, sizeof hint);
|
||||
hint.ai_family = PF_UNSPEC;
|
||||
hints = &hint;
|
||||
}
|
||||
|
||||
result.ai_socktype = hints->ai_socktype;
|
||||
|
||||
/* Note: maintain port in host byte order to make debugging easier */
|
||||
if (servname != NULL) {
|
||||
if (isdigit (*servname))
|
||||
port = strtol (servname, NULL, 10);
|
||||
else if ((servent = getservbyname (servname, socktype)) != NULL)
|
||||
port = ntohs (servent->s_port);
|
||||
else
|
||||
return EAI_NONAME;
|
||||
}
|
||||
|
||||
/* if nodename == NULL refer to the local host for a client or any
|
||||
for a server */
|
||||
if (nodename == NULL)
|
||||
{
|
||||
struct sockaddr_in sin;
|
||||
|
||||
/* check protocol family is PF_UNSPEC or PF_INET - could try harder
|
||||
for IPv6 but that's more code than I'm prepared to write */
|
||||
if (hints->ai_family == PF_UNSPEC || hints->ai_family == PF_INET)
|
||||
result.ai_family = AF_INET;
|
||||
else
|
||||
return EAI_FAMILY;
|
||||
|
||||
sin.sin_family = result.ai_family;
|
||||
sin.sin_port = htons (port);
|
||||
if (hints->ai_flags & AI_PASSIVE)
|
||||
sin.sin_addr.s_addr = htonl (INADDR_ANY);
|
||||
else
|
||||
sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
|
||||
/* Duplicate result and addr and return */
|
||||
*res = dup_addrinfo (&result, &sin, sizeof sin);
|
||||
return (*res == NULL) ? EAI_MEMORY : 0;
|
||||
}
|
||||
|
||||
/* If AI_NUMERIC is specified, use inet_addr to translate numbers and
|
||||
dots notation. */
|
||||
if (hints->ai_flags & AI_NUMERICHOST)
|
||||
{
|
||||
struct sockaddr_in sin;
|
||||
|
||||
/* check protocol family is PF_UNSPEC or PF_INET */
|
||||
if (hints->ai_family == PF_UNSPEC || hints->ai_family == PF_INET)
|
||||
result.ai_family = AF_INET;
|
||||
else
|
||||
return EAI_FAMILY;
|
||||
|
||||
sin.sin_family = result.ai_family;
|
||||
sin.sin_port = htons (port);
|
||||
sin.sin_addr.s_addr = inet_addr (nodename);
|
||||
/* Duplicate result and addr and return */
|
||||
*res = dup_addrinfo (&result, &sin, sizeof sin);
|
||||
return (*res == NULL) ? EAI_MEMORY : 0;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
hp = gethostbyname_ctx (nodename, &ghbnctx);
|
||||
if (hp == NULL)
|
||||
{
|
||||
if (errno != 0)
|
||||
{
|
||||
free_ghbnctx (&ghbnctx);
|
||||
return EAI_SYSTEM;
|
||||
}
|
||||
code = h_error_ctx (&ghbnctx);
|
||||
switch (code)
|
||||
{
|
||||
case HOST_NOT_FOUND: code = EAI_NODATA; break;
|
||||
case NO_DATA: code = EAI_NODATA; break;
|
||||
#if defined(NO_ADDRESS) && NO_ADDRESS != NO_DATA
|
||||
case NO_ADDRESS: code = EAI_NODATA; break;
|
||||
#endif
|
||||
case NO_RECOVERY: code = EAI_FAIL; break;
|
||||
case TRY_AGAIN: code = EAI_AGAIN; break;
|
||||
default: code = EAI_FAIL; break;
|
||||
}
|
||||
free_ghbnctx (&ghbnctx);
|
||||
return code;
|
||||
}
|
||||
|
||||
/* Check that the address family is acceptable.
|
||||
*/
|
||||
switch (hp->h_addrtype)
|
||||
{
|
||||
case AF_INET:
|
||||
if (!(hints->ai_family == PF_UNSPEC || hints->ai_family == PF_INET))
|
||||
goto eai_family;
|
||||
break;
|
||||
#ifdef USE_IPV6
|
||||
case AF_INET6:
|
||||
if (!(hints->ai_family == PF_UNSPEC || hints->ai_family == PF_INET6))
|
||||
goto eai_family;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
eai_family:
|
||||
free_ghbnctx (&ghbnctx);
|
||||
return EAI_FAMILY;
|
||||
}
|
||||
|
||||
/* For each element pointed to by hp, create an element in the
|
||||
result linked list. */
|
||||
sai = eai = NULL;
|
||||
for (addrs = hp->h_addr_list; *addrs != NULL; addrs++)
|
||||
{
|
||||
struct sockaddr sa;
|
||||
size_t addrlen;
|
||||
|
||||
sa.sa_family = hp->h_addrtype;
|
||||
switch (hp->h_addrtype)
|
||||
{
|
||||
case AF_INET:
|
||||
((struct sockaddr_in *) &sa)->sin_port = htons (port);
|
||||
memcpy (&((struct sockaddr_in *) &sa)->sin_addr,
|
||||
*addrs, hp->h_length);
|
||||
addrlen = sizeof (struct sockaddr_in);
|
||||
break;
|
||||
#ifdef USE_IPV6
|
||||
case AF_INET6:
|
||||
# if SIN6_LEN
|
||||
((struct sockaddr_in6 *) &sa)->sin6_len = hp->h_length;
|
||||
# endif
|
||||
((struct sockaddr_in6 *) &sa)->sin6_port = htons (port);
|
||||
memcpy (&((struct sockaddr_in6 *) &sa)->sin6_addr,
|
||||
*addrs, hp->h_length);
|
||||
addrlen = sizeof (struct sockaddr_in6);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
result.ai_family = hp->h_addrtype;
|
||||
ai = dup_addrinfo (&result, &sa, addrlen);
|
||||
if (ai == NULL)
|
||||
{
|
||||
free_ghbnctx (&ghbnctx);
|
||||
freeaddrinfo (sai);
|
||||
return EAI_MEMORY;
|
||||
}
|
||||
if (sai == NULL)
|
||||
sai = ai;
|
||||
else
|
||||
eai->ai_next = ai;
|
||||
eai = ai;
|
||||
}
|
||||
|
||||
if (sai == NULL)
|
||||
{
|
||||
free_ghbnctx (&ghbnctx);
|
||||
return EAI_NODATA;
|
||||
}
|
||||
|
||||
if (hints->ai_flags & AI_CANONNAME)
|
||||
{
|
||||
sai->ai_canonname = malloc (strlen (hp->h_name) + 1);
|
||||
if (sai->ai_canonname == NULL)
|
||||
{
|
||||
free_ghbnctx (&ghbnctx);
|
||||
freeaddrinfo (sai);
|
||||
return EAI_MEMORY;
|
||||
}
|
||||
strcpy (sai->ai_canonname, hp->h_name);
|
||||
}
|
||||
|
||||
free_ghbnctx (&ghbnctx);
|
||||
*res = sai;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
freeaddrinfo (struct addrinfo *ai)
|
||||
{
|
||||
struct addrinfo *next;
|
||||
|
||||
while (ai != NULL)
|
||||
{
|
||||
next = ai->ai_next;
|
||||
if (ai->ai_canonname != NULL)
|
||||
free (ai->ai_canonname);
|
||||
if (ai->ai_addr != NULL)
|
||||
free (ai->ai_addr);
|
||||
free (ai);
|
||||
ai = next;
|
||||
}
|
||||
}
|
||||
|
||||
const char *
|
||||
gai_strerror (int ecode)
|
||||
{
|
||||
static const char *eai_descr[] =
|
||||
{
|
||||
"no error",
|
||||
"address family for nodename not supported", /* EAI_ADDRFAMILY */
|
||||
"temporary failure in name resolution", /* EAI_AGAIN */
|
||||
"invalid value for ai_flags", /* EAI_BADFLAGS */
|
||||
"non-recoverable failure in name resolution", /* EAI_FAIL */
|
||||
"ai_family not supported", /* EAI_FAMILY */
|
||||
"memory allocation failure", /* EAI_MEMORY */
|
||||
"no address associated with nodename", /* EAI_NODATA */
|
||||
"nodename nor servname provided, or not known", /* EAI_NONAME */
|
||||
"servname not supported for ai_socktype", /* EAI_SERVICE */
|
||||
"ai_socktype not supported", /* EAI_SOCKTYPE */
|
||||
"system error returned in errno", /* EAI_SYSTEM */
|
||||
};
|
||||
|
||||
if (ecode < 0 || ecode > (int) (sizeof eai_descr/ sizeof eai_descr[0]))
|
||||
return "unknown error";
|
||||
return eai_descr[ecode];
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
#ifndef _getaddrinfo_h
|
||||
#define _getaddrinfo_h
|
||||
/*
|
||||
* This file is part of libESMTP, a library for submission of RFC 2822
|
||||
* formatted electronic mail messages using the SMTP protocol described
|
||||
* in RFC 2821.
|
||||
* Modified by Jeremy T. Bouse for use in Nagios plugins
|
||||
*
|
||||
* Copyright (C) 2001,2002 Brian Stafford <brian@stafford.uklinux.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* Structure and prototypes aken from RFC 2553
|
||||
*
|
||||
* $Id: getaddrinfo.h,v 1.2 2004/12/01 23:54:51 opensides Exp $
|
||||
*/
|
||||
|
||||
struct addrinfo
|
||||
{
|
||||
int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
|
||||
int ai_family; /* PF_xxx */
|
||||
int ai_socktype; /* SOCK_xxx */
|
||||
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
|
||||
size_t ai_addrlen; /* length of ai_addr */
|
||||
char *ai_canonname; /* canonical name for nodename */
|
||||
struct sockaddr *ai_addr; /* binary address */
|
||||
struct addrinfo *ai_next; /* next structure in linked list */
|
||||
};
|
||||
|
||||
/* Supposed to be defined in <netdb.h> */
|
||||
#define AI_PASSIVE 1 /* Socket address is intended for `bind'. */
|
||||
#define AI_CANONNAME 2 /* Request for canonical name. */
|
||||
#define AI_NUMERICHOST 4 /* Don't use name resolution. */
|
||||
|
||||
/* Supposed to be defined in <netdb.h> */
|
||||
#define EAI_ADDRFAMILY 1 /* address family for nodename not supported */
|
||||
#define EAI_AGAIN 2 /* temporary failure in name resolution */
|
||||
#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
|
||||
#define EAI_FAIL 4 /* non-recoverable failure in name resolution */
|
||||
#define EAI_FAMILY 5 /* ai_family not supported */
|
||||
#define EAI_MEMORY 6 /* memory allocation failure */
|
||||
#define EAI_NODATA 7 /* no address associated with nodename */
|
||||
#define EAI_NONAME 8 /* nodename nor servname provided, or not known */
|
||||
#define EAI_SERVICE 9 /* servname not supported for ai_socktype */
|
||||
#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
|
||||
#define EAI_SYSTEM 11 /* system error returned in errno */
|
||||
|
||||
/* RFC 2553 / Posix resolver */
|
||||
int getaddrinfo (const char *nodename, const char *servname,
|
||||
const struct addrinfo *hints, struct addrinfo **res);
|
||||
|
||||
/* Free addrinfo structure and associated storage */
|
||||
void freeaddrinfo (struct addrinfo *ai);
|
||||
|
||||
/* Convert error return from getaddrinfo() to string */
|
||||
const char *gai_strerror (int code);
|
||||
|
||||
#endif
|
|
@ -1,241 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Nagios gethostbyname_r()'s prototype.
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (C) 2001,2002 Brian Stafford <brian@stafford.uklinux.net>
|
||||
*
|
||||
* Last Modified: $Date: 2006/06/18 19:36:48 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This file is a ghastly hack because nobody can agree on
|
||||
* gethostbyname_r()'s prototype.
|
||||
*
|
||||
* License Information:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: gethostbyname.c,v 1.3 2006/06/18 19:36:48 opensides Exp $
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#define _SVID_SOURCE 1 /* Need this to get gethostbyname_r() */
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <netdb.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "gethostbyname.h"
|
||||
|
||||
#if HAVE_GETIPNODEBYNAME
|
||||
|
||||
void
|
||||
free_ghbnctx (struct ghbnctx *ctx)
|
||||
{
|
||||
assert (ctx != NULL);
|
||||
|
||||
if (ctx->hostent != NULL)
|
||||
freehostent (ctx->hostent);
|
||||
}
|
||||
|
||||
struct hostent *
|
||||
gethostbyname_ctx (const char *host, struct ghbnctx *ctx)
|
||||
{
|
||||
assert (ctx != NULL);
|
||||
|
||||
memset (ctx, 0, sizeof (struct ghbnctx));
|
||||
ctx->hostent = getipnodebyname (host, AF_UNSPEC, AI_ADDRCONFIG, &ctx->h_err);
|
||||
return ctx->hostent;
|
||||
}
|
||||
|
||||
int
|
||||
h_error_ctx (struct ghbnctx *ctx)
|
||||
{
|
||||
assert (ctx != NULL);
|
||||
|
||||
return ctx->h_err;
|
||||
}
|
||||
|
||||
#elif HAVE_GETHOSTBYNAME_R == 6
|
||||
|
||||
void
|
||||
free_ghbnctx (struct ghbnctx *ctx)
|
||||
{
|
||||
assert (ctx != NULL);
|
||||
|
||||
if (ctx->hostbuf != NULL)
|
||||
free (ctx->hostbuf);
|
||||
}
|
||||
|
||||
struct hostent *
|
||||
gethostbyname_ctx (const char *host, struct ghbnctx *ctx)
|
||||
{
|
||||
struct hostent *hp;
|
||||
char *tmp;
|
||||
int err;
|
||||
|
||||
assert (ctx != NULL);
|
||||
|
||||
memset (ctx, 0, sizeof (struct ghbnctx));
|
||||
ctx->hostbuf_len = 2048;
|
||||
if ((ctx->hostbuf = malloc (ctx->hostbuf_len)) == NULL)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
while ((err = gethostbyname_r (host,
|
||||
&ctx->hostent, ctx->hostbuf, ctx->hostbuf_len,
|
||||
&hp, &ctx->h_err)) == ERANGE)
|
||||
{
|
||||
ctx->hostbuf_len += 1024;
|
||||
if ((tmp = realloc (ctx->hostbuf, ctx->hostbuf_len)) == NULL)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
ctx->hostbuf = tmp;
|
||||
}
|
||||
if (err != 0)
|
||||
{
|
||||
errno = err;
|
||||
return NULL;
|
||||
}
|
||||
return hp;
|
||||
}
|
||||
|
||||
int
|
||||
h_error_ctx (struct ghbnctx *ctx)
|
||||
{
|
||||
assert (ctx != NULL);
|
||||
|
||||
return ctx->h_err;
|
||||
}
|
||||
|
||||
#elif HAVE_GETHOSTBYNAME_R == 5
|
||||
|
||||
void
|
||||
free_ghbnctx (struct ghbnctx *ctx)
|
||||
{
|
||||
assert (ctx != NULL);
|
||||
|
||||
if (ctx->hostbuf != NULL)
|
||||
free (ctx->hostbuf);
|
||||
}
|
||||
|
||||
struct hostent *
|
||||
gethostbyname_ctx (const char *host, struct ghbnctx *ctx)
|
||||
{
|
||||
struct hostent *hp;
|
||||
char *tmp;
|
||||
|
||||
assert (ctx != NULL);
|
||||
|
||||
memset (ctx, 0, sizeof (struct ghbnctx));
|
||||
ctx->hostbuf_len = 2048;
|
||||
if ((ctx->hostbuf = malloc (ctx->hostbuf_len)) == NULL)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
while ((hp = gethostbyname_r (host, &ctx->hostent,
|
||||
ctx->hostbuf, ctx->hostbuf_len,
|
||||
&ctx->h_err)) == NULL && errno == ERANGE)
|
||||
{
|
||||
ctx->hostbuf_len += 1024;
|
||||
if ((tmp = realloc (ctx->hostbuf, ctx->hostbuf_len)) == NULL)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
ctx->hostbuf = tmp;
|
||||
}
|
||||
return hp;
|
||||
}
|
||||
|
||||
int
|
||||
h_error_ctx (struct ghbnctx *ctx)
|
||||
{
|
||||
assert (ctx != NULL);
|
||||
|
||||
return ctx->h_err;
|
||||
}
|
||||
|
||||
#elif HAVE_GETHOSTBYNAME_R == 3
|
||||
|
||||
void
|
||||
free_ghbnctx (struct ghbnctx *ctx)
|
||||
{
|
||||
assert (ctx != NULL);
|
||||
|
||||
/* FIXME: does this need to do anything? */
|
||||
}
|
||||
|
||||
struct hostent *
|
||||
gethostbyname_ctx (const char *host, struct ghbnctx *ctx)
|
||||
{
|
||||
assert (ctx != NULL);
|
||||
|
||||
if (!gethostbyname_r (host, &ctx->hostent, &ctx->hostent_data))
|
||||
{
|
||||
ctx->h_err = h_errno; /* FIXME: is this correct? */
|
||||
return NULL;
|
||||
}
|
||||
return &ctx->hostent;
|
||||
}
|
||||
|
||||
int
|
||||
h_error_ctx (struct ghbnctx *ctx)
|
||||
{
|
||||
assert (ctx != NULL);
|
||||
|
||||
return ctx->h_err;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void
|
||||
free_ghbnctx (struct ghbnctx *ctx __attribute__ ((unused)))
|
||||
{
|
||||
assert (ctx != NULL);
|
||||
}
|
||||
|
||||
struct hostent *
|
||||
gethostbyname_ctx (const char *host, struct ghbnctx *ctx)
|
||||
{
|
||||
struct hostent *hp;
|
||||
|
||||
hp = gethostbyname (host);
|
||||
if (hp == NULL)
|
||||
ctx->h_err = h_errno;
|
||||
return hp;
|
||||
}
|
||||
|
||||
int
|
||||
h_error_ctx (struct ghbnctx *ctx)
|
||||
{
|
||||
assert (ctx != NULL);
|
||||
|
||||
return ctx->h_err;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,115 +0,0 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* Nagios gethostbyname_r()'s prototype.
|
||||
*
|
||||
* License: GPL
|
||||
* Copyright (C) 2001,2002 Brian Stafford <brian@stafford.uklinux.net>
|
||||
*
|
||||
* Last Modified: $Date: 2006/06/18 19:36:48 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This file is a ghastly hack because nobody can agree on
|
||||
* gethostbyname_r()'s prototype.
|
||||
*
|
||||
* License Information:
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: gethostbyname.h,v 1.3 2006/06/18 19:36:48 opensides Exp $
|
||||
*****************************************************************************/
|
||||
|
||||
/*************************************************************************
|
||||
Usage:
|
||||
|
||||
#include <errno.h>
|
||||
#include "gethostbyname.h"
|
||||
|
||||
f ()
|
||||
{
|
||||
struct ghbnctx ctx;
|
||||
|
||||
errno = 0;
|
||||
hp = gethostbyname_ctx (host, &ctx);
|
||||
if (hp == NULL)
|
||||
{
|
||||
if (errno != 0)
|
||||
handle_value_of_errno (errno);
|
||||
else
|
||||
handle_value_of_h_errno (h_error_ctx (&ctx));
|
||||
}
|
||||
else
|
||||
{
|
||||
...
|
||||
}
|
||||
free_ghbnctx (&ctx);
|
||||
}
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef _gethostbyname_h
|
||||
#define _gethostbyname_h
|
||||
|
||||
#if HAVE_GETIPNODEBYNAME
|
||||
|
||||
struct ghbnctx
|
||||
{
|
||||
int h_err;
|
||||
struct hostent *hostent;
|
||||
};
|
||||
|
||||
#elif HAVE_GETHOSTBYNAME_R == 6
|
||||
|
||||
struct ghbnctx
|
||||
{
|
||||
int h_err;
|
||||
struct hostent hostent;
|
||||
char *hostbuf;
|
||||
size_t hostbuf_len;
|
||||
};
|
||||
|
||||
#elif HAVE_GETHOSTBYNAME_R == 5
|
||||
|
||||
struct ghbnctx
|
||||
{
|
||||
int h_err;
|
||||
struct hostent hostent;
|
||||
char *hostbuf;
|
||||
int hostbuf_len;
|
||||
};
|
||||
|
||||
#elif HAVE_GETHOSTBYNAME_R == 3
|
||||
|
||||
struct ghbnctx
|
||||
{
|
||||
int h_err;
|
||||
struct hostent_data hostent_data;
|
||||
struct hostent hostent;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
struct ghbnctx
|
||||
{
|
||||
int h_err;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
struct hostent *gethostbyname_ctx (const char *host, struct ghbnctx *ctx);
|
||||
int h_error_ctx (struct ghbnctx *ctx);
|
||||
void free_ghbnctx (struct ghbnctx *ctx);
|
||||
|
||||
#endif
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 2002-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 23:53:28 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:41 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -29,7 +29,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: negate.c,v 1.26 2006/10/19 23:53:28 opensides Exp $
|
||||
* $Id: negate.c,v 1.27 2007/01/28 21:46:41 hweiss Exp $
|
||||
|
||||
@@-<article>
|
||||
|
||||
|
@ -69,7 +69,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
const char *progname = "negate";
|
||||
const char *revision = "$Revision: 1.26 $";
|
||||
const char *revision = "$Revision: 1.27 $";
|
||||
const char *copyright = "2002-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -189,7 +189,7 @@ process_arguments (int argc, char **argv)
|
|||
|
||||
switch (c) {
|
||||
case '?': /* help */
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
break;
|
||||
case 'h': /* help */
|
||||
print_help ();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)
|
||||
*
|
||||
* Last Modified: $Date: 2006/06/18 19:36:48 $
|
||||
* Last Modified: $Date: 2007/01/20 06:07:48 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -27,7 +27,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: netutils.c,v 1.31 2006/06/18 19:36:48 opensides Exp $
|
||||
* $Id: netutils.c,v 1.33 2007/01/20 06:07:48 dermoth Exp $
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -225,7 +225,7 @@ np_net_connect (const char *host_name, int port, int *sd, int proto)
|
|||
su.sun_family = AF_UNIX;
|
||||
strncpy(su.sun_path, host_name, UNIX_PATH_MAX);
|
||||
*sd = socket(PF_UNIX, SOCK_STREAM, 0);
|
||||
if(sd < 0){
|
||||
if(*sd < 0){
|
||||
die(STATE_UNKNOWN, _("Socket creation failed"));
|
||||
}
|
||||
result = connect(*sd, (struct sockaddr *)&su, sizeof(su));
|
||||
|
@ -324,14 +324,12 @@ int
|
|||
is_addr (const char *address)
|
||||
{
|
||||
#ifdef USE_IPV6
|
||||
if (is_inet_addr (address) && address_family != AF_INET6)
|
||||
if (address_family == AF_INET && is_inet_addr (address))
|
||||
return TRUE;
|
||||
else if (address_family == AF_INET6 && is_inet6_addr (address))
|
||||
return TRUE;
|
||||
#else
|
||||
if (is_inet_addr (address))
|
||||
#endif
|
||||
return (TRUE);
|
||||
|
||||
#ifdef USE_IPV6
|
||||
if (is_inet6_addr (address) && address_family != AF_INET)
|
||||
return (TRUE);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 1999 Ethan Galstad (nagios@nagios.org)
|
||||
*
|
||||
* Last Modified: $Date: 2005/10/31 20:03:19 $
|
||||
* Last Modified: $Date: 2007/01/24 22:47:25 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -28,18 +28,18 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: netutils.h,v 1.16 2005/10/31 20:03:19 seanius Exp $
|
||||
* $Id: netutils.h,v 1.18 2007/01/24 22:47:25 tonvoon Exp $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _NETUTILS_H_
|
||||
#define _NETUTILS_H_
|
||||
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
#include "utils.h"
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include "getaddrinfo.h"
|
||||
|
||||
#ifdef HAVE_SYS_UN_H
|
||||
# include <sys/un.h>
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
/.cvsignore/1.1/Fri Dec 2 22:25:22 2005//Tr1_4_5
|
||||
/check_disk.t/1.14/Wed Oct 18 12:12:11 2006//Tr1_4_5
|
||||
/check_dns.t/1.7/Wed Mar 29 08:13:29 2006//Tr1_4_5
|
||||
/check_fping.t/1.2/Mon Jul 25 01:47:14 2005//Tr1_4_5
|
||||
/check_ftp.t/1.3/Mon Jul 25 01:47:14 2005//Tr1_4_5
|
||||
/check_hpjd.t/1.3/Fri Mar 24 16:13:40 2006//Tr1_4_5
|
||||
/check_http.t/1.12/Thu Oct 19 18:59:58 2006//Tr1_4_5
|
||||
/check_imap.t/1.4/Wed Nov 9 16:40:12 2005//Tr1_4_5
|
||||
/check_load.t/1.6/Mon Oct 2 12:09:18 2006//Tr1_4_5
|
||||
/check_mysql.t/1.8/Fri Mar 17 14:07:34 2006//Tr1_4_5
|
||||
/check_mysql_query.t/1.2/Wed Feb 1 13:23:38 2006//Tr1_4_5
|
||||
/check_nagios.nagios1.status.log/1.1/Fri Dec 2 22:28:06 2005//Tr1_4_5
|
||||
/check_nagios.nagios2.status.dat/1.1/Fri Dec 2 22:28:06 2005//Tr1_4_5
|
||||
/check_nagios.t/1.2/Wed Apr 19 09:33:44 2006//Tr1_4_5
|
||||
/check_ntp.t/1.2/Mon Aug 14 08:42:23 2006//Tr1_4_5
|
||||
/check_ping.t/1.3/Thu Sep 15 08:39:23 2005//Tr1_4_5
|
||||
/check_pop.t/1.3/Wed Mar 22 15:45:49 2006//Tr1_4_5
|
||||
/check_procs.t/1.5/Thu Nov 3 15:13:13 2005//Tr1_4_5
|
||||
/check_smtp.t/1.4/Thu Oct 19 11:56:34 2006//Tr1_4_5
|
||||
/check_snmp.t/1.2/Mon Jul 25 01:47:15 2005//Tr1_4_5
|
||||
/check_swap.t/1.3/Wed Nov 9 16:40:12 2005//Tr1_4_5
|
||||
/check_tcp.t/1.3/Mon Jul 25 01:47:15 2005//Tr1_4_5
|
||||
/check_time.t/1.3/Thu Nov 3 15:04:16 2005//Tr1_4_5
|
||||
/check_udp.t/1.6/Fri Jul 28 22:44:11 2006//Tr1_4_5
|
||||
/check_users.t/1.2/Mon Jul 25 01:47:15 2005//Tr1_4_5
|
||||
D
|
|
@ -1 +0,0 @@
|
|||
nagiosplug/plugins/t
|
|
@ -1 +0,0 @@
|
|||
:ext:tonvoon@nagiosplug.cvs.sourceforge.net:/cvsroot/nagiosplug
|
|
@ -1 +0,0 @@
|
|||
Nr1_4_5
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# Disk Space Tests via check_disk
|
||||
#
|
||||
# $Id: check_disk.t,v 1.14 2006/10/18 12:12:11 tonvoon Exp $
|
||||
# $Id: check_disk.t,v 1.20 2007/03/30 09:00:06 psychotrahe Exp $
|
||||
#
|
||||
|
||||
# TODO: Add in tests for perf data. Need to beef up Nagios::Plugin::Performance to cater for max, min, etc
|
||||
|
@ -24,18 +24,24 @@ my $mountpoint2_valid = getTestParameter( "NP_MOUNTPOINT2_VALID", "Path to anoth
|
|||
if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") {
|
||||
plan skip_all => "Need 2 mountpoints to test";
|
||||
} else {
|
||||
plan tests => 42;
|
||||
plan tests => 68;
|
||||
}
|
||||
|
||||
$result = NPTest->testCmd(
|
||||
"./check_disk -w 1% -c 1% -p $mountpoint_valid -w 1% -c 1% -p $mountpoint2_valid"
|
||||
);
|
||||
cmp_ok( $result->return_code, "==", 0, "Checking two mountpoints (must have at least 1% free)");
|
||||
cmp_ok( $result->return_code, "==", 0, "Checking two mountpoints (must have at least 1% free in space and inodes)");
|
||||
my $c = 0;
|
||||
$_ = $result->output;
|
||||
$c++ while /\(/g; # counts number of "(" - should be two
|
||||
cmp_ok( $c, '==', 2, "Got two mountpoints in output");
|
||||
|
||||
|
||||
# Get perf data
|
||||
# Should use Nagios::Plugin
|
||||
my @perf_data = sort(split(/ /, $result->perf_output));
|
||||
|
||||
|
||||
# Calculate avg_free free on mountpoint1 and mountpoint2
|
||||
# because if you check in the middle, you should get different errors
|
||||
$_ = $result->output;
|
||||
|
@ -54,12 +60,67 @@ if ($free_on_mp1 > $free_on_mp2) {
|
|||
}
|
||||
|
||||
|
||||
# Do same for inodes
|
||||
$_ = $result->output;
|
||||
my ($free_inode_on_mp1, $free_inode_on_mp2) = (m/inode=(\d+)%.*inode=(\d+)%/);
|
||||
die "Cannot parse free inodes: $_" unless ($free_inode_on_mp1 && $free_inode_on_mp2);
|
||||
my $avg_inode_free = ceil(($free_inode_on_mp1 + $free_inode_on_mp2)/2);
|
||||
my ($more_inode_free, $less_inode_free);
|
||||
if ($free_inode_on_mp1 > $free_inode_on_mp2) {
|
||||
$more_inode_free = $mountpoint_valid;
|
||||
$less_inode_free = $mountpoint2_valid;
|
||||
} elsif ($free_inode_on_mp1 < $free_inode_on_mp2) {
|
||||
$more_inode_free = $mountpoint2_valid;
|
||||
$less_inode_free = $mountpoint_valid;
|
||||
} else {
|
||||
die "Two mountpoints with same inodes free - cannot do rest of test";
|
||||
}
|
||||
|
||||
# Verify performance data
|
||||
# First check absolute thresholds...
|
||||
$result = NPTest->testCmd(
|
||||
"./check_disk -w 20 -c 10 -p $mountpoint_valid"
|
||||
);
|
||||
$_ = $result->perf_output;
|
||||
my ($warn_absth_data, $crit_absth_data, $total_absth_data) = (m/=.[^;]*;(\d+);(\d+);\d+;(\d+)/);
|
||||
is ($warn_absth_data, $total_absth_data - 20, "Wrong warning in perf data using absolute thresholds");
|
||||
is ($crit_absth_data, $total_absth_data - 10, "Wrong critical in perf data using absolute thresholds");
|
||||
|
||||
# Then check percent thresholds.
|
||||
$result = NPTest->testCmd(
|
||||
"./check_disk -w 20% -c 10% -p $mountpoint_valid"
|
||||
);
|
||||
$_ = $result->perf_output;
|
||||
my ($warn_percth_data, $crit_percth_data, $total_percth_data) = (m/=.[^;]*;(\d+);(\d+);\d+;(\d+)/);
|
||||
is ($warn_percth_data, int((1-20/100)*$total_percth_data), "Wrong warning in perf data using percent thresholds");
|
||||
is ($crit_percth_data, int((1-10/100)*$total_percth_data), "Wrong critical in perf data using percent thresholds");
|
||||
|
||||
|
||||
# Check when order of mount points are reversed, that perf data remains same
|
||||
$result = NPTest->testCmd(
|
||||
"./check_disk -w 1% -c 1% -p $mountpoint2_valid -w 1% -c 1% -p $mountpoint_valid"
|
||||
);
|
||||
@_ = sort(split(/ /, $result->perf_output));
|
||||
is_deeply( \@perf_data, \@_, "perf data for both filesystems same when reversed");
|
||||
|
||||
|
||||
# Basic filesystem checks for sizes
|
||||
$result = NPTest->testCmd( "./check_disk -w 1 -c 1 -p $more_free" );
|
||||
cmp_ok( $result->return_code, '==', 0, "At least 1 MB available on $more_free");
|
||||
like ( $result->output, $successOutput, "OK output" );
|
||||
like ( $result->only_output, qr/free space/, "Have free space text");
|
||||
like ( $result->only_output, qr/$more_free/, "Have disk name in text");
|
||||
|
||||
$result = NPTest->testCmd( "./check_disk -w 1 -c 1 -p $more_free -p $less_free" );
|
||||
cmp_ok( $result->return_code, '==', 0, "At least 1 MB available on $more_free and $less_free");
|
||||
$_ = $result->output;
|
||||
print $result->output."\n";
|
||||
my ($free_mb_on_mp1, $free_mb_on_mp2) = (m/(\d+) MB .* (\d+) MB /g);
|
||||
my $free_mb_on_all = $free_mb_on_mp1 + $free_mb_on_mp2;
|
||||
print "$free_mb_on_all = $free_mb_on_mp1 + $free_mb_on_mp2\n";
|
||||
|
||||
|
||||
|
||||
$result = NPTest->testCmd( "./check_disk -e -w 1 -c 1 -p $more_free" );
|
||||
is( $result->only_output, "DISK OK", "No print out of disks with -e for OKs");
|
||||
|
||||
|
@ -76,8 +137,6 @@ cmp_ok( $result->return_code, "==", 2, "Get critical on less_free mountpoint $le
|
|||
like( $result->output, $failureOutput, "Right output" );
|
||||
|
||||
|
||||
|
||||
|
||||
$result = NPTest->testCmd(
|
||||
"./check_disk -w $avg_free% -c 0% -p $less_free"
|
||||
);
|
||||
|
@ -98,12 +157,11 @@ $result = NPTest->testCmd(
|
|||
"./check_disk -e -w $avg_free% -c 0% -p $less_free -w $avg_free% -c $avg_free% -p $more_free"
|
||||
);
|
||||
isnt( $result->output, $all_disks, "-e gives different output");
|
||||
like( $result->output, qr/$less_free/, "Found problem $less_free");
|
||||
unlike( $result->only_output, qr/$more_free/, "Has ignored $more_free as not a problem");
|
||||
like( $result->perf_output, qr/$more_free/, "But $more_free is still in perf data");
|
||||
|
||||
|
||||
|
||||
# Need spaces around filesystem name in case less_free and more_free are nested
|
||||
like( $result->output, qr/ $less_free /, "Found problem $less_free");
|
||||
unlike( $result->only_output, qr/ $more_free /, "Has ignored $more_free as not a problem");
|
||||
like( $result->perf_output, qr/ $more_free=/, "But $more_free is still in perf data");
|
||||
|
||||
$result = NPTest->testCmd(
|
||||
"./check_disk -w $avg_free% -c 0% -p $more_free"
|
||||
|
@ -126,6 +184,50 @@ cmp_ok( $result->return_code, '==', 2, "And reversing arguments should not make
|
|||
|
||||
|
||||
|
||||
# Basic inode checks for sizes
|
||||
|
||||
$result = NPTest->testCmd( "./check_disk --icritical 1% --iwarning 1% -p $more_inode_free" );
|
||||
is( $result->return_code, 0, "At least 1% free on inodes for both mountpoints");
|
||||
|
||||
$result = NPTest->testCmd( "./check_disk -K 100% -W 100% -p $less_inode_free" );
|
||||
is( $result->return_code, 2, "Critical requesting 100% free inodes for both mountpoints");
|
||||
|
||||
$result = NPTest->testCmd( "./check_disk --iwarning 1% --icritical 1% -p $more_inode_free -K 100% -W 100% -p $less_inode_free" );
|
||||
is( $result->return_code, 2, "Get critical on less_inode_free mountpoint $less_inode_free");
|
||||
|
||||
$result = NPTest->testCmd( "./check_disk -W $avg_inode_free% -K 0% -p $less_inode_free" );
|
||||
is( $result->return_code, 1, "Get warning on less_inode_free, when checking average");
|
||||
|
||||
$result = NPTest->testCmd( "./check_disk -W $avg_inode_free% -K $avg_inode_free% -p $more_inode_free ");
|
||||
is( $result->return_code, 0, "Get ok on more_inode_free when checking average");
|
||||
|
||||
$result = NPTest->testCmd( "./check_disk -W $avg_inode_free% -K 0% -p $less_inode_free -W $avg_inode_free% -K $avg_inode_free% -p $more_inode_free" );
|
||||
is ($result->return_code, 1, "Combine above two tests, get warning");
|
||||
$all_disks = $result->output;
|
||||
|
||||
$result = NPTest->testCmd( "./check_disk -e -W $avg_inode_free% -K 0% -p $less_inode_free -W $avg_inode_free% -K $avg_inode_free% -p $more_inode_free" );
|
||||
isnt( $result->output, $all_disks, "-e gives different output");
|
||||
like( $result->output, qr/$less_inode_free/, "Found problem $less_inode_free");
|
||||
unlike( $result->only_output, qr/$more_inode_free\s/, "Has ignored $more_inode_free as not a problem");
|
||||
like( $result->perf_output, qr/$more_inode_free/, "But $more_inode_free is still in perf data");
|
||||
|
||||
$result = NPTest->testCmd( "./check_disk -W $avg_inode_free% -K 0% -p $more_inode_free" );
|
||||
is( $result->return_code, 0, "Get ok on more_inode_free mountpoint, checking average");
|
||||
|
||||
$result = NPTest->testCmd( "./check_disk -W $avg_inode_free% -K $avg_inode_free% -p $less_inode_free" );
|
||||
is( $result->return_code, 2, "Get critical on less_inode_free, checking average");
|
||||
|
||||
$result = NPTest->testCmd( "./check_disk -W $avg_inode_free% -K 0% -p $more_inode_free -W $avg_inode_free% -K $avg_inode_free% -p $less_inode_free" );
|
||||
is( $result->return_code, 2, "Combining above two tests, get critical");
|
||||
|
||||
$result = NPTest->testCmd( "./check_disk -W $avg_inode_free% -K $avg_inode_free% -p $less_inode_free -W $avg_inode_free% -K 0% -p $more_inode_free" );
|
||||
cmp_ok( $result->return_code, '==', 2, "And reversing arguments should not make a difference");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TODO: {
|
||||
local $TODO = "Invalid percent figures";
|
||||
$result = NPTest->testCmd(
|
||||
|
@ -192,3 +294,28 @@ unlike( $result->perf_output, '/\/bob/', "perf data does not have /bob in it");
|
|||
|
||||
$result = NPTest->testCmd( "./check_disk -w 0% -c 0% -p / -p /" );
|
||||
unlike( $result->output, '/ \/ .* \/ /', "Should not show same filesystem twice");
|
||||
|
||||
# are partitions added if -C is given without path selection -p ?
|
||||
$result = NPTest->testCmd( "./check_disk -w 0% -c 0% -C -w 0% -c 0% -p $mountpoint_valid" );
|
||||
like( $result->output, '/;.*;\|/', "-C selects partitions if -p is not given");
|
||||
|
||||
# grouping: exit crit if the sum of free megs on mp1+mp2 is less than warn/crit
|
||||
$result = NPTest->testCmd( "./check_disk -w ". ($free_mb_on_all + 1) ." -c ". ($free_mb_on_all + 1) ."-g group -p $mountpoint_valid -p $mountpoint2_valid" );
|
||||
cmp_ok( $result->return_code, '==', 2, "grouping: exit crit if the sum of free megs on mp1+mp2 is less than warn/crit");
|
||||
|
||||
# grouping: exit warning if the sum of free megs on mp1+mp2 is between -w and -c
|
||||
$result = NPTest->testCmd( "./check_disk -w ". ($free_mb_on_all + 1) ." -c ". ($free_mb_on_all - 1) ." -g group -p $mountpoint_valid -p $mountpoint2_valid" );
|
||||
cmp_ok( $result->return_code, '==', 1, "grouping: exit warning if the sum of free megs on mp1+mp2 is between -w and -c ");
|
||||
|
||||
# grouping: exit ok if the sum of free megs on mp1+mp2 is more than warn/crit
|
||||
$result = NPTest->testCmd( "./check_disk -w ". ($free_mb_on_all - 1) ." -c ". ($free_mb_on_all - 1) ." -g group -p $mountpoint_valid -p $mountpoint2_valid" );
|
||||
cmp_ok( $result->return_code, '==', 0, "grouping: exit ok if the sum of free megs on mp1+mp2 is more than warn/crit");
|
||||
|
||||
# grouping: exit unknown if group name is given after -p
|
||||
$result = NPTest->testCmd( "./check_disk -w ". ($free_mb_on_all - 1) ." -c ". ($free_mb_on_all - 1) ." -p $mountpoint_valid -g group -p $mountpoint2_valid" );
|
||||
cmp_ok( $result->return_code, '==', 3, "Invalid options: -p must come after groupname");
|
||||
|
||||
# regex: exit unknown if given regex is not compileable
|
||||
$result = NPTest->testCmd( "./check_disk -w 1 -c 1 -r '('" );
|
||||
cmp_ok( $result->return_code, '==', 3, "Exit UNKNOWN if regex is not compileable");
|
||||
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
#
|
||||
# HyperText Transfer Protocol (HTTP) Test via check_http
|
||||
#
|
||||
# $Id: check_http.t,v 1.12 2006/10/19 18:59:58 tonvoon Exp $
|
||||
# $Id: check_http.t,v 1.14 2007/04/01 14:21:09 psychotrahe Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test::More;
|
||||
use NPTest;
|
||||
|
||||
plan tests => 22;
|
||||
plan tests => 26;
|
||||
|
||||
my $successOutput = '/OK.*HTTP.*second/';
|
||||
|
||||
|
@ -27,6 +27,18 @@ my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID",
|
|||
"An invalid (not known to DNS) hostname",
|
||||
"nosuchhost");
|
||||
|
||||
my $internet_access = getTestParameter( "NP_INTERNET_ACCESS",
|
||||
"Is this system directly connected to the internet?",
|
||||
"yes");
|
||||
|
||||
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" );
|
||||
}
|
||||
|
||||
|
||||
$res = NPTest->testCmd(
|
||||
"./check_http $host_tcp_http -wt 300 -ct 600"
|
||||
);
|
||||
|
@ -58,44 +70,62 @@ cmp_ok( $res->return_code, '==', 2, "Webserver $hostname_invalid not valid" );
|
|||
# Is also possible to get a socket timeout if DNS is not responding fast enough
|
||||
like( $res->output, "/Unable to open TCP socket|Socket timeout after/", "Output OK");
|
||||
|
||||
$res = NPTest->testCmd(
|
||||
"./check_http --ssl www.verisign.com"
|
||||
);
|
||||
cmp_ok( $res->return_code, '==', 0, "Can read https for www.verisign.com" );
|
||||
SKIP: {
|
||||
skip "No internet access and no host serving nagios in index file",
|
||||
7 if $internet_access eq "no" && ! $host_tcp_http2;
|
||||
|
||||
$res = NPTest->testCmd( "./check_http -C 1 --ssl www.verisign.com" );
|
||||
cmp_ok( $res->return_code, '==', 0, "Checking certificate for www.verisign.com");
|
||||
like ( $res->output, '/Certificate will expire on/', "Output OK" );
|
||||
my $saved_cert_output = $res->output;
|
||||
$host_tcp_http2 = "altinity.com" if (! $host_tcp_http2);
|
||||
|
||||
$res = NPTest->testCmd( "./check_http -C 1 www.verisign.com" );
|
||||
cmp_ok( $res->output, 'eq', $saved_cert_output, "--ssl option automatically added");
|
||||
$res = NPTest->testCmd( "./check_http -H $host_tcp_http2 -r 'nagios'" );
|
||||
cmp_ok( $res->return_code, "==", 0, "Got a reference to 'nagios'");
|
||||
|
||||
$res = NPTest->testCmd( "./check_http www.verisign.com -C 1" );
|
||||
cmp_ok( $res->output, 'eq', $saved_cert_output, "Old syntax for cert checking still works");
|
||||
$res = NPTest->testCmd( "./check_http -H $host_tcp_http2 -r 'nAGiOs'" );
|
||||
cmp_ok( $res->return_code, "==", 2, "Not got 'nAGiOs'");
|
||||
like ( $res->output, "/pattern not found/", "Error message says 'pattern not found'");
|
||||
|
||||
$res = NPTest->testCmd(
|
||||
"./check_http --ssl www.e-paycobalt.com"
|
||||
);
|
||||
cmp_ok( $res->return_code, "==", 0, "Can read https for www.e-paycobalt.com (uses AES certificate)" );
|
||||
$res = NPTest->testCmd( "./check_http -H $host_tcp_http2 -R 'nAGiOs'" );
|
||||
cmp_ok( $res->return_code, "==", 0, "But case insensitive doesn't mind 'nAGiOs'");
|
||||
|
||||
$res = NPTest->testCmd( "./check_http -H altinity.com -r 'nagios'" );
|
||||
cmp_ok( $res->return_code, "==", 0, "Got a reference to 'nagios'");
|
||||
$res = NPTest->testCmd( "./check_http -H $host_tcp_http2 -r 'nagios' --invert-regex" );
|
||||
cmp_ok( $res->return_code, "==", 2, "Invert results work when found");
|
||||
like ( $res->output, "/pattern found/", "Error message says 'pattern found'");
|
||||
|
||||
$res = NPTest->testCmd( "./check_http -H altinity.com -r 'nAGiOs'" );
|
||||
cmp_ok( $res->return_code, "==", 2, "Not got 'nAGiOs'");
|
||||
like ( $res->output, "/pattern not found/", "Error message says 'pattern not found'");
|
||||
$res = NPTest->testCmd( "./check_http -H $host_tcp_http2 -r 'nAGiOs' --invert-regex" );
|
||||
cmp_ok( $res->return_code, "==", 0, "And also when not found");
|
||||
}
|
||||
SKIP: {
|
||||
skip "No internet access", 11 if $internet_access eq "no";
|
||||
|
||||
$res = NPTest->testCmd( "./check_http -H altinity.com -R 'nAGiOs'" );
|
||||
cmp_ok( $res->return_code, "==", 0, "But case insensitive doesn't mind 'nAGiOs'");
|
||||
$res = NPTest->testCmd(
|
||||
"./check_http --ssl www.verisign.com"
|
||||
);
|
||||
cmp_ok( $res->return_code, '==', 0, "Can read https for www.verisign.com" );
|
||||
|
||||
$res = NPTest->testCmd( "./check_http -H altinity.com -r 'nagios' --invert-regex" );
|
||||
cmp_ok( $res->return_code, "==", 2, "Invert results work when found");
|
||||
like ( $res->output, "/pattern found/", "Error message says 'pattern found'");
|
||||
$res = NPTest->testCmd( "./check_http -C 1 --ssl www.verisign.com" );
|
||||
cmp_ok( $res->return_code, '==', 0, "Checking certificate for www.verisign.com");
|
||||
like ( $res->output, '/Certificate will expire on/', "Output OK" );
|
||||
my $saved_cert_output = $res->output;
|
||||
|
||||
$res = NPTest->testCmd( "./check_http -H altinity.com -r 'nAGiOs' --invert-regex" );
|
||||
cmp_ok( $res->return_code, "==", 0, "And also when not found");
|
||||
$res = NPTest->testCmd( "./check_http www.verisign.com -C 1" );
|
||||
is( $res->return_code, 0, "Old syntax for cert checking okay" );
|
||||
is( $res->output, $saved_cert_output, "Same output as new syntax" );
|
||||
|
||||
$res = NPTest->testCmd( "./check_http -H www.worldfirefoxday.com -f follow" );
|
||||
is( $res->return_code, 0, "Redirection based on location is okay");
|
||||
$res = NPTest->testCmd( "./check_http -H www.verisign.com -C 1" );
|
||||
is( $res->return_code, 0, "Updated syntax for cert checking okay" );
|
||||
is( $res->output, $saved_cert_output, "Same output as new syntax" );
|
||||
|
||||
$res = NPTest->testCmd( "./check_http -C 1 www.verisign.com" );
|
||||
cmp_ok( $res->output, 'eq', $saved_cert_output, "--ssl option automatically added");
|
||||
|
||||
$res = NPTest->testCmd( "./check_http www.verisign.com -C 1" );
|
||||
cmp_ok( $res->output, 'eq', $saved_cert_output, "Old syntax for cert checking still works");
|
||||
|
||||
$res = NPTest->testCmd(
|
||||
"./check_http --ssl www.e-paycobalt.com"
|
||||
);
|
||||
cmp_ok( $res->return_code, "==", 0, "Can read https for www.e-paycobalt.com (uses AES certificate)" );
|
||||
|
||||
|
||||
$res = NPTest->testCmd( "./check_http -H www.mozilla.com -u /firefox -f follow" );
|
||||
is( $res->return_code, 0, "Redirection based on location is okay");
|
||||
}
|
||||
|
|
65
plugins/t/check_jabber.t
Normal file
65
plugins/t/check_jabber.t
Normal file
|
@ -0,0 +1,65 @@
|
|||
#! /usr/bin/perl -w -I ..
|
||||
#
|
||||
# Jabber Server Tests via check_jabber
|
||||
#
|
||||
# $Id: check_jabber.t,v 1.3 2007/02/01 06:53:12 dermoth Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test::More;
|
||||
use NPTest;
|
||||
|
||||
plan tests => 10;
|
||||
|
||||
my $host_tcp_jabber = getTestParameter(
|
||||
"NP_HOST_TCP_JABBER",
|
||||
"A host providing the Jabber Service",
|
||||
"jabber.org"
|
||||
);
|
||||
|
||||
my $host_nonresponsive = getTestParameter(
|
||||
"NP_HOST_NONRESPONSIVE",
|
||||
"The hostname of system not responsive to network requests",
|
||||
"10.0.0.1",
|
||||
);
|
||||
|
||||
my $hostname_invalid = getTestParameter(
|
||||
"NP_HOSTNAME_INVALID",
|
||||
"An invalid (not known to DNS) hostname",
|
||||
"nosuchhost",
|
||||
);
|
||||
|
||||
|
||||
my $jabberOK = '/JABBER OK\s-\s\d+\.\d+\ssecond response time on port 5222/';
|
||||
|
||||
my $jabberUnresponsive = '/CRITICAL\s-\sSocket timeout after\s\d+\sseconds/';
|
||||
|
||||
my $jabberInvalid = '/JABBER CRITICAL - Invalid hostname, address or socket:\s.+/';
|
||||
|
||||
my $r;
|
||||
|
||||
SKIP: {
|
||||
skip "No jabber server defined", 6 unless $host_tcp_jabber;
|
||||
|
||||
$r = NPTest->testCmd( "./check_jabber $host_tcp_jabber" );
|
||||
is( $r->return_code, 0, "Connected okay");
|
||||
like( $r->output, $jabberOK, "Output as expected" );
|
||||
|
||||
$r = NPTest->testCmd( "./check_jabber -H $host_tcp_jabber -w 9 -c 9 -t 10" );
|
||||
is( $r->return_code, 0, "Connected okay, within limits" );
|
||||
like( $r->output, $jabberOK, "Output as expected" );
|
||||
|
||||
$r = NPTest->testCmd( "./check_jabber $host_tcp_jabber -wt 9 -ct 9 -to 10" );
|
||||
is( $r->return_code, 0, "Old syntax okay" );
|
||||
like( $r->output, $jabberOK, "Output as expected" );
|
||||
|
||||
}
|
||||
|
||||
$r = NPTest->testCmd( "./check_jabber $host_nonresponsive" );
|
||||
is( $r->return_code, 2, "Unresponsive host gives critical" );
|
||||
like( $r->output, $jabberUnresponsive );
|
||||
|
||||
$r = NPTest->testCmd( "./check_jabber $hostname_invalid" );
|
||||
is( $r->return_code, 2, "Invalid hostname gives critical" );
|
||||
like( $r->output, $jabberInvalid );
|
||||
|
|
@ -2,36 +2,109 @@
|
|||
#
|
||||
# Ping Response Tests via check_ping
|
||||
#
|
||||
# $Id: check_ping.t,v 1.3 2005/09/15 08:39:23 tonvoon Exp $
|
||||
# $Id: check_ping.t,v 1.5 2007/03/12 10:51:06 tonvoon Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test;
|
||||
use Test::More;
|
||||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
|
||||
BEGIN {$tests = 8; plan tests => $tests}
|
||||
plan tests => 20;
|
||||
|
||||
my $successOutput = '/PING (ok|OK) - Packet loss = +[0-9]{1,2}\%, +RTA = [\.0-9]+ ms/';
|
||||
my $failureOutput = '/Packet loss = +[0-9]{1,2}\%, +RTA = [\.0-9]+ ms/';
|
||||
|
||||
my $host_responsive = getTestParameter( "host_responsive", "NP_HOST_RESPONSIVE", "localhost",
|
||||
"The hostname of system responsive to network requests" );
|
||||
my $host_responsive = getTestParameter( "NP_HOST_RESPONSIVE",
|
||||
"The hostname of system responsive to network requests",
|
||||
"localhost" );
|
||||
|
||||
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( "NP_HOST_NONRESPONSIVE",
|
||||
"The hostname of system not responsive to network requests",
|
||||
"10.0.0.1" );
|
||||
|
||||
my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_INVALID", "nosuchhost",
|
||||
"An invalid (not known to DNS) hostname" );
|
||||
my $hostname_invalid = getTestParameter( "NP_HOSTNAME_INVALID",
|
||||
"An invalid (not known to DNS) hostname",
|
||||
"nosuchhost" );
|
||||
|
||||
my $t;
|
||||
my $res;
|
||||
|
||||
$t += checkCmd( "./check_ping $host_responsive 100 100 1000 1000 -p 1", 0, $successOutput );
|
||||
$t += checkCmd( "./check_ping $host_responsive 0 0 0 0 -p 1", 2, $failureOutput );
|
||||
$t += checkCmd( "./check_ping $host_nonresponsive 0 0 0 0 -p 1 -to 1", 2 );
|
||||
$t += checkCmd( "./check_ping $hostname_invalid 0 0 0 0 -p 1 -to 1", 3 );
|
||||
$t += checkCmd( "./check_ping -w 100,10% -c 200,20%" , 3 , "/You must specify a server address or host name.*/");
|
||||
$res = NPTest->testCmd(
|
||||
"./check_ping -H $host_responsive -w 10,100% -c 10,100% -p 1"
|
||||
);
|
||||
is( $res->return_code, 0, "Syntax ok" );
|
||||
like( $res->output, $successOutput, "Output OK" );
|
||||
|
||||
$res = NPTest->testCmd(
|
||||
"./check_ping -H $host_responsive -w 0,0% -c 10,100% -p 1"
|
||||
);
|
||||
is( $res->return_code, 1, "Syntax ok, with forced warning" );
|
||||
like( $res->output, $failureOutput, "Output OK" );
|
||||
|
||||
$res = NPTest->testCmd(
|
||||
"./check_ping -H $host_responsive -w 0,0% -c 0,0% -p 1"
|
||||
);
|
||||
is( $res->return_code, 2, "Syntax ok, with forced critical" );
|
||||
like( $res->output, $failureOutput, "Output OK" );
|
||||
|
||||
$res = NPTest->testCmd(
|
||||
"./check_ping $host_responsive 100 100 1000 1000 -p 1"
|
||||
);
|
||||
is( $res->return_code, 0, "Old syntax ok" );
|
||||
like( $res->output, $successOutput, "Output OK" );
|
||||
|
||||
$res = NPTest->testCmd(
|
||||
"./check_ping $host_responsive 0 0 0 0 -p 1"
|
||||
);
|
||||
is( $res->return_code, 2, "Old syntax, with forced critical" );
|
||||
like( $res->output, $failureOutput, "Output OK" );
|
||||
|
||||
|
||||
# check_ping results will depend on whether the ping command discovered by
|
||||
# ./configure has a timeout option. If it does, then the timeout will
|
||||
# be set, so check_ping will always get a response. If it doesn't
|
||||
# then check_ping will timeout. We do 2 tests for check_ping's timeout
|
||||
# - 1 second
|
||||
# - 15 seconds
|
||||
# The latter should be higher than normal ping timeouts, so should always give a packet loss result
|
||||
open(F, "../config.h") or die "Cannot open ../config.h";
|
||||
@_ = grep /define PING_HAS_TIMEOUT 1|define PING_PACKETS_FIRST 1/, <F>;
|
||||
my $has_timeout;
|
||||
$has_timeout = 1 if (scalar @_ == 2); # Need both defined
|
||||
close F;
|
||||
$res = NPTest->testCmd(
|
||||
"./check_ping -H $host_nonresponsive -w 10,100% -c 10,100% -p 1 -t 1"
|
||||
);
|
||||
is( $res->return_code, 2, "Timeout 1 second - host nonresponsive" );
|
||||
if ($has_timeout) {
|
||||
like( $res->output, '/100%/', "Error contains '100%' string (for 100% packet loss)" );
|
||||
} else {
|
||||
like( $res->output, '/timed out/', "Error contains 'timed out' string" );
|
||||
}
|
||||
|
||||
$res = NPTest->testCmd(
|
||||
"./check_ping -H $host_nonresponsive -w 10,100% -c 10,100% -p 1 -t 15"
|
||||
);
|
||||
is( $res->return_code, 2, "Timeout 15 seconds - host nonresponsive" );
|
||||
like( $res->output, '/100%/', "Error contains '100%' string (for 100% packet loss)" );
|
||||
|
||||
|
||||
|
||||
|
||||
$res = NPTest->testCmd(
|
||||
"./check_ping $host_nonresponsive -p 1 -t 1 100 100 1000 10000"
|
||||
);
|
||||
is( $res->return_code, 2, "Old syntax: Timeout - host nonresponsive" );
|
||||
like( $res->output, '/100%/', "Error contains '100%' string (for 100% packet loss)" );
|
||||
|
||||
$res = NPTest->testCmd(
|
||||
"./check_ping $hostname_invalid 0 0 0 0 -p 1 -t 1"
|
||||
);
|
||||
is( $res->return_code, 3, "Invalid hostname" );
|
||||
like( $res->output, '/invalid hostname/i', "Error contains 'invalid hostname' string");
|
||||
|
||||
$res = NPTest->testCmd(
|
||||
"./check_ping -w 100,10% -c 200,20%"
|
||||
);
|
||||
is( $res->return_code, 3, "No hostname" );
|
||||
like( $res->output, '/You must specify a server address or host name/', "Output with appropriate error message");
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# Simple Network Management Protocol (SNMP) Test via check_snmp
|
||||
#
|
||||
# $Id: check_snmp.t,v 1.2 2005/07/25 01:47:15 illumino Exp $
|
||||
# $Id: check_snmp.t,v 1.3 2006/12/23 18:59:36 dermoth Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
@ -35,13 +35,13 @@ if ( -x "./check_snmp" )
|
|||
{ 0 => 'continue', 3 => 'skip' }, '/^SNMP OK - \d+/', %exceptions );
|
||||
|
||||
$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 );
|
||||
{ 0 => 'continue', 3 => 'skip' }, '/^SNMP OK - 1\s.*$/', %exceptions );
|
||||
|
||||
$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 );
|
||||
{ 1 => 'continue', 3 => 'skip' }, '/^SNMP WARNING - \*1\*\s.*$/', %exceptions );
|
||||
|
||||
$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 );
|
||||
{ 2 => 'continue', 3 => 'skip' }, '/^SNMP CRITICAL - \*1\*\s.*$/', %exceptions );
|
||||
|
||||
$t += checkCmd( "./check_snmp -H $host_nonresponsive -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:", 3, '/SNMP problem - /' );
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#
|
||||
# TCP Connection Based Tests via check_tcp
|
||||
#
|
||||
# $Id: check_tcp.t,v 1.3 2005/07/25 01:47:15 illumino Exp $
|
||||
# $Id: check_tcp.t,v 1.5 2007/02/14 10:11:07 tonvoon Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
@ -10,7 +10,7 @@ use Test;
|
|||
use NPTest;
|
||||
|
||||
use vars qw($tests);
|
||||
BEGIN {$tests = 5; plan tests => $tests}
|
||||
BEGIN {$tests = 7; plan tests => $tests}
|
||||
|
||||
my $host_tcp_http = getTestParameter( "host_tcp_http", "NP_HOST_TCP_HTTP", "localhost",
|
||||
"A host providing the HTTP Service (a web server)" );
|
||||
|
@ -23,6 +23,8 @@ my $hostname_invalid = getTestParameter( "hostname_invalid", "NP_HOSTNAME_IN
|
|||
|
||||
my $successOutput = '/^TCP OK\s-\s+[0-9]?\.?[0-9]+ second response time on port [0-9]+/';
|
||||
|
||||
my $failedExpect = '/^TCP WARNING\s-\sUnexpected response from host/socket on port [0-9]+/';
|
||||
|
||||
my $t;
|
||||
|
||||
$t += checkCmd( "./check_tcp $host_tcp_http -p 80 -wt 300 -ct 600", 0, $successOutput );
|
||||
|
@ -30,5 +32,9 @@ $t += checkCmd( "./check_tcp $host_tcp_http -p 81 -wt 0 -ct 0 -to 1", 2
|
|||
$t += checkCmd( "./check_tcp $host_nonresponsive -p 80 -wt 0 -ct 0 -to 1", 2 );
|
||||
$t += checkCmd( "./check_tcp $hostname_invalid -p 80 -wt 0 -ct 0 -to 1", 2 );
|
||||
|
||||
# Need the \r\n to make it more standards compliant with web servers. Need the various quotes
|
||||
# so that perl doesn't interpret the \r\n and is passed onto command line correctly
|
||||
$t += checkCmd( "./check_tcp $host_tcp_http -p 80 -E -s ".'"GET /\r\n\r\n"'." -e 'ThisShouldntMatch' -j", 1, $failedExpect );
|
||||
|
||||
exit(0) if defined($Test::Harness::VERSION);
|
||||
exit($tests - $t);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* License: GPL
|
||||
* Copyright (c) 2000-2006 nagios-plugins team
|
||||
*
|
||||
* Last Modified: $Date: 2006/10/19 23:53:28 $
|
||||
* Last Modified: $Date: 2007/01/28 21:46:41 $
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
|
@ -32,12 +32,12 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
|
||||
$Id: urlize.c,v 1.21 2006/10/19 23:53:28 opensides Exp $
|
||||
$Id: urlize.c,v 1.22 2007/01/28 21:46:41 hweiss Exp $
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
const char *progname = "urlize";
|
||||
const char *revision = "$Revision: 1.21 $";
|
||||
const char *revision = "$Revision: 1.22 $";
|
||||
const char *copyright = "2000-2006";
|
||||
const char *email = "nagiosplug-devel@lists.sourceforge.net";
|
||||
|
||||
|
@ -100,7 +100,7 @@ main (int argc, char **argv)
|
|||
break;
|
||||
case '?':
|
||||
default:
|
||||
usage2 (_("Unknown argument"), optarg);
|
||||
usage5 ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
* Copyright (c) 2006 Nagios Plugin Development Team
|
||||
* License: GPL
|
||||
*
|
||||
* $Revision: 1.50 $
|
||||
* $Date: 2006/07/13 12:50:21 $
|
||||
* $Revision: 1.51 $
|
||||
* $Date: 2007/01/28 21:46:41 $
|
||||
****************************************************************************/
|
||||
|
||||
#define LOCAL_TIMEOUT_ALARM_HANDLER
|
||||
|
@ -94,6 +94,13 @@ usage4 (const char *msg)
|
|||
exit (STATE_UNKNOWN);
|
||||
}
|
||||
|
||||
void
|
||||
usage5 (void)
|
||||
{
|
||||
print_usage();
|
||||
exit (STATE_UNKNOWN);
|
||||
}
|
||||
|
||||
char *
|
||||
clean_revstring (const char *revstring)
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@ suite of plugins. */
|
|||
|
||||
/* Standardize version information, termination */
|
||||
|
||||
/* $Id: utils.h,v 1.32 2006/09/02 20:41:18 seanius Exp $ */
|
||||
/* $Id: utils.h,v 1.33 2007/01/28 21:46:41 hweiss Exp $ */
|
||||
|
||||
void support (void);
|
||||
char *clean_revstring (const char *);
|
||||
|
@ -80,8 +80,9 @@ int max_state (int a, int b);
|
|||
void usage (const char *) __attribute__((noreturn));
|
||||
void usage2(const char *, const char *) __attribute__((noreturn));
|
||||
void usage3(const char *, int) __attribute__((noreturn));
|
||||
void usage4(const char *);
|
||||
void usage_va(const char *fmt, ...);
|
||||
void usage4(const char *) __attribute__((noreturn));
|
||||
void usage5(void) __attribute__((noreturn));
|
||||
void usage_va(const char *fmt, ...) __attribute__((noreturn));
|
||||
|
||||
const char *state_text (int);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue