Commit graph

1892 commits

Author SHA1 Message Date
Tobias Wolf
9966ebcd84 Add new flag --show-body/-B to print body
This should help with figuring out ia problem at a glance when enabled for
healthz endpoints on web APIs, for example.

The content of the body can point to what the problem is and help with
diagnostics.

Fixes #1559
2018-11-09 23:48:56 +01:00
Markus Frosch
198611a3c2 test: Add proxy tests via proxy
On Travis with a local squid
2018-11-06 12:33:24 +01:00
Markus Frosch
d659f8d99f Allow user to specify HTTP method after proxy CONNECT
Simple format, avoids refactoring the CONNECT feature.
2018-11-06 11:32:27 +01:00
Sven Nierlein
36fd675fbe check_curl: code cleanup
CURLOPT_RESOLVE is not required, since we do not verify certificates in any way.
2018-10-29 15:09:57 +01:00
Sven Nierlein
70d36a729e check_curl: rewrite connect_to / host headers
since CURLOPT_CONNECT_TO is only available in later curl versions, we do it the other way round now and
set the url from the address we want to connect to and then set the host header accordingly.
2018-10-25 10:35:06 +02:00
Sven Nierlein
ec590af49f check_curl: code cleanup 2018-10-24 13:36:47 +02:00
Sven Nierlein
87065ac448 check_curl: handle supplied port correctly
if a port was given by -p, it should not be overruled by the port extracted from -H.
2018-10-24 12:13:26 +02:00
Sven Nierlein
7061a76f89 builds: alway put picohttpparser into the dist tarball
substituting PICOHTTPPARSER_DIR only when curl gets build, leads
to different dist tarballs depending on wether libcurl was available
or not. This then breaks later builds from this tarball because of
the missing files.
2018-10-24 09:54:20 +02:00
Sven Nierlein
fd588dd2fa picohttpparser: add header to final tarball 2018-10-23 11:35:14 +02:00
Sven Nierlein
0958ce4b82 check_curl: unify performance data
and align them with check_http
2018-10-22 17:53:31 +02:00
Sven Nierlein
61571ce854 check_curl: use same page length in performance data and text output 2018-10-22 16:49:53 +02:00
Christopher Odenbach
7e9d9a5629 added some advanced tests for check_curl 2018-10-22 16:30:31 +02:00
Christopher Odenbach
347e749a0a Modified virtual host and port behaviour to match check_http. 2018-10-22 16:30:31 +02:00
Andreas Baumann
36ea82ff12 check_curl: changed name of plugin in user-agent and added curl_version() to it 2018-10-22 16:30:31 +02:00
Andreas Baumann
577edf4725 check_curl: removed some dead code 2018-10-22 16:30:31 +02:00
Andreas Baumann
5811729632 check_curl: removed die in redirect with relative paths, simple cases (same protocol, same host) actually work 2018-10-22 16:30:31 +02:00
Andreas Baumann
aa3b63215c ..I should really not test in test code :-) 2018-10-22 16:30:31 +02:00
Andreas Baumann
bd7fe411d5 check_curl: made HTTP message optional 2018-10-22 16:30:31 +02:00
Jean-François Rameau
30bb78e681 Avoid working with free'ed memory 2018-10-22 16:30:31 +02:00
Andreas Baumann
92bab06a45 fixed typo in check_curl error message (unparsable) 2018-10-22 16:30:31 +02:00
Andreas Baumann
d6491ba403 removed embedded uriparser library, added --with-uriparser configure option
to use uriparser library from the system
2018-10-22 16:30:31 +02:00
Andreas Baumann
46c5b54254 bumped coyright to 2018 in check_curl.c 2018-10-22 16:30:31 +02:00
Andreas Baumann
c5cd0e4912 updated bundled version of uriparser to 0.8.5 2018-10-22 16:30:31 +02:00
Andreas Baumann
7dd0a31b28 fixed initialization of server_url (freeing non-pointer in case of redirects) 2018-10-22 16:30:31 +02:00
Sven Nierlein
5368e24616 check_curl: cleanup
- remove obsolete todos
 - change exit code to unknown if regex exectute fails

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2018-10-22 16:30:31 +02:00
Andreas Baumann
8120c53f90 set ssl_version to CURL_SSLVERSION_DEFAULT and not CURL_SSLVERSION_TLSv1_0
(since curl 7.56.1 we get an illegal argument error otherwise)
2018-10-22 16:30:31 +02:00
Andreas Baumann
8a5b49ec36 added -b <proxy_auth> to print_usage 2018-10-22 16:30:31 +02:00
Sven Nierlein
7ad8bcba5b check_curl: add proxy auth option 2018-10-22 16:30:31 +02:00
Sven Nierlein
8172fe7f30 check_curl: update docs 2018-10-22 16:30:31 +02:00
Sven Nierlein
603dd23d11 check_curl: add legacy http request support 2018-10-22 16:30:31 +02:00
Sven Nierlein
e09629ef65 check_curl: add docs about https proxy 2018-10-22 16:30:31 +02:00
Sven Nierlein
7344524655 check_curl: clean whitespace 2018-10-22 16:30:31 +02:00
Sven Nierlein
787e6986ee check_curl: handle proxied https requests 2018-10-22 16:30:31 +02:00
Andreas Baumann
7eb43858db fixed some printf bugs and switched to libcurl4-openssl for Travis tests 2018-10-22 16:30:31 +02:00
Andreas Baumann
2f3eb33b86 fixed include flags for liburiparser 2018-10-22 16:30:31 +02:00
Andreas Baumann
00cb1408ad fixed redirect sticky port handling in redir 2018-10-22 16:30:31 +02:00
Andreas Baumann
a739a56148 some rework:
- added old style 'redir' function and options along to a new
  libcurl internal 'follow' parameter 'curl'
- moved picohttpparser to it's own subdirectory
- added uriparser to be used instead of the home-grown parser in
  'redir'
2018-10-22 16:30:31 +02:00
Andreas Baumann
28a4c7076a synched tests/check_http.t test changes (virtualhost) into tests/check_curl.t 2018-10-22 16:30:31 +02:00
Andreas Baumann
f0cebd5153 fixed failing tests due to wrong content_length calculation 2018-10-22 16:30:31 +02:00
Andreas Baumann
94d017c5ab fixed getopt (-l missing, wrong order, hard to compare with check_http.c) 2018-10-22 16:30:31 +02:00
Andreas Baumann
6bc2646409 more tolerant CERTINFO parsing 2018-10-22 16:30:31 +02:00
Andreas Baumann
4b66d3d90a using CURLOPT_RESOLVE to make sure -I is the IP we connect to 2018-10-22 16:30:31 +02:00
Andreas Baumann
efa7e2c1e7 changed URL construction again, IP should preceed hostname, hostname set as Host: (makes sure we get the corrent DNS entry and server) 2018-10-22 16:30:31 +02:00
Andreas Baumann
5d9104f07f page length is computed from header, fallback to actual body size (get_content_length) 2018-10-22 16:30:31 +02:00
Andreas Baumann
cfb7dace54 fixed setting host_name or server_address in curl URL option 2018-10-22 16:30:31 +02:00
Andreas Baumann
ac08e9b275 reverted hostname in URL, must use CURL_RESOLVE mayabe 2018-10-22 16:30:31 +02:00
Andreas Baumann
7c74b772ed must use host_name and not server_address in URL, CN subject mismatch 2018-10-22 16:30:31 +02:00
Andreas Baumann
f91be546bf disable non-OpenSSL code compilation in -C check if we have USE_OPENSSL set 2018-10-22 16:30:31 +02:00
Andreas Baumann
82744e9705 made non-OpenSSL version of certificate -C check work 2018-10-22 16:30:31 +02:00
Andreas Baumann
229b9e53e1 handling the -C check now when compiled with OpenSSL but libcurl is not compiled with OpenSSL 2018-10-22 16:30:31 +02:00
Andreas Baumann
2da7575196 preparing for certificate checks (non-OpenSSL version) 2018-10-22 16:30:31 +02:00
Andreas Baumann
f4a7a3b3e7 small cleanup 2018-10-22 16:30:31 +02:00
Andreas Baumann
c0be97f154 probing for SSL library used by libcurl and started improving the certificate check -C 2018-10-22 16:30:31 +02:00
Andreas Baumann
995ab6572f using curl_getdate instead of local parse_time_string, added verbose debug code for -M<d> 2018-10-22 16:30:31 +02:00
Andreas Baumann
e65cf6a32f small fixes and cleanups around SSL, be more tolerant to -S<x> options 2018-10-22 16:30:31 +02:00
Andreas Baumann
f99b9352d4 for now we set LIBCURL_USES_OPENSSL always 2018-10-22 16:30:31 +02:00
Andreas Baumann
260291c08b made check_curl compile also if we have openssl disabled 2018-10-22 16:30:31 +02:00
Andreas Baumann
88f566adf5 fixed some libcurl checks and minimal versions 2018-10-22 16:30:31 +02:00
Andreas Baumann
55e8d89b0a some work on certificate checking for non-OpenSSL libraries 2018-10-22 16:30:31 +02:00
Andreas Baumann
cee5f2777d small fix and we see CURLOPT_SSL_CTX_FUNCTION does not work on Centos 6? 2018-10-22 16:30:31 +02:00
Andreas Baumann
304e04a384 some cleanup and added error handling around curl_easy_getinfo/curl_easy_setopt 2018-10-22 16:30:31 +02:00
Andreas Baumann
54c8f76c72 fixed test outputs for status line checks
handling empty data in POST and PUT
handling data upload (from -P <postdata>) also in PUT
2018-10-22 16:30:31 +02:00
Andreas Baumann
3c681a2ec5 added -n and more display_html stuff 2018-10-22 16:30:31 +02:00
Andreas Baumann
f4a49a8b34 added -L option 2018-10-22 16:30:31 +02:00
Andreas Baumann
d5d71dde61 fixed non-C99-ism in get_header_value 2018-10-22 16:30:31 +02:00
Andreas Baumann
9960c56e5e added -M<m> age option for document age, using picohttpparser from h2o (maybe handy
later to make a more robust header condition checker?)
2018-10-22 16:30:31 +02:00
Andreas Baumann
bbec77c7ec made check_curl tests copies of check_http tests because they will differ slightly 2018-10-22 16:30:31 +02:00
Andreas Baumann
f890d271fd added POST support (-P/-T options) 2018-10-22 16:30:31 +02:00
Andreas Baumann
3299fbe3c1 fixed handling of SSL/TLS protocol versions 2018-10-22 16:30:31 +02:00
Andreas Baumann
6575340888 added -l option, fixed some usage/help 2018-10-22 16:30:31 +02:00
Andreas Baumann
f67f05c450 added -d/--header-string option 2018-10-22 16:30:31 +02:00
Sven Nierlein
c6c90a5bfa check_curl: implement -e/--expect 2018-10-22 16:30:31 +02:00
Sven Nierlein
a793540bbb check_curl: support check_http arguments for backwards compatibility 2018-10-22 16:30:31 +02:00
Sven Nierlein
5f9e8fa1e7 check_curl: adopt output format from check_http 2018-10-22 16:30:31 +02:00
Sven Nierlein
e9239b556a check_curl: make check_curl use the same tests as check_http 2018-10-22 16:30:31 +02:00
Andreas Baumann
dee8f760d3 added -4/-6 option 2018-10-22 16:28:51 +02:00
Andreas Baumann
a478dfe512 added -m/--pagesize option 2018-10-22 16:28:51 +02:00
Andreas Baumann
6e52b870f6 added help for --invert-regex 2018-10-22 16:28:51 +02:00
Andreas Baumann
2678d7fabc added -R/-ereg/-eregi 2018-10-22 16:28:51 +02:00
Andreas Baumann
50577bf9b1 added -N/--no-body option 2018-10-22 16:28:51 +02:00
Andreas Baumann
ec8de89a44 added usage and help for -E/--extended-perfdata 2018-10-22 16:28:51 +02:00
Andreas Baumann
4dc982097e reverted double header in longopts 2018-10-22 16:28:51 +02:00
Andreas Baumann
5d2fa85f1e added help/usage and getopt long struct member for -k/--header option 2018-10-22 16:28:51 +02:00
Andreas Baumann
20fd1ade91 fixed a missing else before curl_easy_setopt CURLOPT_CUSTOMREQUEST 2018-10-22 16:28:51 +02:00
Sven Nierlein
afa52eb834 add check_curl test
just a copy of check_http for now...

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2018-10-22 16:28:51 +02:00
Sven Nierlein
e57c8a9d96 check_curl: set correct host header
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2018-10-22 16:28:51 +02:00
Sven Nierlein
b5fd0d1a17 check_curl: implement extended performance data
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2018-10-22 16:28:51 +02:00
Sven Nierlein
16121a9b55 check_curl: implement certificate checks
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2018-10-22 16:28:51 +02:00
Sven Nierlein
c6c4890702 check_curl: implement optional http headers
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2018-10-22 16:28:51 +02:00
Andreas Baumann
d74e9569b9 added HTTP method handling 2018-10-22 16:28:51 +02:00
Andreas Baumann
83ae37dc7e forgot declaration of INVERT_REGEX in getopt otions 2018-10-22 16:28:51 +02:00
Andreas Baumann
c9a94ffd44 added some casts for curl write functions 2018-10-22 16:28:51 +02:00
Andreas Baumann
ad9233ce1c added -r and --invert-regex 2018-10-22 16:28:51 +02:00
Andreas Baumann
556924316a added -ca-file option 2018-10-22 16:28:51 +02:00
Andreas Baumann
035fe1eb79 handling last HTTP header correctly in HTTP line parser (added a strrstr replacement) 2018-10-22 16:28:51 +02:00
Andreas Baumann
cefe325e94 some comment cleanup 2018-10-22 16:28:51 +02:00
Andreas Baumann
2b8f17e577 adapted to style, using header file shims instead of HAVE_XXX by hand 2018-10-22 16:28:51 +02:00
Andreas Baumann
c3bf9bd675 fixed curl error message 2018-10-22 16:28:51 +02:00
Andreas Baumann
67967df159 added -s option 2018-10-22 16:28:51 +02:00
Andreas Baumann
2a9812ee43 added most options from nagios-curl-plugin 2018-10-22 16:28:51 +02:00
Andreas Baumann
0b85260bd2 added autoconf stuff for curl plugin, created empty plugin 2018-10-22 16:28:51 +02:00
Stefan Bethke
22c00bbe47 Docs check_http: make -C obvious
You need to read the docs carefully to realize that check_http has two 
modes of operation: the regular HTTP checks, and a TLS certificate 
check. Only one of these can be run in a single invocation.

Fixes #1553
2018-10-10 00:40:07 +02:00
Rolf Eike Beer
fd9a7d2e00 check_dns: allow forcing complete match of all addresses 2018-07-25 21:14:47 +02:00
Rolf Eike Beer
a03068743f check_dns: allow returned addresses to be in any order 2018-07-25 20:18:47 +02:00
Rolf Eike Beer
e60c6c04f0 check_dns: simplify loop 2018-07-25 19:05:16 +02:00
Sven Nierlein
b7de6ec8bd
Update check_snmp.c
remove unnecessary brackets in help text
2018-01-19 17:05:46 +01:00
Michael Kraus
9fa449119c check_snmp: make calcualtion of timeout value in help output more clear 2018-01-19 15:13:12 +01:00
Bernard Spil
399cc14152
Fix build issue with MariaDB 10.2
As of 10.2 MariaDB no longer defines MYSQL_PORT.
2017-11-06 17:31:44 +01:00
Rasp8e
09a2210c47 Adding Proxy-Authorization and extra headers in the case of connection through PROXY to HTTPS 2017-10-17 15:19:43 +02:00
Marc Sánchez
c03e1ad081 Only turn on ordering procs by CPU usage if PS_USES_PROCPCPU
Disable sorting of procs by CPU usage on check_load if procpcpu is not present on PS_VARLIST
2017-09-07 22:25:09 +02:00
Marc Sánchez
015a40e1b5 Using PS_COMMAND constant and ordering output by procpcpu 2017-09-07 20:55:34 +02:00
Marc Sánchez
0625fbb53d Making show top consuming processes option less complicated 2017-09-07 13:55:19 +02:00
Marc Sánchez
1410ffff28 Adding print top consuming processes option to check_load
-W, --print-top-warning
    Print top consuming processes on WARNING status
 -C, --print-top-critical
    Print top consuming processes on CRITICAL status
 -n, --procs-to-show=NUMBER_OF_PROCS
    Number of processes to show when printing top consuming
    processes. Not useful without -W or -C. Default value is 5
2017-09-07 13:31:01 +02:00
Marc Sánchez
9671399c00 Adding packages-warning option
This option specifies the minumum number of packages available for upgrade to return WARNING status. Default is 1 package.
2017-09-06 16:54:03 +02:00
Michael Kraus
6e67b638f8 Output plugin's stderr to stderr
Output plugin's stderr to stderr and do  not exit with WARNING in that case
2017-09-04 16:36:19 +02:00
Christopher Odenbach
6995b51075 repaired "-n" behaviour. If run with "-n ok" a host which ran
completely out of swap space would return "ok" which is
not desired. It should only return "ok" if there is no
swap space configured at all.
2017-05-31 14:15:47 +02:00
Sven Nierlein
b3d39e605e Merge pull request #1474 from odenbach/vport
Added tests for virtual port behaviour. Separated from all other test…
2017-05-04 23:19:51 +02:00
Karol Babioch
e0b8ebaa77 plugins: check_dig: Fix spelling 2017-04-21 01:38:39 +02:00
Christopher Odenbach
9326543c2e Added tests for virtual port behaviour. Separated from all other tests this time. 2017-03-26 22:36:58 +02:00
Sven Nierlein
77aa6d4ebf udp test: prefer nc over netcat syntax
sles 12 systems have netcat symlinked to nc and so expect nc syntax for netcat.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2017-03-12 22:55:52 +01:00
Sven Nierlein
e90c63712e check_disk test: increase assumed thresholds
The check_disk fails if the build system has more than 100GB of free disk
space. Lets make this 100TB and we are safe for a couple more years.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2017-03-12 22:55:52 +01:00
Sven Nierlein
0cff5f2d93 remove hardcoded verisign.com tests
and make it configurable

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2017-03-12 22:55:52 +01:00
Sven Nierlein
b3dee5c4bf make snmp tests more reliable
snmp tests fail if the snmp daemon runs systemd, then the process with 1 has arguments. Convert
the test into a regex which works for sysv and systemd.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2017-03-12 22:55:52 +01:00
Sven Nierlein
9daeceaed3 check_dns: fix error detection on sles nslookup
on sles (ex. 11sp1) systems the nslookup output for not found was not parsed correctly
and interpreted as ok when it should be critical:

./check_dns -H nosuchhost.nodomain -t 1 -vvv
/usr/bin/nslookup -sil nosuchhost.nodomain Server:         10.0.2.3
Address:        10.0.2.3#53
Non-authoritative answer:
*** Can't find nosuchhost.nodomain: No answer
DNS OK: 0.011 seconds response time. nosuchhost.nodomain returns |time=0.010892s;;;0.000000

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2017-03-12 21:02:58 +01:00
Gerhard Lausser
c85281d25b check_snmp: put the "c" (to mark a counter) after the perfdata value 2017-02-07 14:15:47 +01:00
Valentin Vidic
43ce70bcdb check_apt: Add -l/--list option to print packages 2017-01-16 17:54:00 +01:00
Jan Wagner
10fa79a97a Merge branch 'spell_fix' 2017-01-10 20:33:16 +01:00
Jan Wagner
3fc149f499 Merge remote-tracking branch 'upstream/pr/1457' 2017-01-04 14:53:16 +01:00
Christian Schmidt
bf18dc42dd Add --only-critical switch to check_apt 2016-12-31 12:00:46 +01:00
Nicolai
6a0f4fe275 check_dns: Small test cleanup 2016-12-23 22:59:42 +01:00
Nicolai
b9f00386a1 check_dns: Fix travis tests
(or try to fix it...)
2016-12-23 21:04:36 +01:00
Nicolai
ea756ac4ad check_dns: Tests and info 2016-12-23 20:44:45 +01:00
Nicolai Søborg
22e78763ea check_dns: Accept CIDR 2016-12-21 17:24:29 +01:00
Patrick Rauscher
f524b15e57 check_dns: allow for IPv6 RDNS 2016-12-20 21:59:58 +01:00
Jan Wagner
dbb92c347e Spelling fixes suggested by lintian 2016-12-01 12:49:40 +01:00
Holger Weiss
fae05eb178 check_radius: Make compiler happy 2016-11-21 14:49:03 +01:00
Oliver Skibbe
d03a2a82b3 Revert "check_disk - show all disks if state is ok and option error only is used" 2016-11-21 13:26:28 +01:00
Holger Weiss
8b727baec5 sslutils: Address compiler warning
SSLv23_client_method() and friends return a pointer to a const-qualified
SSL_METHOD.
2016-11-21 09:31:08 +01:00
Jan Wagner
6d0c111631 Creating and mounting randisk to make use of check_disk tests 2016-11-20 20:38:41 +01:00
Oliver Skibbe
6438fec788 Merge pull request #1382 from riskersen/smtp_tls_expec
check_smtp: extended support for expect option
2016-11-19 16:38:07 +01:00
Oliver Skibbe
6026ff5c18 Merge pull request #1374 from riskersen/check_http_perfdata_timeo
check_http: added timeout to perfdata as max val

Resolves #1350
2016-11-19 16:36:26 +01:00
Oliver Skibbe
4430b63b0f Merge pull request #1436 from riskersen/check_disk_iss1420
check_disk - show all disks if state is ok and option error only is used
2016-11-19 16:35:50 +01:00
Holger Weiss
303acfc64f Merge remote-tracking branch 'monitoring-plugins/pr/1443'
* monitoring-plugins/pr/1443:
  add openssl 1.1 support
2016-11-18 11:51:12 +01:00
Jan Wagner
1723a3c761 It's useful to use 'useful' instead of 'usefull' 2016-11-18 11:47:20 +01:00
Holger Weiss
487a9d0a8b check_radius: Replace functions removed in radcli
The radcli library no longer offers the rc_get_ipaddr(),
rc_good_ipaddr(), and rc_own_ipaddress() functions.
2016-11-17 17:22:37 +01:00
Holger Weiss
bfc745a79d check_radius: Fix rc_send_server() call for radcli
With radcli, the rc_send_server() function expects an additional
argument.
2016-11-17 00:03:50 +01:00
Holger Weiss
14929f2687 check_radius: Remove unused variable
The radcli library doesn't define the ENV type, and we don't use it
anyway.
2016-11-15 23:36:59 +01:00
Jan Wagner
2c898cf23f This patch adds support for using the readcli lib.
http://radcli.github.io/radcli/

(Closes #1437)
2016-11-15 23:21:40 +01:00
vagrant
fe1c4bb0e5 add openssl 1.1 support
changes:
  - CRYPTO_lock detection replaced in configure.ac. We don't use that
    function anywhere, so just replace it with the suggested one from
    https://wiki.openssl.org/index.php/Library_Initialization#Autoconf
  - OPENSSL_NO_SSL2 is no longer defined while ssl2 is not included.
    Set it ourself using the suggested openssl 1.1 version check from
    https://wiki.openssl.org/index.php/1.1_API_Changes#Backward_compatibility
  - openssl 1.1 sends a sigpipe if the connection is still open when
    calling SSL_shutdown(), so move the close before the shutdown.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2016-11-13 21:14:02 +00:00
Sven Nierlein
2f845e9ebc Merge pull request #1391 from lausser/patch-1
If a web page contains a nul character, check_http reads the complete page but --string does not search beyond this character.
2016-11-11 11:14:37 +01:00
Sven Nierlein
f938327b49 Revert "adopt http test to changed ssl expire date output"
This reverts commit 6cd50bc42c.
2016-11-11 10:52:36 +01:00
Sven Nierlein
3bdf392ae5 tests: make tests reliable for forcing the locale to C
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2016-11-11 10:52:19 +01:00
Sven Nierlein
9e02d0c3e6 check_http: add host header tests
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2016-11-11 10:32:19 +01:00
Sven Nierlein
6cd50bc42c adopt http test to changed ssl expire date output
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2016-11-11 09:43:13 +01:00
Christopher Odenbach
2233b7aa75 patch to support the concept of virtual ports 2016-11-11 09:33:37 +01:00
Sven Nierlein
9c7f34cb57 Merge pull request #1442 from waja/check_dig_use_retry_instead_tries
check_dig: use +retry instead of +tries
2016-11-08 10:30:06 +01:00
Christian Kujau
4195dc23d1 check_dig: use +retry instead of +tries
After upgrading from an Ubuntu/15.10 to 16.04 installation, I noticed that
check_dig is always returning a WARNING:

$ /usr/lib/nagios/plugins/check_dig -l localhost -v
/usr/bin/dig   -p 53 @127.0.0.1 localhost A +tries=3 +time=6
Looking for: 'localhost'
DNS WARNING - 0.008 seconds response time (dig returned an error status)|time=0.008274s;;;0.000000

The older Ubuntu installation got its check_dig from the
nagios-plugins-standard package[0] which did not include the +tries
option. The current Ubuntu version provides its check_dig from the
monitoring-plugins-standard package[1], which _does_ use the +tries
option that was introduced with df53473[2].

On my system, it so happens that /usr/bin/dig is provided not by the
(BIND) dnsutils package but by knot-dnsutils[3] from the Knot DNS project.
The Knot dig(1) command doesn't support the +tries option[4] but does
support +retry (which is also supported[5] by the BIND dig(1) command).

One way to fix that would be for me to install the BIND dnsutils package. But I did not
want to do that: it's so much larger in size and pulls in much more dependencies
than the knot-dnsutils package.

The patch below changes check_dig to use +retry instead of +tries. Both
options are similar, but not the same:

 +retry - Sets the number of times to retry UDP queries to server to T
          instead of the default, 2. Unlike +tries, this does not include
          the initial query

As number_tries seems to be hard coded to 3, I've lowered DEFAULT_TRIES to
2 so check_dig should behave as before (with +tries=3).

Thanks,
Christian.

[0] http://packages.ubuntu.com/wily/nagios-plugins-standard
[1] http://packages.ubuntu.com/xenial/monitoring-plugins-standard
[2] https://github.com/monitoring-plugins/monitoring-plugins/commit/df53473
[3] http://packages.ubuntu.com/xenial/knot-dnsutils
[4] https://www.knot-dns.cz/docs/2.x/html/man_kdig.html#notes
[5] https://ftp.isc.org/isc/bind9/cur/9.10/doc/arm/man.dig.html

Signed-off-by: Christian Kujau <lists@nerdbynature.de>
2016-11-08 09:54:46 +01:00
Sebastian Herbszt
2742e65798 check_ide_smart: remove unused function
Remove function unused since commit b5cc292.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
2016-11-08 09:52:04 +01:00
Sven Nierlein
85cfc7b1aa tests: enable snmp tests
Enabled snmp tests against snmpd on localhost. It was installed already
in the travis file, we just need to enable the tests by setting the
parameters in the answers file.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2016-11-08 00:50:03 +01:00
Sven Nierlein
b838b75366 check_snmp: fix number of tests skiped 2016-11-08 00:38:55 +01:00
Sven Nierlein
1d4874240a check_snmp: add testcase for no datatype
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2016-11-08 00:29:42 +01:00
Sven Nierlein
d9999194e6 Revert "check_snmp: fix push request 1173 for SNMP responses without datatype indicator"
This reverts commit 3178c8c0ff.
2016-11-08 00:23:28 +01:00
Thomas Kurschel
3178c8c0ff check_snmp: fix push request 1173 for SNMP responses without datatype indicator 2016-11-08 00:11:04 +01:00
Sven Nierlein
0dc6537612 fix superfluous argument to printf (#fixes 1308)
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2016-11-07 23:39:04 +01:00
Sven Nierlein
0bf64b356c Merge pull request #1311 from waja/check_ntp_remove_unused_variables
check_ntp: remove unused variables
2016-11-07 23:08:02 +01:00
Sven Nierlein
19972e99f8 Merge pull request #1309 from waja/negate_remove_unused_variables
negate: remove unused variables
2016-11-07 23:07:34 +01:00
Sven Nierlein
5ebc24d998 Merge pull request #1312 from waja/check_disk_remove_unused_variables
check_disk: remove unused variables
2016-11-07 23:07:16 +01:00
Sven Nierlein
06fdc55195 Merge pull request #1313 from waja/check_ntp_time_remove_unused_variables
check_ntp_time: remove unused variables
2016-11-07 23:06:38 +01:00
Sven Nierlein
28d4812860 Merge pull request #1307 from waja/check_dns_dead_code
check_dns: remove dead code
2016-11-07 23:05:26 +01:00
Sven Nierlein
948db2e3a2 tests: adjust check_http to new output format
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2016-11-07 22:46:06 +01:00
Peter (pir) Radcliffe
2f2b2f1987 GMT expiry display
Change solution to display GMT time in the local display format with
the offset number of hours from GMT to be clear about what timezone
this is if the local display format does not include offset.
2016-11-07 22:42:40 +01:00
Peter (pir) Radcliffe
06059ecd0e Revert "Fix check_http test time output"
This reverts commit 2d9e61a438.
2016-11-07 22:42:40 +01:00
Peter (pir) Radcliffe
2efad48e8c Fix check_http test time output
Tests need to match new output time and timezone.
2016-11-07 22:42:40 +01:00
Peter (pir) Radcliffe
a3a78795b2 Use GMT timezone in SSL certs
SSL certs are required to use times in GMT per
https://www.ietf.org/rfc/rfc5280.txt but the mktime() here assumes the
current timezone.

Fix the time_t conversion to be done assuming GMT with timegm() and
only do it once rather than twice.

Display the expiry date and time with ISO format years and give an
offset from GMT and a timezone to be very clear about exactly what time
is being displayed. Time given is correct and now in the machine’s
timezone.
2016-11-07 22:42:40 +01:00
abrist
7276ce77c7 check_snmp.c - Added IPv6 support
The "-6" optarg now prepends the server_address with "udp6:" for the
snmpget external command as per the net-snmp syntax at:
http://www.net-snmp.org/wiki/index.php/FAQ:Applications_28

Thanks to DrydenK (Roberto Greiner) for the heads up.
2016-11-07 22:13:07 +01:00
Sven Nierlein
aa7ed88c54 check_users: add new test cases
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2016-11-07 21:49:40 +01:00
Sven Nierlein
52cd7d7934 check_users: still allow zero thresholds
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2016-11-07 21:49:03 +01:00
John C. Frickson
a5983eda69 check_users not correctly detecting thresholds
Fix for issue https://github.com/nagios-plugins/nagios-plugins/issues/81

check_users now uses the standard warning and critical ranges parser and
a standard perdata output routine.
2016-11-07 21:36:25 +01:00
Oliver Skibbe
5663b03717 check_disk - show all disks if state is ok and option error only is used
This fix changes output of check_disk in case of --error-only/-e option
is used and state is ok

 - Old output: DISK OK
 - New output: DISK OK - free space: / 159731 MB (83% inode=61%);
   /dev/shm 2926 MB (100% inode=99%); /boot 58 MB (32% inode=99%);

Resolves: #1420
2016-11-04 11:35:12 +01:00
Sven Nierlein
3a12034805 check_by_ssh: print command output in verbose mode
right now it is not possible to print the command output of ssh. check_by_ssh
only prints the command itself. This patchs adds printing the output too. This
makes it possible to use ssh with verbose logging which helps debuging any
connection, key or other ssh problems.
Note: you must use -E,--skip-stderr=<high number>, otherwise check_by_ssh would
always exit with unknown state.

Example:

  ./check_by_ssh -H localhost -o LogLevel=DEBUG3 -C "sleep 1" -E 999 -v

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2016-09-17 07:45:08 +02:00
Holger Weiss
e16dc71d5c Merge branch 'pr/1386'
* pr/1386:
  check_dig: expected answer is now incasesensitive
2016-02-22 23:11:01 +01:00
Holger Weiss
0960239981 Let check_http test use HTTP/1.1 2016-02-22 21:59:58 +01:00
Sven Geggus
d44b8d70a4 DNS is case insensitive!
Thus recent Versions of bind will no longer change .IN-ADDR.ARPA to lowercase
as the uppercase version is also valid.

To have check_dns.c consider this fact change strstr to strcasestr
2016-02-22 17:14:27 +01:00
Gerhard Lausser
8727768834 Update check_http.c
If a web page contains a nul character, check_http reads the complete page but --expect does not search beyond this character.
2015-11-04 16:18:37 +01:00
Gerhard Lausser
b59ac4e615 Typo in check_ldap.c usage 2015-11-02 18:14:09 +01:00
Klaus Ethgen
23436a1851 Fixing the stuff that is broken on btrfs
(Closes #1357)
2015-10-28 00:39:24 +01:00
Daniel Stirnimann
24eea9fa34 check_dig: expected answer is now incasesensitive
check_dig was casesensitive if an expected answer is given.
  Switching strstr with strcasestr fixes this issue

  While testing i noticed a bug where expected is not an exact match
  New issue for that is opened #1385

  This fix closes #1233
2015-10-15 10:59:32 +02:00
Holger Weiss
11c5796d0a Revert "Don't let check_disk hang on hanging file systems"
This reverts commit 6986aa1d0a.  That
commit leads to issues on non-Linux systems, and it seems to not
(always) work as expected on Linux, either.

Conflicts:
	plugins/Makefile.am
	plugins/check_disk.c

Closes #1377 and closes #1329.
2015-10-12 11:07:02 +02:00
Holger Weiss
37928b52a5 Merge branch 'maint'
* maint:
  sslutils: Remove superfluous parenthesis for sslv3 function too
  sslutils: remove superfluous parenthesis
  check_snmp: modified tests
  check_snmp.c: switched DEFAULT_TIMEOUT to DEFAULT_SOCKET_TIMEOUT (provided by utils.h), already used by help description, see issue #1318
  install snmpd on travis tests
  enable libtab on travis builds
  add perl snmp to travis dependencies
  NEWS: Mention check_ups performance data fix
  Fix incorrect performance data thresholds
  check_dhcp: Fix option parsing
  Fixes segfaults when running via monitoring worker (off-by-one)
  travis: fix http test host
  sslutils: Check if OpenSSL supports SSLv3.

Conflicts:
	NEWS
	plugins/sslutils.c
2015-10-08 12:52:10 +02:00
Oliver Skibbe
6b8c0bdf11 check_smtp: extended support for expect option
expect option (-e) supported only first response, so checking for
  any other response like 250-xxx would never match. This fix stores
  return of relevant buffer

  closes #1381
2015-10-08 11:09:25 +02:00
Oliver Skibbe
b6de2341f8 check_smtp.c: modified SSL check for use with -e
- currently STARTTLS check does not work with -e if there's text
    like '220 hostname ESMTP*'. This is caused by SMTP answer from
    host. Postfix answer: 220 2.0.0 Ready to start TLS, Exchange
    2010: 220 2.0.0 SMTP server ready. This fix checks against 220

    closes #1093
2015-10-08 09:04:29 +02:00
Oliver Skibbe
d9d82309e2 * check_http: added timeout to perfdata as max val 2015-10-07 09:14:28 +02:00
Holger Weiss
dfe66c01c0 check_smtp: Let "-D" option imply "-S" 2015-10-06 23:28:24 +02:00
Holger Weiss
b317aaf32a check_smtp: QUIT SMTP connection when "-D" is used
Don't forget to issue an SMTP QUIT command when the -D/--certificate
option is specified.  This avoids undesired MTA log messages.
2015-10-06 23:21:17 +02:00
Holger Weiss
5029714a9d Merge branch 'pr/1373'
* pr/1373:
  check_http: Allow for requesting TLSv1.1/TLSv1.2
2015-10-06 12:57:29 +02:00
Holger Weiss
f43083c6a9 check_http: Allow for requesting TLSv1.1/TLSv1.2
check_http's -S/--ssl option now allows for requesting the TLSv1.1 and
TLSv1.2 protocols.  Apart from that, a '+' suffix can be appended in
oder to also accept newer protocols than the specified version.

Closes #1338, and closes #1354, and closes #1359.
2015-10-04 23:28:35 +02:00
Sven Nierlein
edca257e20 use unknown exit code for help/version in plugins
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2015-10-04 19:24:30 +02:00
Jan Wagner
8e661a3bd6 sslutils: Remove superfluous parenthesis for sslv3 function too 2015-10-04 15:16:15 +02:00
Sebastian Herbszt
0a406d8dce sslutils: remove superfluous parenthesis
Remove superfluous parenthesis.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
2015-10-04 15:09:36 +02:00
Oliver Skibbe
2d677b19ed check_snmp: modified tests
(Closes #1325)
2015-10-04 13:40:04 +02:00