diff options
| -rw-r--r-- | .travis.yml | 24 | ||||
| -rw-r--r-- | NEWS | 10 | ||||
| -rwxr-xr-x | NP-VERSION-GEN | 2 | ||||
| -rw-r--r-- | configure.ac | 8 | ||||
| -rw-r--r-- | doc/developer-guidelines.sgml | 7 | ||||
| -rw-r--r-- | gl/Makefile.am | 11 | ||||
| -rw-r--r-- | gl/m4/gnulib-cache.m4 | 3 | ||||
| -rw-r--r-- | gl/m4/gnulib-comp.m4 | 15 | ||||
| -rw-r--r-- | gl/m4/strcasestr.m4 | 142 | ||||
| -rw-r--r-- | gl/strcasestr.c | 82 | ||||
| -rw-r--r-- | plugins-root/check_dhcp.c | 43 | ||||
| -rw-r--r-- | plugins-root/pst3.c | 4 | ||||
| -rw-r--r-- | plugins/Makefile.am | 2 | ||||
| -rw-r--r-- | plugins/check_disk.c | 43 | ||||
| -rw-r--r-- | plugins/check_dns.c | 2 | ||||
| -rw-r--r-- | plugins/check_ldap.c | 2 | ||||
| -rw-r--r-- | plugins/check_smtp.c | 2 | ||||
| -rw-r--r-- | plugins/check_snmp.c | 3 | ||||
| -rw-r--r-- | plugins/check_ups.c | 12 | ||||
| -rw-r--r-- | plugins/t/check_http.t | 2 | ||||
| -rw-r--r-- | plugins/t/check_snmp.t | 4 |
21 files changed, 315 insertions, 108 deletions
diff --git a/.travis.yml b/.travis.yml index 6af1feef..29290fd1 100644 --- a/.travis.yml +++ b/.travis.yml | |||
| @@ -1,11 +1,23 @@ | |||
| 1 | sudo: required | ||
| 2 | dist: trusty | ||
| 1 | language: c | 3 | language: c |
| 2 | 4 | ||
| 3 | before_install: | 5 | before_install: |
| 4 | - sudo add-apt-repository -y ppa:waja/precise-backports | 6 | # Trusty related fixed |
| 7 | # multiverse is no on trusty activated (https://github.com/travis-ci/travis-ci/issues/4979) | ||
| 8 | - sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ trusty multiverse" && sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ trusty-updates multiverse" | ||
| 9 | # /etc/hosts has IPv6 hosts (https://github.com/travis-ci/travis-ci/issues/4978) | ||
| 10 | - sudo [ $(ip addr show | grep "inet6 ::1" | wc -l) -lt "1" ] && sudo sed -i '/^::1/d' /etc/hosts | ||
| 11 | # Trusty has running ntpd on localhost, but we don't like that for our tests | ||
| 12 | - sudo killall -9 ntpd | ||
| 13 | # Trusty has no swap, lets create some | ||
| 14 | - sudo fallocate -l 20M /swapfile; sudo chmod 600 /swapfile; sudo mkswap /swapfile; sudo swapon /swapfile | ||
| 15 | - sudo add-apt-repository -y ppa:waja/trusty-backports | ||
| 5 | - sudo apt-get update -qq | 16 | - sudo apt-get update -qq |
| 6 | - sudo apt-get purge -qq gawk | 17 | - sudo apt-get purge -qq gawk |
| 7 | # ensure we have a test database in place for tests | 18 | # http://docs.travis-ci.com/user/trusty-ci-environment/ indicates, no MySQL on Trusty (yet) |
| 8 | - mysql -e "create database IF NOT EXISTS test;" -uroot | 19 | # # ensure we have a test database in place for tests |
| 20 | # - mysql -e "create database IF NOT EXISTS test;" -uroot | ||
| 9 | 21 | ||
| 10 | install: | 22 | install: |
| 11 | - sudo apt-get install -qq --no-install-recommends perl autotools-dev libdbi-dev libldap2-dev libpq-dev libmysqlclient-dev libfreeradius-client-dev libkrb5-dev libnet-snmp-perl procps | 23 | - sudo apt-get install -qq --no-install-recommends perl autotools-dev libdbi-dev libldap2-dev libpq-dev libmysqlclient-dev libfreeradius-client-dev libkrb5-dev libnet-snmp-perl procps |
| @@ -15,8 +27,14 @@ install: | |||
| 15 | - sudo apt-get install -qq --no-install-recommends slapd ldap-utils | 27 | - sudo apt-get install -qq --no-install-recommends slapd ldap-utils |
| 16 | - sudo apt-get install -qq --no-install-recommends autoconf automake | 28 | - sudo apt-get install -qq --no-install-recommends autoconf automake |
| 17 | - sudo apt-get install -qq --no-install-recommends faketime | 29 | - sudo apt-get install -qq --no-install-recommends faketime |
| 30 | # Trusty related dependencies (not yet provided) | ||
| 31 | - sudo apt-get install -qq --no-install-recommends mariadb-client mariadb-server | ||
| 18 | 32 | ||
| 19 | before_script: | 33 | before_script: |
| 34 | # ensure we have a test database in place for tests | ||
| 35 | - mysql -e "create database IF NOT EXISTS test;" -uroot | ||
| 36 | # Detect LDAP configuration (seems volatile on trusty env) | ||
| 37 | - sed -e 's/cn=admin,dc=nodomain/'$(sudo /usr/sbin/slapcat|grep ^dn:|grep cn=|awk '{print $2}')'/' -i plugins/t/NPTest.cache.travis | ||
| 20 | - tools/setup | 38 | - tools/setup |
| 21 | - ./configure --enable-libtap | 39 | - ./configure --enable-libtap |
| 22 | - make | 40 | - make |
| @@ -6,7 +6,6 @@ This file documents the major additions and syntax changes between releases. | |||
| 6 | thresholds | 6 | thresholds |
| 7 | New check_snmp "-N" option to specify SNMPv3 context name | 7 | New check_snmp "-N" option to specify SNMPv3 context name |
| 8 | New check_nt "-l" parameters: seconds|minutes|hours|days | 8 | New check_nt "-l" parameters: seconds|minutes|hours|days |
| 9 | Make sure check_disk won't hang on hanging (network) file systems | ||
| 10 | New check_mailq -s option which tells the plugin to use sudo(8) | 9 | New check_mailq -s option which tells the plugin to use sudo(8) |
| 11 | New -W/-C option for check_ldap to check number of entries (Gerhard Lausser) | 10 | New -W/-C option for check_ldap to check number of entries (Gerhard Lausser) |
| 12 | The check_http -S/--ssl option now accepts the arguments "1.1" and "1.2" | 11 | The check_http -S/--ssl option now accepts the arguments "1.1" and "1.2" |
| @@ -18,6 +17,8 @@ This file documents the major additions and syntax changes between releases. | |||
| 18 | Let check_real terminate lines with CRLF when talking to the server, as | 17 | Let check_real terminate lines with CRLF when talking to the server, as |
| 19 | mandated by 2326 | 18 | mandated by 2326 |
| 20 | Fix check_procs on HP-UX | 19 | Fix check_procs on HP-UX |
| 20 | check_smtp's -e/--expect option can now be combined with -S/--starttls | ||
| 21 | Fix incorrect performance data thresholds emitted by check_ups | ||
| 21 | 22 | ||
| 22 | WARNINGS | 23 | WARNINGS |
| 23 | The format of the performance data emitted by check_mrtgtraf has been | 24 | The format of the performance data emitted by check_mrtgtraf has been |
| @@ -28,6 +29,12 @@ This file documents the major additions and syntax changes between releases. | |||
| 28 | The superseded check_ntp.pl was removed, please use check_ntp_peer or | 29 | The superseded check_ntp.pl was removed, please use check_ntp_peer or |
| 29 | check_ntp_time instead | 30 | check_ntp_time instead |
| 30 | 31 | ||
| 32 | 2.1.2 16th October 2015 | ||
| 33 | FIXES | ||
| 34 | Fix incorrect performance data thresholds emitted by check_ups | ||
| 35 | Fix check_dhcp's option parsing to not crash with certain arguments | ||
| 36 | Fix check_snmp using correct timeout | ||
| 37 | |||
| 31 | 2.1.1 2nd December 2014 | 38 | 2.1.1 2nd December 2014 |
| 32 | FIXES | 39 | FIXES |
| 33 | Fix check_ntp's jitter checking | 40 | Fix check_ntp's jitter checking |
| @@ -35,6 +42,7 @@ This file documents the major additions and syntax changes between releases. | |||
| 35 | Fix check_apt's handling of invalid regular expressions | 42 | Fix check_apt's handling of invalid regular expressions |
| 36 | Fix check_real's server response processing | 43 | Fix check_real's server response processing |
| 37 | Fix backslash escaping in check_tcp's --help output | 44 | Fix backslash escaping in check_tcp's --help output |
| 45 | Fix check_procs's unclosed filehandle in pst3 on Solaris | ||
| 38 | 46 | ||
| 39 | 2.1 15th October 2014 | 47 | 2.1 15th October 2014 |
| 40 | ENHANCEMENTS | 48 | ENHANCEMENTS |
diff --git a/NP-VERSION-GEN b/NP-VERSION-GEN index 12efad72..dd82bf11 100755 --- a/NP-VERSION-GEN +++ b/NP-VERSION-GEN | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | SRC_ROOT=`dirname $0` | 6 | SRC_ROOT=`dirname $0` |
| 7 | 7 | ||
| 8 | NPVF=NP-VERSION-FILE | 8 | NPVF=NP-VERSION-FILE |
| 9 | DEF_VER=2.1.1.git | 9 | DEF_VER=2.1.2.git |
| 10 | 10 | ||
| 11 | LF=' | 11 | LF=' |
| 12 | ' | 12 | ' |
diff --git a/configure.ac b/configure.ac index ce1728e3..0a554af6 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | dnl Process this file with autoconf to produce a configure script. | 1 | dnl Process this file with autoconf to produce a configure script. |
| 2 | AC_PREREQ(2.59) | 2 | AC_PREREQ(2.59) |
| 3 | AC_INIT(monitoring-plugins,2.1.1) | 3 | AC_INIT(monitoring-plugins,2.1.2) |
| 4 | AC_CONFIG_SRCDIR(NPTest.pm) | 4 | AC_CONFIG_SRCDIR(NPTest.pm) |
| 5 | AC_CONFIG_FILES([gl/Makefile]) | 5 | AC_CONFIG_FILES([gl/Makefile]) |
| 6 | AC_CONFIG_AUX_DIR(build-aux) | 6 | AC_CONFIG_AUX_DIR(build-aux) |
| @@ -156,12 +156,6 @@ AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket") | |||
| 156 | AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv") | 156 | AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv") |
| 157 | AC_SUBST(SOCKETLIBS) | 157 | AC_SUBST(SOCKETLIBS) |
| 158 | 158 | ||
| 159 | dnl Check for POSIX thread libraries | ||
| 160 | AC_CHECK_HEADERS(pthread.h) | ||
| 161 | AC_CHECK_LIB(pthread,pthread_create,THREADLIBS="-lpthread", | ||
| 162 | AC_CHECK_LIB(pthread,pthread_create,THREADLIBS="-lpthread -lrt",-lrt)) | ||
| 163 | AC_SUBST(THREADLIBS) | ||
| 164 | |||
| 165 | dnl | 159 | dnl |
| 166 | dnl check for math-related functions needing -lm | 160 | dnl check for math-related functions needing -lm |
| 167 | AC_CHECK_HEADERS(math.h) | 161 | AC_CHECK_HEADERS(math.h) |
diff --git a/doc/developer-guidelines.sgml b/doc/developer-guidelines.sgml index 228d3fa1..6f31f365 100644 --- a/doc/developer-guidelines.sgml +++ b/doc/developer-guidelines.sgml | |||
| @@ -200,9 +200,8 @@ | |||
| 200 | operation. Higher-level errors (such as name resolution errors, | 200 | operation. Higher-level errors (such as name resolution errors, |
| 201 | socket timeouts, etc) are outside of the control of plugins and should | 201 | socket timeouts, etc) are outside of the control of plugins and should |
| 202 | generally NOT be reported as UNKNOWN states. | 202 | generally NOT be reported as UNKNOWN states. |
| 203 | </para> | 203 | </para><para>The --help or --version output should also result in Unknown state. |
| 204 | <para>The --help or --version output should also result in Unknown state.</para> | 204 | </para></entry> |
| 205 | </entry> | ||
| 206 | </row> | 205 | </row> |
| 207 | </tbody> | 206 | </tbody> |
| 208 | </tgroup> | 207 | </tgroup> |
| @@ -613,7 +612,7 @@ | |||
| 613 | The user should be allowed to specify -v multiple times to increase | 612 | The user should be allowed to specify -v multiple times to increase |
| 614 | the verbosity level, as described in <xref linkend="verboselevels">.</para> | 613 | the verbosity level, as described in <xref linkend="verboselevels">.</para> |
| 615 | 614 | ||
| 616 | The exit code for version information or help should be UNKNOWN | 615 | <para>The exit code for version information or help should be UNKNOWN |
| 617 | (3).</para> | 616 | (3).</para> |
| 618 | </section> | 617 | </section> |
| 619 | 618 | ||
diff --git a/gl/Makefile.am b/gl/Makefile.am index 54abb4c7..15135c8b 100644 --- a/gl/Makefile.am +++ b/gl/Makefile.am | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | # the same distribution terms as the rest of that program. | 21 | # the same distribution terms as the rest of that program. |
| 22 | # | 22 | # |
| 23 | # Generated by gnulib-tool. | 23 | # Generated by gnulib-tool. |
| 24 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files base64 crypto/sha1 dirname environ floorf fsusage getaddrinfo gethostname getloadavg getopt-gnu gettext idpriv-droptemp mountlist regex setenv strcase strsep timegm unsetenv vasprintf vsnprintf | 24 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files base64 crypto/sha1 dirname environ floorf fsusage getaddrinfo gethostname getloadavg getopt-gnu gettext idpriv-droptemp mountlist regex setenv strcase strcasestr strsep timegm unsetenv vasprintf vsnprintf |
| 25 | 25 | ||
| 26 | AUTOMAKE_OPTIONS = 1.9.6 gnits subdir-objects | 26 | AUTOMAKE_OPTIONS = 1.9.6 gnits subdir-objects |
| 27 | 27 | ||
| @@ -1553,6 +1553,15 @@ EXTRA_libgnu_a_SOURCES += strcasecmp.c strncasecmp.c | |||
| 1553 | 1553 | ||
| 1554 | ## end gnulib module strcase | 1554 | ## end gnulib module strcase |
| 1555 | 1555 | ||
| 1556 | ## begin gnulib module strcasestr-simple | ||
| 1557 | |||
| 1558 | |||
| 1559 | EXTRA_DIST += str-two-way.h strcasestr.c | ||
| 1560 | |||
| 1561 | EXTRA_libgnu_a_SOURCES += strcasestr.c | ||
| 1562 | |||
| 1563 | ## end gnulib module strcasestr-simple | ||
| 1564 | |||
| 1556 | ## begin gnulib module streq | 1565 | ## begin gnulib module streq |
| 1557 | 1566 | ||
| 1558 | 1567 | ||
diff --git a/gl/m4/gnulib-cache.m4 b/gl/m4/gnulib-cache.m4 index d6fca2a3..90ad4aaa 100644 --- a/gl/m4/gnulib-cache.m4 +++ b/gl/m4/gnulib-cache.m4 | |||
| @@ -27,7 +27,7 @@ | |||
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | # Specification in the form of a command-line invocation: | 29 | # Specification in the form of a command-line invocation: |
| 30 | # gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files base64 crypto/sha1 dirname environ floorf fsusage getaddrinfo gethostname getloadavg getopt-gnu gettext idpriv-droptemp mountlist regex setenv strcase strsep timegm unsetenv vasprintf vsnprintf | 30 | # gnulib-tool --import --dir=. --lib=libgnu --source-base=gl --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --no-conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files base64 crypto/sha1 dirname environ floorf fsusage getaddrinfo gethostname getloadavg getopt-gnu gettext idpriv-droptemp mountlist regex setenv strcase strcasestr strsep timegm unsetenv vasprintf vsnprintf |
| 31 | 31 | ||
| 32 | # Specification in the form of a few gnulib-tool.m4 macro invocations: | 32 | # Specification in the form of a few gnulib-tool.m4 macro invocations: |
| 33 | gl_LOCAL_DIR([]) | 33 | gl_LOCAL_DIR([]) |
| @@ -48,6 +48,7 @@ gl_MODULES([ | |||
| 48 | regex | 48 | regex |
| 49 | setenv | 49 | setenv |
| 50 | strcase | 50 | strcase |
| 51 | strcasestr | ||
| 51 | strsep | 52 | strsep |
| 52 | timegm | 53 | timegm |
| 53 | unsetenv | 54 | unsetenv |
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index 67a81566..9a4f5027 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 | |||
| @@ -121,6 +121,8 @@ AC_DEFUN([gl_EARLY], | |||
| 121 | # Code from module stdio: | 121 | # Code from module stdio: |
| 122 | # Code from module stdlib: | 122 | # Code from module stdlib: |
| 123 | # Code from module strcase: | 123 | # Code from module strcase: |
| 124 | # Code from module strcasestr: | ||
| 125 | # Code from module strcasestr-simple: | ||
| 124 | # Code from module streq: | 126 | # Code from module streq: |
| 125 | # Code from module strerror: | 127 | # Code from module strerror: |
| 126 | # Code from module strerror-override: | 128 | # Code from module strerror-override: |
| @@ -390,6 +392,17 @@ AC_DEFUN([gl_INIT], | |||
| 390 | AC_LIBOBJ([strncasecmp]) | 392 | AC_LIBOBJ([strncasecmp]) |
| 391 | gl_PREREQ_STRNCASECMP | 393 | gl_PREREQ_STRNCASECMP |
| 392 | fi | 394 | fi |
| 395 | gl_FUNC_STRCASESTR | ||
| 396 | if test $HAVE_STRCASESTR = 0 || test $REPLACE_STRCASESTR = 1; then | ||
| 397 | AC_LIBOBJ([strcasestr]) | ||
| 398 | gl_PREREQ_STRCASESTR | ||
| 399 | fi | ||
| 400 | gl_FUNC_STRCASESTR_SIMPLE | ||
| 401 | if test $HAVE_STRCASESTR = 0 || test $REPLACE_STRCASESTR = 1; then | ||
| 402 | AC_LIBOBJ([strcasestr]) | ||
| 403 | gl_PREREQ_STRCASESTR | ||
| 404 | fi | ||
| 405 | gl_STRING_MODULE_INDICATOR([strcasestr]) | ||
| 393 | gl_FUNC_STRERROR | 406 | gl_FUNC_STRERROR |
| 394 | if test $REPLACE_STRERROR = 1; then | 407 | if test $REPLACE_STRERROR = 1; then |
| 395 | AC_LIBOBJ([strerror]) | 408 | AC_LIBOBJ([strerror]) |
| @@ -723,6 +736,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 723 | lib/stdlib.in.h | 736 | lib/stdlib.in.h |
| 724 | lib/str-two-way.h | 737 | lib/str-two-way.h |
| 725 | lib/strcasecmp.c | 738 | lib/strcasecmp.c |
| 739 | lib/strcasestr.c | ||
| 726 | lib/streq.h | 740 | lib/streq.h |
| 727 | lib/strerror-override.c | 741 | lib/strerror-override.c |
| 728 | lib/strerror-override.h | 742 | lib/strerror-override.h |
| @@ -866,6 +880,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 866 | m4/stdio_h.m4 | 880 | m4/stdio_h.m4 |
| 867 | m4/stdlib_h.m4 | 881 | m4/stdlib_h.m4 |
| 868 | m4/strcase.m4 | 882 | m4/strcase.m4 |
| 883 | m4/strcasestr.m4 | ||
| 869 | m4/strerror.m4 | 884 | m4/strerror.m4 |
| 870 | m4/string_h.m4 | 885 | m4/string_h.m4 |
| 871 | m4/strings_h.m4 | 886 | m4/strings_h.m4 |
diff --git a/gl/m4/strcasestr.m4 b/gl/m4/strcasestr.m4 new file mode 100644 index 00000000..8681a6a4 --- /dev/null +++ b/gl/m4/strcasestr.m4 | |||
| @@ -0,0 +1,142 @@ | |||
| 1 | # strcasestr.m4 serial 21 | ||
| 2 | dnl Copyright (C) 2005, 2007-2013 Free Software Foundation, Inc. | ||
| 3 | dnl This file is free software; the Free Software Foundation | ||
| 4 | dnl gives unlimited permission to copy and/or distribute it, | ||
| 5 | dnl with or without modifications, as long as this notice is preserved. | ||
| 6 | |||
| 7 | dnl Check that strcasestr is present and works. | ||
| 8 | AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE], | ||
| 9 | [ | ||
| 10 | AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) | ||
| 11 | |||
| 12 | dnl Persuade glibc <string.h> to declare strcasestr(). | ||
| 13 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | ||
| 14 | |||
| 15 | AC_REQUIRE([gl_FUNC_MEMCHR]) | ||
| 16 | AC_CHECK_FUNCS([strcasestr]) | ||
| 17 | if test $ac_cv_func_strcasestr = no; then | ||
| 18 | HAVE_STRCASESTR=0 | ||
| 19 | else | ||
| 20 | if test "$gl_cv_func_memchr_works" != yes; then | ||
| 21 | REPLACE_STRCASESTR=1 | ||
| 22 | else | ||
| 23 | dnl Detect http://sourceware.org/bugzilla/show_bug.cgi?id=12092. | ||
| 24 | AC_CACHE_CHECK([whether strcasestr works], | ||
| 25 | [gl_cv_func_strcasestr_works_always], | ||
| 26 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | ||
| 27 | #include <string.h> /* for strcasestr */ | ||
| 28 | #define P "_EF_BF_BD" | ||
| 29 | #define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P | ||
| 30 | #define NEEDLE P P P P P | ||
| 31 | ]], [[return !!strcasestr (HAYSTACK, NEEDLE); | ||
| 32 | ]])], | ||
| 33 | [gl_cv_func_strcasestr_works_always=yes], | ||
| 34 | [gl_cv_func_strcasestr_works_always=no], | ||
| 35 | [dnl glibc 2.12 and cygwin 1.7.7 have a known bug. uClibc is not | ||
| 36 | dnl affected, since it uses different source code for strcasestr | ||
| 37 | dnl than glibc. | ||
| 38 | dnl Assume that it works on all other platforms, even if it is not | ||
| 39 | dnl linear. | ||
| 40 | AC_EGREP_CPP([Lucky user], | ||
| 41 | [ | ||
| 42 | #ifdef __GNU_LIBRARY__ | ||
| 43 | #include <features.h> | ||
| 44 | #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ | ||
| 45 | || defined __UCLIBC__ | ||
| 46 | Lucky user | ||
| 47 | #endif | ||
| 48 | #elif defined __CYGWIN__ | ||
| 49 | #include <cygwin/version.h> | ||
| 50 | #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7) | ||
| 51 | Lucky user | ||
| 52 | #endif | ||
| 53 | #else | ||
| 54 | Lucky user | ||
| 55 | #endif | ||
| 56 | ], | ||
| 57 | [gl_cv_func_strcasestr_works_always="guessing yes"], | ||
| 58 | [gl_cv_func_strcasestr_works_always="guessing no"]) | ||
| 59 | ]) | ||
| 60 | ]) | ||
| 61 | case "$gl_cv_func_strcasestr_works_always" in | ||
| 62 | *yes) ;; | ||
| 63 | *) | ||
| 64 | REPLACE_STRCASESTR=1 | ||
| 65 | ;; | ||
| 66 | esac | ||
| 67 | fi | ||
| 68 | fi | ||
| 69 | ]) # gl_FUNC_STRCASESTR_SIMPLE | ||
| 70 | |||
| 71 | dnl Additionally, check that strcasestr is efficient. | ||
| 72 | AC_DEFUN([gl_FUNC_STRCASESTR], | ||
| 73 | [ | ||
| 74 | AC_REQUIRE([gl_FUNC_STRCASESTR_SIMPLE]) | ||
| 75 | if test $HAVE_STRCASESTR = 1 && test $REPLACE_STRCASESTR = 0; then | ||
| 76 | AC_CACHE_CHECK([whether strcasestr works in linear time], | ||
| 77 | [gl_cv_func_strcasestr_linear], | ||
| 78 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([[ | ||
| 79 | #include <signal.h> /* for signal */ | ||
| 80 | #include <string.h> /* for strcasestr */ | ||
| 81 | #include <stdlib.h> /* for malloc */ | ||
| 82 | #include <unistd.h> /* for alarm */ | ||
| 83 | static void quit (int sig) { exit (sig + 128); } | ||
| 84 | ]], [[ | ||
| 85 | int result = 0; | ||
| 86 | size_t m = 1000000; | ||
| 87 | char *haystack = (char *) malloc (2 * m + 2); | ||
| 88 | char *needle = (char *) malloc (m + 2); | ||
| 89 | /* Failure to compile this test due to missing alarm is okay, | ||
| 90 | since all such platforms (mingw) also lack strcasestr. */ | ||
| 91 | signal (SIGALRM, quit); | ||
| 92 | alarm (5); | ||
| 93 | /* Check for quadratic performance. */ | ||
| 94 | if (haystack && needle) | ||
| 95 | { | ||
| 96 | memset (haystack, 'A', 2 * m); | ||
| 97 | haystack[2 * m] = 'B'; | ||
| 98 | haystack[2 * m + 1] = 0; | ||
| 99 | memset (needle, 'A', m); | ||
| 100 | needle[m] = 'B'; | ||
| 101 | needle[m + 1] = 0; | ||
| 102 | if (!strcasestr (haystack, needle)) | ||
| 103 | result |= 1; | ||
| 104 | } | ||
| 105 | return result; | ||
| 106 | ]])], | ||
| 107 | [gl_cv_func_strcasestr_linear=yes], [gl_cv_func_strcasestr_linear=no], | ||
| 108 | [dnl Only glibc > 2.12 and cygwin > 1.7.7 are known to have a | ||
| 109 | dnl strcasestr that works in linear time. | ||
| 110 | AC_EGREP_CPP([Lucky user], | ||
| 111 | [ | ||
| 112 | #include <features.h> | ||
| 113 | #ifdef __GNU_LIBRARY__ | ||
| 114 | #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \ | ||
| 115 | && !defined __UCLIBC__ | ||
| 116 | Lucky user | ||
| 117 | #endif | ||
| 118 | #endif | ||
| 119 | #ifdef __CYGWIN__ | ||
| 120 | #include <cygwin/version.h> | ||
| 121 | #if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 7) | ||
| 122 | Lucky user | ||
| 123 | #endif | ||
| 124 | #endif | ||
| 125 | ], | ||
| 126 | [gl_cv_func_strcasestr_linear="guessing yes"], | ||
| 127 | [gl_cv_func_strcasestr_linear="guessing no"]) | ||
| 128 | ]) | ||
| 129 | ]) | ||
| 130 | case "$gl_cv_func_strcasestr_linear" in | ||
| 131 | *yes) ;; | ||
| 132 | *) | ||
| 133 | REPLACE_STRCASESTR=1 | ||
| 134 | ;; | ||
| 135 | esac | ||
| 136 | fi | ||
| 137 | ]) # gl_FUNC_STRCASESTR | ||
| 138 | |||
| 139 | # Prerequisites of lib/strcasestr.c. | ||
| 140 | AC_DEFUN([gl_PREREQ_STRCASESTR], [ | ||
| 141 | : | ||
| 142 | ]) | ||
diff --git a/gl/strcasestr.c b/gl/strcasestr.c new file mode 100644 index 00000000..53474a45 --- /dev/null +++ b/gl/strcasestr.c | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | /* Case-insensitive searching in a string. | ||
| 2 | Copyright (C) 2005-2013 Free Software Foundation, Inc. | ||
| 3 | Written by Bruno Haible <bruno@clisp.org>, 2005. | ||
| 4 | |||
| 5 | This program is free software; you can redistribute it and/or modify | ||
| 6 | it under the terms of the GNU General Public License as published by | ||
| 7 | the Free Software Foundation; either version 3, or (at your option) | ||
| 8 | any later version. | ||
| 9 | |||
| 10 | This program is distributed in the hope that it will be useful, | ||
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | GNU General Public License for more details. | ||
| 14 | |||
| 15 | You should have received a copy of the GNU General Public License | ||
| 16 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ | ||
| 17 | |||
| 18 | #include <config.h> | ||
| 19 | |||
| 20 | /* Specification. */ | ||
| 21 | #include <string.h> | ||
| 22 | |||
| 23 | #include <ctype.h> | ||
| 24 | #include <stdbool.h> | ||
| 25 | #include <strings.h> | ||
| 26 | |||
| 27 | #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) | ||
| 28 | |||
| 29 | /* Two-Way algorithm. */ | ||
| 30 | #define RETURN_TYPE char * | ||
| 31 | #define AVAILABLE(h, h_l, j, n_l) \ | ||
| 32 | (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \ | ||
| 33 | && ((h_l) = (j) + (n_l))) | ||
| 34 | #define CANON_ELEMENT(c) TOLOWER (c) | ||
| 35 | #define CMP_FUNC(p1, p2, l) \ | ||
| 36 | strncasecmp ((const char *) (p1), (const char *) (p2), l) | ||
| 37 | #include "str-two-way.h" | ||
| 38 | |||
| 39 | /* Find the first occurrence of NEEDLE in HAYSTACK, using | ||
| 40 | case-insensitive comparison. This function gives unspecified | ||
| 41 | results in multibyte locales. */ | ||
| 42 | char * | ||
| 43 | strcasestr (const char *haystack_start, const char *needle_start) | ||
| 44 | { | ||
| 45 | const char *haystack = haystack_start; | ||
| 46 | const char *needle = needle_start; | ||
| 47 | size_t needle_len; /* Length of NEEDLE. */ | ||
| 48 | size_t haystack_len; /* Known minimum length of HAYSTACK. */ | ||
| 49 | bool ok = true; /* True if NEEDLE is prefix of HAYSTACK. */ | ||
| 50 | |||
| 51 | /* Determine length of NEEDLE, and in the process, make sure | ||
| 52 | HAYSTACK is at least as long (no point processing all of a long | ||
| 53 | NEEDLE if HAYSTACK is too short). */ | ||
| 54 | while (*haystack && *needle) | ||
| 55 | { | ||
| 56 | ok &= (TOLOWER ((unsigned char) *haystack) | ||
| 57 | == TOLOWER ((unsigned char) *needle)); | ||
| 58 | haystack++; | ||
| 59 | needle++; | ||
| 60 | } | ||
| 61 | if (*needle) | ||
| 62 | return NULL; | ||
| 63 | if (ok) | ||
| 64 | return (char *) haystack_start; | ||
| 65 | needle_len = needle - needle_start; | ||
| 66 | haystack = haystack_start + 1; | ||
| 67 | haystack_len = needle_len - 1; | ||
| 68 | |||
| 69 | /* Perform the search. Abstract memory is considered to be an array | ||
| 70 | of 'unsigned char' values, not an array of 'char' values. See | ||
| 71 | ISO C 99 section 6.2.6.1. */ | ||
| 72 | if (needle_len < LONG_NEEDLE_THRESHOLD) | ||
| 73 | return two_way_short_needle ((const unsigned char *) haystack, | ||
| 74 | haystack_len, | ||
| 75 | (const unsigned char *) needle_start, | ||
| 76 | needle_len); | ||
| 77 | return two_way_long_needle ((const unsigned char *) haystack, haystack_len, | ||
| 78 | (const unsigned char *) needle_start, | ||
| 79 | needle_len); | ||
| 80 | } | ||
| 81 | |||
| 82 | #undef LONG_NEEDLE_THRESHOLD | ||
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index 3723e61a..d8afb172 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c | |||
| @@ -229,7 +229,7 @@ struct in_addr requested_address; | |||
| 229 | 229 | ||
| 230 | int process_arguments(int, char **); | 230 | int process_arguments(int, char **); |
| 231 | int call_getopt(int, char **); | 231 | int call_getopt(int, char **); |
| 232 | int validate_arguments(void); | 232 | int validate_arguments(int, int); |
| 233 | void print_usage(void); | 233 | void print_usage(void); |
| 234 | void print_help(void); | 234 | void print_help(void); |
| 235 | 235 | ||
| @@ -1059,29 +1059,19 @@ int get_results(void){ | |||
| 1059 | 1059 | ||
| 1060 | /* process command-line arguments */ | 1060 | /* process command-line arguments */ |
| 1061 | int process_arguments(int argc, char **argv){ | 1061 | int process_arguments(int argc, char **argv){ |
| 1062 | int c; | 1062 | int arg_index; |
| 1063 | 1063 | ||
| 1064 | if(argc<1) | 1064 | if(argc<1) |
| 1065 | return ERROR; | 1065 | return ERROR; |
| 1066 | 1066 | ||
| 1067 | c=0; | 1067 | arg_index = call_getopt(argc,argv); |
| 1068 | while((c+=(call_getopt(argc-c,&argv[c])))<argc){ | 1068 | return validate_arguments(argc,arg_index); |
| 1069 | |||
| 1070 | /* | ||
| 1071 | if(is_option(argv[c])) | ||
| 1072 | continue; | ||
| 1073 | */ | ||
| 1074 | } | ||
| 1075 | |||
| 1076 | return validate_arguments(); | ||
| 1077 | } | 1069 | } |
| 1078 | 1070 | ||
| 1079 | 1071 | ||
| 1080 | 1072 | ||
| 1081 | int call_getopt(int argc, char **argv){ | 1073 | int call_getopt(int argc, char **argv){ |
| 1082 | int c=0; | 1074 | extern int optind; |
| 1083 | int i=0; | ||
| 1084 | |||
| 1085 | int option_index = 0; | 1075 | int option_index = 0; |
| 1086 | static struct option long_options[] = | 1076 | static struct option long_options[] = |
| 1087 | { | 1077 | { |
| @@ -1098,25 +1088,14 @@ int call_getopt(int argc, char **argv){ | |||
| 1098 | }; | 1088 | }; |
| 1099 | 1089 | ||
| 1100 | while(1){ | 1090 | while(1){ |
| 1101 | c=getopt_long(argc,argv,"+hVvt:s:r:t:i:m:u",long_options,&option_index); | 1091 | int c=0; |
| 1102 | 1092 | ||
| 1103 | i++; | 1093 | c=getopt_long(argc,argv,"+hVvt:s:r:t:i:m:u",long_options,&option_index); |
| 1104 | 1094 | ||
| 1105 | if(c==-1||c==EOF||c==1) | 1095 | if(c==-1||c==EOF||c==1) |
| 1106 | break; | 1096 | break; |
| 1107 | 1097 | ||
| 1108 | switch(c){ | 1098 | switch(c){ |
| 1109 | case 'w': | ||
| 1110 | case 'r': | ||
| 1111 | case 't': | ||
| 1112 | case 'i': | ||
| 1113 | i++; | ||
| 1114 | break; | ||
| 1115 | default: | ||
| 1116 | break; | ||
| 1117 | } | ||
| 1118 | |||
| 1119 | switch(c){ | ||
| 1120 | 1099 | ||
| 1121 | case 's': /* DHCP server address */ | 1100 | case 's': /* DHCP server address */ |
| 1122 | resolve_host(optarg,&dhcp_ip); | 1101 | resolve_host(optarg,&dhcp_ip); |
| @@ -1181,12 +1160,14 @@ int call_getopt(int argc, char **argv){ | |||
| 1181 | break; | 1160 | break; |
| 1182 | } | 1161 | } |
| 1183 | } | 1162 | } |
| 1184 | 1163 | return optind; | |
| 1185 | return i; | ||
| 1186 | } | 1164 | } |
| 1187 | 1165 | ||
| 1188 | 1166 | ||
| 1189 | int validate_arguments(void){ | 1167 | int validate_arguments(int argc, int arg_index){ |
| 1168 | |||
| 1169 | if(argc-optind > 0) | ||
| 1170 | usage(_("Got unexpected non-option argument")); | ||
| 1190 | 1171 | ||
| 1191 | return OK; | 1172 | return OK; |
| 1192 | } | 1173 | } |
diff --git a/plugins-root/pst3.c b/plugins-root/pst3.c index ee9d108d..c3589f0a 100644 --- a/plugins-root/pst3.c +++ b/plugins-root/pst3.c | |||
| @@ -139,8 +139,10 @@ try_again: | |||
| 139 | if((ps_fd = open(ps_name, O_RDONLY)) == -1) | 139 | if((ps_fd = open(ps_name, O_RDONLY)) == -1) |
| 140 | continue; | 140 | continue; |
| 141 | 141 | ||
| 142 | if((as_fd = open(as_name, O_RDONLY)) == -1) | 142 | if((as_fd = open(as_name, O_RDONLY)) == -1) { |
| 143 | close(ps_fd); | ||
| 143 | continue; | 144 | continue; |
| 145 | } | ||
| 144 | 146 | ||
| 145 | if(read(ps_fd, &psinfo, sizeof(psinfo)) != sizeof(psinfo)) { | 147 | if(read(ps_fd, &psinfo, sizeof(psinfo)) != sizeof(psinfo)) { |
| 146 | int err = errno; | 148 | int err = errno; |
diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 41906c53..0ddf9bd1 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am | |||
| @@ -71,7 +71,7 @@ check_apt_LDADD = $(BASEOBJS) | |||
| 71 | check_cluster_LDADD = $(BASEOBJS) | 71 | check_cluster_LDADD = $(BASEOBJS) |
| 72 | check_dbi_LDADD = $(NETLIBS) $(DBILIBS) | 72 | check_dbi_LDADD = $(NETLIBS) $(DBILIBS) |
| 73 | check_dig_LDADD = $(NETLIBS) | 73 | check_dig_LDADD = $(NETLIBS) |
| 74 | check_disk_LDADD = $(BASEOBJS) $(THREADLIBS) | 74 | check_disk_LDADD = $(BASEOBJS) |
| 75 | check_dns_LDADD = $(NETLIBS) | 75 | check_dns_LDADD = $(NETLIBS) |
| 76 | check_dummy_LDADD = $(BASEOBJS) | 76 | check_dummy_LDADD = $(BASEOBJS) |
| 77 | check_fping_LDADD = $(NETLIBS) | 77 | check_fping_LDADD = $(NETLIBS) |
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 9693bad3..874a0ee0 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
| @@ -51,9 +51,6 @@ const char *email = "devel@monitoring-plugins.org"; | |||
| 51 | # include <limits.h> | 51 | # include <limits.h> |
| 52 | #endif | 52 | #endif |
| 53 | #include "regex.h" | 53 | #include "regex.h" |
| 54 | #if HAVE_PTHREAD_H | ||
| 55 | # include <pthread.h> | ||
| 56 | #endif | ||
| 57 | 54 | ||
| 58 | #ifdef __CYGWIN__ | 55 | #ifdef __CYGWIN__ |
| 59 | # include <windows.h> | 56 | # include <windows.h> |
| @@ -133,7 +130,6 @@ void print_help (void); | |||
| 133 | void print_usage (void); | 130 | void print_usage (void); |
| 134 | double calculate_percent(uintmax_t, uintmax_t); | 131 | double calculate_percent(uintmax_t, uintmax_t); |
| 135 | void stat_path (struct parameter_list *p); | 132 | void stat_path (struct parameter_list *p); |
| 136 | void *do_stat_path (void *p); | ||
| 137 | void get_stats (struct parameter_list *p, struct fs_usage *fsp); | 133 | void get_stats (struct parameter_list *p, struct fs_usage *fsp); |
| 138 | void get_path_stats (struct parameter_list *p, struct fs_usage *fsp); | 134 | void get_path_stats (struct parameter_list *p, struct fs_usage *fsp); |
| 139 | 135 | ||
| @@ -972,44 +968,6 @@ print_usage (void) | |||
| 972 | void | 968 | void |
| 973 | stat_path (struct parameter_list *p) | 969 | stat_path (struct parameter_list *p) |
| 974 | { | 970 | { |
| 975 | #ifdef HAVE_PTHREAD_H | ||
| 976 | pthread_t stat_thread; | ||
| 977 | int statdone = 0; | ||
| 978 | int timer = timeout_interval; | ||
| 979 | struct timespec req, rem; | ||
| 980 | |||
| 981 | req.tv_sec = 0; | ||
| 982 | pthread_create(&stat_thread, NULL, do_stat_path, p); | ||
| 983 | while (timer-- > 0) { | ||
| 984 | req.tv_nsec = 10000000; | ||
| 985 | nanosleep(&req, &rem); | ||
| 986 | if (pthread_kill(stat_thread, 0)) { | ||
| 987 | statdone = 1; | ||
| 988 | break; | ||
| 989 | } else { | ||
| 990 | req.tv_nsec = 990000000; | ||
| 991 | nanosleep(&req, &rem); | ||
| 992 | } | ||
| 993 | } | ||
| 994 | if (statdone == 1) { | ||
| 995 | pthread_join(stat_thread, NULL); | ||
| 996 | } else { | ||
| 997 | pthread_detach(stat_thread); | ||
| 998 | if (verbose >= 3) | ||
| 999 | printf("stat did not return within %ds on %s\n", timeout_interval, p->name); | ||
| 1000 | printf("DISK %s - ", _("CRITICAL")); | ||
| 1001 | die (STATE_CRITICAL, _("%s %s: %s\n"), p->name, _("hangs"), _("Timeout")); | ||
| 1002 | } | ||
| 1003 | #else | ||
| 1004 | do_stat_path(p); | ||
| 1005 | #endif | ||
| 1006 | } | ||
| 1007 | |||
| 1008 | void * | ||
| 1009 | do_stat_path (void *in) | ||
| 1010 | { | ||
| 1011 | struct parameter_list *p = in; | ||
| 1012 | |||
| 1013 | /* Stat entry to check that dir exists and is accessible */ | 971 | /* Stat entry to check that dir exists and is accessible */ |
| 1014 | if (verbose >= 3) | 972 | if (verbose >= 3) |
| 1015 | printf("calling stat on %s\n", p->name); | 973 | printf("calling stat on %s\n", p->name); |
| @@ -1019,7 +977,6 @@ do_stat_path (void *in) | |||
| 1019 | printf("DISK %s - ", _("CRITICAL")); | 977 | printf("DISK %s - ", _("CRITICAL")); |
| 1020 | die (STATE_CRITICAL, _("%s %s: %s\n"), p->name, _("is not accessible"), strerror(errno)); | 978 | die (STATE_CRITICAL, _("%s %s: %s\n"), p->name, _("is not accessible"), strerror(errno)); |
| 1021 | } | 979 | } |
| 1022 | return NULL; | ||
| 1023 | } | 980 | } |
| 1024 | 981 | ||
| 1025 | 982 | ||
diff --git a/plugins/check_dns.c b/plugins/check_dns.c index d6bd2c0f..48601f02 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c | |||
| @@ -127,7 +127,7 @@ main (int argc, char **argv) | |||
| 127 | if (verbose) | 127 | if (verbose) |
| 128 | puts(chld_out.line[i]); | 128 | puts(chld_out.line[i]); |
| 129 | 129 | ||
| 130 | if (strstr (chld_out.line[i], ".in-addr.arpa")) { | 130 | if (strcasestr (chld_out.line[i], ".in-addr.arpa")) { |
| 131 | if ((temp_buffer = strstr (chld_out.line[i], "name = "))) | 131 | if ((temp_buffer = strstr (chld_out.line[i], "name = "))) |
| 132 | addresses[n_addresses++] = strdup (temp_buffer + 7); | 132 | addresses[n_addresses++] = strdup (temp_buffer + 7); |
| 133 | else { | 133 | else { |
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c index e70d6a51..66be4b46 100644 --- a/plugins/check_ldap.c +++ b/plugins/check_ldap.c | |||
| @@ -483,7 +483,7 @@ print_help (void) | |||
| 483 | 483 | ||
| 484 | printf (" %s\n", "-W [--warn-entries]"); | 484 | printf (" %s\n", "-W [--warn-entries]"); |
| 485 | printf (" %s\n", _("Number of found entries to result in warning status")); | 485 | printf (" %s\n", _("Number of found entries to result in warning status")); |
| 486 | printf (" %s\n", "-W [--crit-entries]"); | 486 | printf (" %s\n", "-C [--crit-entries]"); |
| 487 | printf (" %s\n", _("Number of found entries to result in critical status")); | 487 | printf (" %s\n", _("Number of found entries to result in critical status")); |
| 488 | 488 | ||
| 489 | printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); | 489 | printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); |
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index 2e9b68b1..1996c6d3 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c | |||
| @@ -231,7 +231,7 @@ main (int argc, char **argv) | |||
| 231 | send(sd, SMTP_STARTTLS, strlen(SMTP_STARTTLS), 0); | 231 | send(sd, SMTP_STARTTLS, strlen(SMTP_STARTTLS), 0); |
| 232 | 232 | ||
| 233 | recvlines(buffer, MAX_INPUT_BUFFER); /* wait for it */ | 233 | recvlines(buffer, MAX_INPUT_BUFFER); /* wait for it */ |
| 234 | if (!strstr (buffer, server_expect)) { | 234 | if (!strstr (buffer, SMTP_EXPECT)) { |
| 235 | printf (_("Server does not support STARTTLS\n")); | 235 | printf (_("Server does not support STARTTLS\n")); |
| 236 | smtp_quit(); | 236 | smtp_quit(); |
| 237 | return STATE_UNKNOWN; | 237 | return STATE_UNKNOWN; |
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 28cc44dd..9839d6e8 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
| @@ -41,7 +41,6 @@ const char *email = "devel@monitoring-plugins.org"; | |||
| 41 | #define DEFAULT_PORT "161" | 41 | #define DEFAULT_PORT "161" |
| 42 | #define DEFAULT_MIBLIST "ALL" | 42 | #define DEFAULT_MIBLIST "ALL" |
| 43 | #define DEFAULT_PROTOCOL "1" | 43 | #define DEFAULT_PROTOCOL "1" |
| 44 | #define DEFAULT_TIMEOUT 1 | ||
| 45 | #define DEFAULT_RETRIES 5 | 44 | #define DEFAULT_RETRIES 5 |
| 46 | #define DEFAULT_AUTH_PROTOCOL "MD5" | 45 | #define DEFAULT_AUTH_PROTOCOL "MD5" |
| 47 | #define DEFAULT_PRIV_PROTOCOL "DES" | 46 | #define DEFAULT_PRIV_PROTOCOL "DES" |
| @@ -227,7 +226,7 @@ main (int argc, char **argv) | |||
| 227 | outbuff = strdup (""); | 226 | outbuff = strdup (""); |
| 228 | delimiter = strdup (" = "); | 227 | delimiter = strdup (" = "); |
| 229 | output_delim = strdup (DEFAULT_OUTPUT_DELIMITER); | 228 | output_delim = strdup (DEFAULT_OUTPUT_DELIMITER); |
| 230 | timeout_interval = DEFAULT_TIMEOUT; | 229 | timeout_interval = DEFAULT_SOCKET_TIMEOUT; |
| 231 | retries = DEFAULT_RETRIES; | 230 | retries = DEFAULT_RETRIES; |
| 232 | 231 | ||
| 233 | np_init( (char *) progname, argc, argv ); | 232 | np_init( (char *) progname, argc, argv ); |
diff --git a/plugins/check_ups.c b/plugins/check_ups.c index dc5a348b..e9e56a51 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c | |||
| @@ -242,8 +242,8 @@ main (int argc, char **argv) | |||
| 242 | } | 242 | } |
| 243 | xasprintf (&data, "%s %s", data, | 243 | xasprintf (&data, "%s %s", data, |
| 244 | perfdata ("battery", (long)ups_battery_percent, "%", | 244 | perfdata ("battery", (long)ups_battery_percent, "%", |
| 245 | check_warn, (long)(1000*warning_value), | 245 | check_warn, (long)(warning_value), |
| 246 | check_crit, (long)(1000*critical_value), | 246 | check_crit, (long)(critical_value), |
| 247 | TRUE, 0, TRUE, 100)); | 247 | TRUE, 0, TRUE, 100)); |
| 248 | } else { | 248 | } else { |
| 249 | xasprintf (&data, "%s %s", data, | 249 | xasprintf (&data, "%s %s", data, |
| @@ -271,8 +271,8 @@ main (int argc, char **argv) | |||
| 271 | } | 271 | } |
| 272 | xasprintf (&data, "%s %s", data, | 272 | xasprintf (&data, "%s %s", data, |
| 273 | perfdata ("load", (long)ups_load_percent, "%", | 273 | perfdata ("load", (long)ups_load_percent, "%", |
| 274 | check_warn, (long)(1000*warning_value), | 274 | check_warn, (long)(warning_value), |
| 275 | check_crit, (long)(1000*critical_value), | 275 | check_crit, (long)(critical_value), |
| 276 | TRUE, 0, TRUE, 100)); | 276 | TRUE, 0, TRUE, 100)); |
| 277 | } else { | 277 | } else { |
| 278 | xasprintf (&data, "%s %s", data, | 278 | xasprintf (&data, "%s %s", data, |
| @@ -308,8 +308,8 @@ main (int argc, char **argv) | |||
| 308 | } | 308 | } |
| 309 | xasprintf (&data, "%s %s", data, | 309 | xasprintf (&data, "%s %s", data, |
| 310 | perfdata ("temp", (long)ups_temperature, tunits, | 310 | perfdata ("temp", (long)ups_temperature, tunits, |
| 311 | check_warn, (long)(1000*warning_value), | 311 | check_warn, (long)(warning_value), |
| 312 | check_crit, (long)(1000*critical_value), | 312 | check_crit, (long)(critical_value), |
| 313 | TRUE, 0, FALSE, 0)); | 313 | TRUE, 0, FALSE, 0)); |
| 314 | } else { | 314 | } else { |
| 315 | xasprintf (&data, "%s %s", data, | 315 | xasprintf (&data, "%s %s", data, |
diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t index c2caec60..2b906e30 100644 --- a/plugins/t/check_http.t +++ b/plugins/t/check_http.t | |||
| @@ -154,7 +154,7 @@ SKIP: { | |||
| 154 | like ( $res->output, '/time_ssl=[\d\.]+/', 'Extended Performance Data SSL Output OK' ); | 154 | like ( $res->output, '/time_ssl=[\d\.]+/', 'Extended Performance Data SSL Output OK' ); |
| 155 | 155 | ||
| 156 | $res = NPTest->testCmd( | 156 | $res = NPTest->testCmd( |
| 157 | "./check_http --ssl www.e-paycobalt.com" | 157 | "./check_http --ssl -H www.e-paycobalt.com" |
| 158 | ); | 158 | ); |
| 159 | cmp_ok( $res->return_code, "==", 0, "Can read https for www.e-paycobalt.com (uses AES certificate)" ); | 159 | cmp_ok( $res->return_code, "==", 0, "Can read https for www.e-paycobalt.com (uses AES certificate)" ); |
| 160 | 160 | ||
diff --git a/plugins/t/check_snmp.t b/plugins/t/check_snmp.t index 2d6c44a7..aefd872a 100644 --- a/plugins/t/check_snmp.t +++ b/plugins/t/check_snmp.t | |||
| @@ -166,8 +166,8 @@ SKIP: { | |||
| 166 | SKIP: { | 166 | SKIP: { |
| 167 | skip "no non responsive host defined", 2 if ( ! $host_nonresponsive ); | 167 | skip "no non responsive host defined", 2 if ( ! $host_nonresponsive ); |
| 168 | $res = NPTest->testCmd( "./check_snmp -H $host_nonresponsive -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:"); | 168 | $res = NPTest->testCmd( "./check_snmp -H $host_nonresponsive -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:"); |
| 169 | cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" ); | 169 | cmp_ok( $res->return_code, '==', 2, "Exit CRITICAL with non responsive host" ); |
| 170 | like($res->output, '/External command error: Timeout: No Response from /', "String matches timeout problem"); | 170 | like($res->output, '/Plugin timed out while executing system call/', "String matches timeout problem"); |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | SKIP: { | 173 | SKIP: { |
