Commit graph

2338 commits

Author SHA1 Message Date
Lorenz Kästle
f1e91405c3
Merge pull request #1958 from RincewindsHat/check_users_fix_segfault
check_users: fix segfault
2023-11-12 02:31:24 +01:00
Louis Sautier
eebb280ca3
check_ups: output ups.realpower if supported 2023-11-10 00:08:49 +01:00
RincewindsHat
a9d77ac545 check_users: Update help to properly show that thresholds are ranges 2023-10-31 01:51:27 +01:00
RincewindsHat
d9a999de7b Enhance tests to check wheter the option validation works 2023-10-31 01:50:46 +01:00
RincewindsHat
cff821257b check_users: Change option for sanity checking arguments to avoid segfault 2023-10-31 01:47:26 +01:00
Lorenz Kästle
77e38ac1c0
Merge pull request #1953 from RincewindsHat/compiler_warnings-sign-compare
Fixes for -Wsign-compare
2023-10-29 11:09:00 +01:00
RincewindsHat
eead88edda check_tcp: Fixes an error with using the wrong type for a variable 2023-10-19 13:47:21 +02:00
RincewindsHat
81f3b41651 Fix fallout of the previous changes 2023-10-19 12:20:27 +02:00
RincewindsHat
07f9c438f3 Fixes for -Wsign-compare 2023-10-19 12:10:55 +02:00
RincewindsHat
7ba8463506 check_ntp: Initialize intermediate results in any case 2023-10-19 11:59:43 +02:00
RincewindsHat
0ab5e10d9b check_curl: Initialize pointer before usage 2023-10-19 11:55:11 +02:00
RincewindsHat
decca6d290 check_smtp: Restore behaviour pre ead5526efa regarding -D and TLS 2023-10-19 11:31:28 +02:00
RincewindsHat
0c92b39083 check_dbi: Fix compiler warning for uninitialized variable 2023-10-19 11:14:23 +02:00
RincewindsHat
efe79595d3 check_ntp: Use C99 booleans 2023-10-19 10:22:40 +02:00
RincewindsHat
93a4bae90d Revert "check_ntp: Use C99 booleans"
This reverts commit ca5af12f94.
2023-10-19 10:18:12 +02:00
RincewindsHat
d820929dd8 check_smtp: little fix for C99 booleans missed earlier 2023-10-19 10:17:28 +02:00
RincewindsHat
531e0f9427 check_ntp_time: Use C99 booleans 2023-10-19 10:04:24 +02:00
RincewindsHat
a3d76fed02 Revert "check_ntp_time: Use C99 booleans"
This reverts commit c849536609.
2023-10-19 09:53:37 +02:00
RincewindsHat
0722dbfb8a check_swap: Use C99 booleans 2023-10-18 20:58:18 +02:00
RincewindsHat
163ad151b9 check_smtp: Use C99 booleans 2023-10-18 20:55:22 +02:00
RincewindsHat
369d98cc36 plugins/utils: Use C99 booleans 2023-10-18 20:51:23 +02:00
RincewindsHat
a51e8f82e7 plugins/netutils: Use C99 booleans 2023-10-18 20:46:16 +02:00
RincewindsHat
c2ceefd783 check_negate: Use C99 booleans 2023-10-18 20:42:25 +02:00
RincewindsHat
fd67d1e344 check_users: Use C99 booleans 2023-10-18 20:40:24 +02:00
RincewindsHat
6d62fea757 plugins/common.h: Remove superflous TRUE/FALSE definitions 2023-10-18 20:38:34 +02:00
RincewindsHat
bbd2bd2fa7 check_ups: Use C99 booleans 2023-10-18 20:37:17 +02:00
RincewindsHat
3aff9c8d13 check_time: Use C99 booleans 2023-10-18 20:33:06 +02:00
RincewindsHat
00d58ad187 check_tcp: Use C99 booleans 2023-10-18 20:29:31 +02:00
RincewindsHat
51db32cc1d check_ssh: Use C99 booleans 2023-10-18 20:24:13 +02:00
RincewindsHat
d4539f8662 check_snmp: Use C99 booleans 2023-10-18 20:22:06 +02:00
RincewindsHat
9ccb98aeb5 check_real: Use C99 booleans 2023-10-18 20:19:35 +02:00
RincewindsHat
555902bf76 check_radius: Use C99 booleans 2023-10-18 20:15:30 +02:00
RincewindsHat
47d3e156c5 check_ping: Use C99 booleans 2023-10-18 17:29:43 +02:00
RincewindsHat
9274b6db8b check_pgsql: Use C99 booleans 2023-10-18 17:26:43 +02:00
RincewindsHat
e3cc83f6ae check_overcr: Use C99 booleans 2023-10-18 17:21:35 +02:00
RincewindsHat
03dfd8f5b6 check_nwstat: Use C99 booleans 2023-10-18 17:18:53 +02:00
RincewindsHat
c849536609 check_ntp_time: Use C99 booleans 2023-10-18 17:15:19 +02:00
RincewindsHat
a7e494192d check_ntp_peer: Use C99 booleans 2023-10-18 17:11:21 +02:00
RincewindsHat
ca5af12f94 check_ntp: Use C99 booleans 2023-10-18 17:01:59 +02:00
RincewindsHat
1ba64fb566 check_nt: Use C99 booleans 2023-10-18 16:54:48 +02:00
RincewindsHat
ee80cc2591 check_dns: Another C99 boolean 2023-10-18 16:54:33 +02:00
RincewindsHat
6fc6e86994 check_mysql_query: Use C99 booleans 2023-10-18 16:48:05 +02:00
RincewindsHat
0b389d636e check_mysql: Use C99 booleans 2023-10-18 16:40:51 +02:00
RincewindsHat
45893377bd check_mrtgtraf: Use C99 booleans 2023-10-18 16:39:13 +02:00
RincewindsHat
790374c3b1 check_mrtg: Use C99 booleans 2023-10-18 16:37:36 +02:00
RincewindsHat
82f391085d check_ldap: Use C99 booleans 2023-10-18 16:35:56 +02:00
RincewindsHat
58123356d5 check_ide_smart: Use C99 booleans 2023-10-18 16:33:39 +02:00
RincewindsHat
7ef12f5510 check_game: Use C99 booleans 2023-10-18 16:30:59 +02:00
RincewindsHat
4a6c5ecc94 check_fping: Use C99 booleans 2023-10-18 16:27:28 +02:00
RincewindsHat
a964f87d14 check_dns: Use C99 booleans 2023-10-18 16:22:45 +02:00
RincewindsHat
b6796d9172 check_disk: Use C99 booleans 2023-10-18 16:16:44 +02:00
RincewindsHat
bafe2c2ceb check_dig: Use C99 booleans 2023-10-18 16:14:01 +02:00
RincewindsHat
2f29f45e10 check_by_ssh: Use C99 booleans 2023-10-18 16:12:41 +02:00
RincewindsHat
6972242126 Fixes for compiler warning -Wparentheses 2023-10-16 00:45:33 +02:00
RincewindsHat
ceb614aad4 fix compiler warnings for unused variables 2023-10-15 19:11:40 +02:00
RincewindsHat
928e1c7496 Whitespace fixes 2023-10-15 15:11:07 +02:00
RincewindsHat
fa3b80ce7d Fix -Wcast-function-type compiler warnings 2023-10-15 15:10:27 +02:00
RincewindsHat
09923e8a0f Fix missing include in plugins/runcmd.c 2023-10-07 23:31:59 +02:00
Lorenz Kästle
be0e475339
Merge pull request #1904 from Al2Klimov/1857
check_disk: interpret -X' arg as pattern, not literal
2023-10-05 10:52:03 +02:00
RincewindsHat
e1e1291b72 Fix some more typos 2023-10-03 22:22:51 +02:00
Lorenz Kästle
819f90b726 check_disk: Change usage for --include-type to indicated regexes are now possible 2023-10-01 00:41:55 +02:00
Lorenz Kästle
6947a8cea9 check_disk: Use regex also to include fs types 2023-09-30 12:54:21 +02:00
Alexander A. Klimov
4bb444f335 check_disk: make -X a regex list 2023-09-28 13:20:24 +02:00
RincewindsHat
513929d796 Remove check for RETSIGTYPE in autoconf stuff
autoupdate tells me, that since C89 I can safely assume RETSIGTYPE
is void.

Therefore to simplify things I removed the corresponding configure.ac
line and replaced all mentions of RETSIGTYPE with void.
2023-09-23 12:31:33 +02:00
RincewindsHat
4295decfbf open_max is a library function now, it should be mp_open_max 2023-09-23 10:33:06 +02:00
RincewindsHat
7fd0e6f36d Rework maxfd/open_max to avoid unused variables 2023-09-22 15:22:57 +02:00
Lorenz Kästle
2ef36843ab Add -C to general usage hints 2023-09-21 12:09:10 +02:00
RincewindsHat
8faf7afad3 check_disk: Add some general usage hints 2023-09-21 12:09:10 +02:00
RincewindsHat
b01aa8c433 check_disk: More spacing to separate examples 2023-09-21 12:09:10 +02:00
RincewindsHat
2f916675b3 check_disk: Mention -A and long options in error message about missing thresholds 2023-09-21 12:09:10 +02:00
RincewindsHat
3e8fdf9b35 check_disk: Fix printf format string 2023-09-21 12:09:10 +02:00
Lorenz Kästle
d5d0b50e89
Merge branch 'master' into compiler_warning_part_3 2023-09-21 09:22:33 +02:00
Lorenz Kästle
220455a11e
Merge pull request #1870 from RincewindsHat/compiler_warning_part_5
Compiler warning part 5
2023-09-19 11:06:39 +02:00
RincewindsHat
0e70e81133 Merge branch 'master' into mysql_detect_mysqldump 2023-09-18 22:59:46 +02:00
RincewindsHat
ce355c80cf Initialize slaveresult to 0 and use strncat instead of bsd strlcat 2023-09-18 22:58:34 +02:00
RincewindsHat
c405dbafcc Add mysql_close to avoid spamming the server logs 2023-09-18 19:18:35 +02:00
RincewindsHat
53ea2304aa check_disk: Remove some dead variables 2023-09-12 00:50:55 +02:00
Lorenz Kästle
ab493d5515
Merge branch 'master' into compiler_warning_part_3 2023-09-07 16:10:33 +02:00
Lorenz Kästle
fe239bf1c4
Merge branch 'master' into compiler_warning_part_5 2023-09-07 16:10:20 +02:00
Lorenz Kästle
128910f79a
Merge branch 'master' into patch-chunk-nobody 2023-09-07 16:08:21 +02:00
RincewindsHat
f5acd14048 check_radius: Change help to emphasize the necessity of a config file 2023-09-05 00:00:09 +02:00
Franz Schwartau
06ebad8399 check_smtp: add tests for --ssl 2023-08-30 15:04:32 +02:00
Franz Schwartau
8fa9370a0c Rename test variables for upcoming new variables with the same name 2023-08-30 15:04:32 +02:00
Lorenz Kästle
aa76eece10
Merge branch 'master' into compiler_warning_part_5 2023-08-30 09:36:53 +02:00
Franz Schwartau
ce96ef868a check_smtp: Let port option always take precedence
Otherwise -s/--ssl would overwrite a port given with -p if it comes
after it, e. g.

check_smtp -H mailhost.example.com -p 4465 --ssl

Found-By: Lorenz Kästle
2023-08-29 09:46:50 +02:00
Franz Schwartau
079c300dcc check_smtp: add new longoption --tls
This is an alias for -s/--ssl.
2023-08-29 09:46:50 +02:00
Franz Schwartau
da81dd3cf2 check_smtp: remove restriction of --proxy with --ssl 2023-08-29 09:46:50 +02:00
Franz Schwartau
e823896d8a check_smtp: set default port to smtps (465) for TLS
The port can still be set with -p.
2023-08-29 09:46:50 +02:00
Franz Schwartau
ead5526efa Add support for SMTP over TLS
This is commonly used on smtps (465) port.

PROXY protocol is not implemented with TLS in check_smtp.c, yet.

Backported from nagios-plugins:
0a8cf08ebb
2023-08-29 09:46:50 +02:00
Lorenz Kästle
55c0e1738e Merge remote-tracking branch 'upstream/master' into fix/repair_test_pipeline 2023-08-28 15:16:30 +02:00
Thorsten Kukuk
801784ae89 check_users: prefer systemd-logind over utmp
Prefer systemd-logind over utmp to get the number of logged in users.
utmp is not reliable for this (e.g. some terminals create utmp entries,
other not) and utmp is not Y2038 safe with glibc on Linux.
2023-08-28 14:55:56 +02:00
Lorenz Kästle
9e32be80d6 Remove dead, commented code 2023-08-28 11:15:59 +02:00
Lorenz Kästle
c6abf11e02 Enhance regex in test to be more tolerant to follow up text 2023-08-28 10:31:21 +02:00
RincewindsHat
94a5eb218d Update test to ignore broken MIBs 2023-08-27 23:13:50 +02:00
RincewindsHat
90cb539595 Implement option to ignore mib file parsing errors 2023-08-27 23:13:17 +02:00
Thoralf Rickert-Wendt
a6802bd5f5
Fix issue #1872 2023-08-08 10:22:53 +02:00
Lorenz Kästle
c47f44d897
Merge branch 'master' into compiler_warning_part_5 2023-07-23 22:19:34 +02:00
Lorenz Kästle
7c3098270c
Merge branch 'master' into check_swap_scanf_expressions 2023-07-23 21:58:13 +02:00
Lorenz Kästle
e4b6e83264
Merge branch 'master' into compiler_warning_part_6 2023-07-11 23:08:31 +02:00
Lorenz Kästle
068c124f36 Detect if fmtstr was set in edge cases 2023-07-11 16:39:29 +02:00
waja
265a7c0ed8
Merge branch 'master' into compiler_warning_part_2 2023-06-28 16:39:27 +02:00
waja
103217831e
Merge branch 'master' into compiler_warning_part_3 2023-06-28 16:39:09 +02:00
waja
4f4dd3a7a3
Merge branch 'master' into compiler_warning_part_5 2023-06-28 16:38:43 +02:00
waja
9ef6660cab
Merge branch 'master' into compiler_warning_part_6 2023-06-28 16:38:22 +02:00
waja
c22c277b3d
Merge branch 'master' into check_swap_scanf_expressions 2023-06-28 16:37:55 +02:00
Arkadiusz Miśkiewicz
252272344e Add support for SNI in check_smtp.
Add support for SSL/TLS hostname extension support (SNI) for check_smtp
plugin.

Backported from nagios-plugins:
9f1628f4b5
2023-06-12 23:18:20 +02:00
Franz Schwartau
d762fb1374 check_smtp: update year in copyright header 2023-06-12 22:09:54 +02:00
Franz Schwartau
6d5e81fcba check_smtp: add missing -r option in usage 2023-06-12 21:49:42 +02:00
Patrick Uiterwijk
ce85affd20 check_smtp: Add option to prefix PROXY header
This enables checks of SMTP servers that expect the haproxy
PROXY protocol:  -o smtpd_upstream_proxy_protocol=haproxy.

Backported from nagios-plugins:
3246efe923
2023-06-12 21:49:42 +02:00
Lorenz
d01740f22e
Merge pull request #1884 from RincewindsHat/check_disk_iec_units
check_disk: Display SI units correctly
2023-06-12 10:59:06 +02:00
Platon Pronko
1086326532 check_mysql: handle ER_ACCESS_DENIED_NO_PASSWORD_ERROR if ignore_auth=1
In some situations MySQL might return ER_ACCESS_DENIED_NO_PASSWORD_ERROR
instead of ER_ACCESS_DENIED_ERROR. Semantically these errors are the same.
2023-05-30 15:35:39 +08:00
RincewindsHat
bf8eb6dcc7 check_disk: Display SI units correctly 2023-05-26 08:45:00 +02:00
Lorenz
1bce93b28a
Merge branch 'master' into check_swap_scanf_expressions 2023-05-22 00:57:31 +02:00
Lorenz
b3e066a82e
Merge pull request #1486 from philipowen/feature/pgsql-extra-info
check_pgsql: Add extra output
2023-05-10 14:04:15 +02:00
Lorenz
b784428cdd
Merge pull request #1875 from RincewindsHat/file_encodings
check_nt: change encoding from latin1 to utf8
2023-05-08 21:15:36 +02:00
Lorenz
869cca59d8
Merge pull request #1866 from RincewindsHat/compiler_warning_part_1
Compiler warning part 1
2023-05-08 20:24:11 +02:00
Lorenz Kästle
d10ee31d89 Typo in check_mysql 2023-04-28 16:51:39 +02:00
Lorenz
fcf68d702e
Update plugins/check_nt.c
Co-authored-by: datamuc <m@rbfh.de>
2023-04-27 00:42:30 +02:00
Lorenz Kästle
a359667f2b Changing remaining sscanf format specifier to unsigned long 2023-04-26 18:19:23 +02:00
Lorenz Kästle
b2659391ab check_nt: change encoding from latin1 to utf8 2023-04-26 10:13:51 +02:00
Lorenz Kästle
b96a8424f0 Avoid unnecessary malloc and use stack instead 2023-04-26 09:15:04 +02:00
RincewindsHat
cb55797937 Refix spelling issues 2023-04-18 00:42:20 +02:00
RincewindsHat
b4e578e2cd Try fixing deprecated functions in libdbi 2023-04-18 00:37:46 +02:00
RincewindsHat
6d341c40ab Fixes for Waddress
* check_snmp: Fix string comparison
2023-04-18 00:35:41 +02:00
RincewindsHat
a00c412e7b Fixes for -Wnonnull-compare 2023-04-18 00:35:09 +02:00
RincewindsHat
8700f49716 Replace deprecated TLS client functions 2023-04-18 00:22:25 +02:00
RincewindsHat
d271819149 Fixes for -Wrestrict 2023-04-18 00:20:39 +02:00
RincewindsHat
907b933a87 Fixes for -Wunused-parameters 2023-04-18 00:20:12 +02:00
RincewindsHat
f7687d47cb Fixes for -Wimplicit-fallthrough 2023-04-18 00:18:07 +02:00
RincewindsHat
6c78f0b5ea Fixes for -Wunused
* lib/utils_base.c
* plugins/check_curl.c
* plugins-root/check_dhcp.c
   Removed a line which theoretically can not do anything, but there was
   comment which indicated something else. Still trying this though.
2023-04-18 00:13:24 +02:00
RincewindsHat
cee364f219 Remove unused variable from check_http 2023-04-18 00:12:58 +02:00
RincewindsHat
1568940b3e Implicit function declarations 2023-04-18 00:12:15 +02:00
Jan Wagner
24e99301b4 Fix a psuedo typo 2023-04-17 08:23:28 +02:00
Jan Wagner
0f3703e641 Fix a lot of typos reported by codespell 2023-04-14 18:35:00 +00:00
donien
cc69e8f76b Fix 'requres' typo 2023-04-13 17:15:16 +02:00
Lorenz
ac3032a0ba
Merge pull request #1850 from sni/fix_check_snmp_multiplier
check_snmp: disable multiplier when unused
2023-03-27 13:13:03 +02:00
Sven Nierlein
6e64973a44 simplify code
if statement is always true at this point, so remove it.
2023-03-27 12:59:53 +02:00
Lorenz
482aa6c7fe
Merge pull request #1855 from monitoring-plugins/curlfreebsdfixes
check_curl: including netinet/in.h (for FreeBSD), fixed an ambigous compare warning
2023-03-27 12:32:22 +02:00
Christian Kujau
3e3e225b3f check_procs: add a test for the newly added -X option.
$ make test
[...]
perl -I .. -I .. ../test.pl
No application (check_curl) found for test harness (check_curl.t)
No application (check_snmp) found for test harness (check_snmp.t)
./t/check_procs.t ...... ok
./tests/check_nt.t ..... ok
./tests/check_procs.t .. ok
All tests successful.
Files=4, Tests=73,  8 wallclock secs ( 0.05 usr  0.02 sys +  0.38 cusr
0.22 csys =  0.67 CPU)
Result: PASS

Signed-off-by: Christian Kujau <lists@nerdbynature.de>
2023-03-21 11:49:08 +01:00
Christian Kujau
9c495e2aef check_procs: Implement --exclude-process to exclude specific processes.
Signed-off-by: Christian Kujau <lists@nerdbynature.de>
2023-03-21 11:49:08 +01:00
Sven Nierlein
bf82700078
Merge branch 'master' into fix_check_snmp_multiplier 2023-03-17 11:37:06 +01:00
Andreas Baumann
cf90f0de7b check_curk: including netinet/in.h (for FreeBSD), fixed an ambigous compare warning 2023-03-16 16:21:46 +01:00
RincewindsHat
8a8ee58e89 check_swap: Remove unnecessary and problematic includes 2023-03-16 15:26:52 +01:00
Sven Nierlein
c874f950e8 check_snmp: disable multiplier when unused
- if no multiplier is set, simply return the given string. Otherwise we would strip off the unit.
 - if used, allocate new space to hold the result which might be larger than the initial input

Signed-off-by: Sven Nierlein <sven@consol.de>
2023-03-15 09:51:18 +01:00
Lorenz
0c54644f6a
Merge pull request #1842 from sthen/patch-1
check_radius: cope with radcli-1.3.1 RC_BUFFER_LEN
2023-03-12 20:34:50 +01:00
Lorenz
73c24a393b
Merge pull request #1847 from monitoring-plugins/curlfix1845
Fix for SSL host list messup when picking from multiple IPs (#1844)
2023-03-12 10:59:39 +01:00
Andreas Baumann
ea53555f2d check_curl: removed a superflous variable 2023-03-11 11:40:00 +01:00
Lorenz
75342b5385
Merge branch 'master' into patch-1 2023-03-11 11:34:47 +01:00
Lorenz
357787868b
Merge pull request #1801 from KriSchu/feature_check_disk_add_ignore_missing_option
check_disk: add ignore-missing option to return OK for missing fs
2023-03-11 10:27:43 +01:00
Andreas Baumann
fc927e98db fixed a wrong compare and a wrong size in strncat 2023-03-08 16:10:45 +01:00
Barak Shohat
2902381c5d check_curl.c: Include all IPs from getaddrinfo() in curl DNS cache 2023-03-08 11:56:43 +02:00
Andreas Baumann
03f86b5d08 check_curl: in SSL host caching mode try to connect and bind and take the first getaddrinfo result which succeeds 2023-03-07 19:51:33 +01:00
Kristian Schuster
3e7da5f970
check_disk: use cleaner code for ignore-missing option
- use datatype bool for new vars ignore_missing and path_ignored instead of int
- directly initialize preamble and ignored_preamble with their strings
2023-03-06 14:03:10 +01:00
Kristian Schuster
e102b8a49e
check_disk: fix ugly output with -e option and adapt tests accordingly 2023-02-20 02:03:01 +01:00
Kristian Schuster
a58293a0c2
check_disk: fix tests by setting correct test number and escaping line end regex 2023-02-20 01:27:23 +01:00
Kristian Schuster
a0d4277721
Merge remote-tracking branch 'origin/master' into feature_check_disk_add_ignore_missing_option 2023-02-19 23:49:18 +01:00
Kristian Schuster
ca3d59cd69
check_disk: add new tests for new ignore-missing feature 2023-02-19 23:00:21 +01:00
Kristian Schuster
ba78c32018
check_disk: still allow check of available disks with ignore-missing param used
Also add reporting of ignored paths. When paths are provided by -p and/ or -r and
one path does not match a mounted disk, checking available disks is still
possible. Paths provided by -p are reported as ignored, when not available. Due
to code structure, this is not possible for -r unfortunately.
2023-02-19 22:49:30 +01:00
Andreas Baumann
ad6b638acb using real boolean in check_curl 2023-02-17 14:03:55 +01:00
Andreas Baumann
8e1bbf5e6e changed #else/#if to #elif in libcurl library checks 2023-02-12 15:09:02 +01:00
Andreas Baumann
6563267c3a fixed double frees when doing old-style redirects 2023-02-12 13:16:25 +01:00
Andreas Baumann
40da85e691 better cleanup of curl structures and buffers 2023-02-12 12:11:38 +01:00
Andreas Baumann
f6978deaa1 added --cookie-jar and doing proper cleanup of libcurl 2023-02-11 19:11:07 +01:00
Andreas Baumann
27b0c69645 fixed regerror is MAX_INPUT_BUFFER writting into too small errbuf 2023-02-11 18:39:24 +01:00
Andreas Baumann
f867d7b440 Merge branch 'master' into curlfixes 2023-02-11 07:20:24 +01:00
Lorenz
c07206f2cc
Merge pull request #1832 from RincewindsHat/gnulib_update_2023
Gnulib update 2023 and attendant fixes
2023-02-10 11:43:20 +01:00
Lorenz
e92046f810
Merge pull request #1839 from monitoring-plugins/gnutlsfix
fallback to SSL_CTX_use_certificate_file for gnutls
2023-02-10 10:31:09 +01:00
Lorenz Kästle
28b5a1cc45 Make preprocessor fallback for gnutls more readable 2023-02-09 00:35:20 +01:00
Stuart Henderson
6bbe0b7b0f
cope with radcli-1.3.1 RC_BUFFER_LEN
radcli 1.3.1 now uses RC_BUFFER_LEN instead of BUFFER_LEN. Add an #ifdef to allow working with either.
2023-02-08 16:35:22 +00:00
Lorenz
5a50b260ee
Merge branch 'master' into gnulib_update_2023 2023-02-06 18:51:40 +01:00
Andreas Baumann
9734c439cb Merge branch 'master' into curlfixes 2023-02-06 17:23:55 +01:00
RincewindsHat
03efbb8e4f check_http: Implement special case test for zero size chunk only 2023-02-06 12:15:46 +01:00
RincewindsHat
6d3e44d2d8 check_http: Handle chunked encoding without actual content correctly 2023-02-06 11:39:44 +01:00
Andreas Baumann
53f07a468d using CURLOPT_REDIR_PROTOCOLS_STR instead of CURLOPT_REDIR_PROTOCOLS for curl >= 7.85.0 2023-02-05 20:34:41 +01:00
Andreas Baumann
6f0ce3804a fallback to SSL_CTX_use_certificate_file for gnutls 2023-02-04 16:19:46 +01:00
phowen
9f15dac8e7 add extra output to pgsql check 2023-02-03 16:37:19 +01:00
RincewindsHat
c4704e163e sslutils.c: Move function after a function it uses to avoid forward declarations 2023-02-02 12:03:44 +01:00
Lorenz Kästle
f79eb4f2ca Link plugins against libcrypto to make hashes available 2023-02-01 00:57:42 +01:00
Lorenz Kästle
05ab60f808 check_disk: Remove weird code (workaround?) which broke with gnulib update 2023-02-01 00:56:44 +01:00
Lorenz Kästle
d3fbcd1220 check_http: Add space for ending NULL byte in array for chunked encoding 2023-01-30 13:33:46 +01:00
Lorenz Kästle
d9528c265b check_http: Fix memory reallocation error in chunk decoding logic
This patch should fix an error with the way memory reallocation was
used, which resulted in "realloc(): invalid next size".
It is not completely clear to me as to what caused this problem, but
apparently one can not depend handing a pointer to "realloc(3)" and
expect that it still works afterwards, but one should/must use the one
returned by the function.

Also this patch replaces a variable which was used to remember the
position in the array by just computing that from the current values.
2023-01-30 12:45:20 +01:00
Lorenz
67b472f9d1
check_disk: Clarify usage possibilites (#1745)
* Clarify usage possibilites of check_disk

* Remove superfluous newlines

Co-authored-by: waja <waja@users.noreply.github.com>
2023-01-20 12:08:15 +01:00
Sven Nierlein
f4930aee28 fix check_snmp regex matches
the multiplier function always tried to extract a number, even if the result
is a string because of using a mib.

before:
```
./check_snmp -H hostname -P2c -c public -o IF-MIB::ifAdminStatus.11466 -vvv -r 0
/usr/bin/snmpget -Le -t 10 -r 5 -m ALL -v 2c [context] [authpriv] 10.0.13.11:161 IF-MIB::ifAdminStatus.11466
IF-MIB::ifAdminStatus.11466 = INTEGER: up(1)
Processing oid 1 (line 1)
  oidname: IF-MIB::ifAdminStatus.11466
  response:  = INTEGER: up(1)
SNMP OK - 0 | IF-MIB::ifAdminStatus.11466=0;;
```

the regexp 0 matches, even if the actual result is "up(1)".

after this patch:
```
./check_snmp -H hostname -P2c -c public -o IF-MIB::ifAdminStatus.11466 -vvv -r 0
/usr/bin/snmpget -Le -t 10 -r 5 -m ALL -v 2c [context] [authpriv] 10.0.13.11:161 IF-MIB::ifAdminStatus.11466
IF-MIB::ifAdminStatus.11466 = INTEGER: up(1)
Processing oid 1 (line 1)
  oidname: IF-MIB::ifAdminStatus.11466
  response:  = INTEGER: up(1)
SNMP CRITICAL - *up(1)* |
```
2023-01-20 08:57:56 +01:00
waja
72147140ed
Fixing spelling errors (#1826) 2023-01-17 15:42:54 +01:00
Lorenz
0899e41f50
Check apt usage (#1793)
* Remove trailing whitespaces

* Use real booleans

* Fix comment

* Put upgrade options in the root sections

Co-authored-by: waja <waja@users.noreply.github.com>
2023-01-08 17:23:53 +01:00
Sven Nierlein
07561a67ab tests: fix chunked encoding test server 2023-01-07 18:34:46 +01:00
Sven Nierlein
c256af44fb check_http/check_curl: add chunked encoding test 2023-01-07 18:34:46 +01:00
RincewindsHat
6ed7a75c3b Reformat a part to increase readability 2023-01-07 18:34:46 +01:00
RincewindsHat
67d1062530 Undo clang formatting 2023-01-07 18:34:46 +01:00
RincewindsHat
029168276f Fix several bug in the implementation of unchunking 2023-01-07 18:34:46 +01:00
RincewindsHat
3e63e61f6a Fix chunked header detection regex 2023-01-07 18:34:46 +01:00
RincewindsHat
1ac8f35301 Fix type of unchunk_content function declaration 2023-01-07 18:34:46 +01:00
RincewindsHat
48d6ef2557 Undo sorting of header file includes, it breaks the build 2023-01-07 18:34:46 +01:00
RincewindsHat
afe92468a5 Implement chunked encoding decoding 2023-01-07 18:34:46 +01:00
RincewindsHat
2c658383d5 Restructure code a bit to put things where they are actually needed 2023-01-07 18:34:46 +01:00
RincewindsHat
d4502f246f Remove legacy comments and add some new ones 2023-01-07 18:34:46 +01:00
RincewindsHat
c0c096d2ef Remove dead code 2023-01-07 18:34:46 +01:00
RincewindsHat
2315f59835 clang format 2023-01-07 18:34:46 +01:00
RincewindsHat
d2a05e0d12 Document process_arguments a little bit better 2023-01-07 18:34:46 +01:00
RincewindsHat
2752f91099 Update copyright 2023-01-07 18:34:46 +01:00
RincewindsHat
698eed58f8 Use real booleans instead of ints 2023-01-07 18:34:46 +01:00
Sven Nierlein
9ba8f5ed66 check_snmp: always apply format when applying multiplier 2022-12-22 12:54:51 +01:00
Robert Bohne
def946bd97 Improve tests for check_snmp & multiply option 2022-12-22 12:54:51 +01:00
Wolfgang Nieder
c35bf8966a add 'multiplier' to modify current value 2022-12-22 12:54:51 +01:00
Sven Nierlein
765b29f09b
check_curl: fix checking large bodys (#1823)
check_curl fails on large pages:

  HTTP CRITICAL - Invalid HTTP response received from host on port 5080: cURL returned 23 - Failure writing output to destination

for example trying to run check_curl on the test from #1822

I guess the idea is to double the buffer size each time it is to small. But the code
exponentially grows the buffer size which works well 2-3 times, but then fails.
2022-12-22 12:51:18 +01:00
Danijel Tasov
763862a61c make check_http faster with larger files
The current implementation becomes exponentially slower with growing
response size.

See also:

https://github.com/nagios-plugins/nagios-plugins/blob/release-2.4.2/plugins/check_http.c#L1199-L1204

Test:

    $ mkdir web
    $ nohup python3 -m http.server -d web 5080 &
    $ perl -E 'say "0123456789" for (1..2_000_000)' >| web/file.txt
    $ ./check_http.orig  -t 200 -v  -I localhost -p 5080 -u /file.txt > test1.txt
    real    0m26.893s
    user    0m12.661s
    sys     0m14.221s
    $ time ./check_http -t 200 -v  -I localhost -p 5080 -u /file.txt > test2.txt
    real    0m0.038s
    user    0m0.011s
    sys     0m0.027s
    $ diff -u test[12].txt
    --- test1.txt   2022-12-21 14:58:28.720260811 +0100
    +++ test2.txt   2022-12-21 14:58:42.640008604 +0100
    @@ -7,7 +7,7 @@
     STATUS: HTTP/1.0 200 OK
     **** HEADER ****
     Server: SimpleHTTP/0.6 Python/3.9.2
    -Date: Wed, 21 Dec 2022 13:58:01 GMT
    +Date: Wed, 21 Dec 2022 13:58:42 GMT
     Content-type: text/plain
     Content-Length: 22000000
     Last-Modified: Wed, 21 Dec 2022 13:57:58 GMT
    @@ -2000013,4 +2000013,4 @@
     0123456789
     0123456789

    -HTTP OK: HTTP/1.0 200 OK - 22000191 bytes in 26.860 second response time |time=26.860182s;;;0.000000;200.000000 size=22000191B;;;0;
    +HTTP OK: HTTP/1.0 200 OK - 22000191 bytes in 0.016 second response time |time=0.016412s;;;0.000000;200.000000 size=22000191B;;;0;
2022-12-22 10:15:59 +01:00
RincewindsHat
0551151a57 Remove trailing whitespaces 2022-12-20 10:19:10 +01:00
RincewindsHat
28553e8d1c Fix unknown escape sequence error output 2022-12-20 10:19:10 +01:00
Aksel Sjögren
a517c62c1b check_http: fix test plan
Fix test plan when run with NP_INTERNET_ACCESS=no, where the correct
number of steps must be skipped.
Caused by a removed test in 65fc706429.

Signed-off-by: Aksel Sjögren <asjogren@itrsgroup.com>
2022-11-29 16:38:33 +01:00
Lorenz
4a5ddd2011
Check curl detect ipv6 (#1809)
* If server_address is an IPv6 address surround it with brackets

* If the message is too short, we should not have an underflow

* Add simple conditional test case available if IPv6 is
2022-11-07 17:48:28 +01:00
Lorenz
edc84e5d66
Remove superflous CRLF in HTTP-Requests in check_http (#1798)
* Remove superflous CRLF in HTTP-Requests in check_http
2022-11-05 13:59:45 +01:00
waja
2d9c6276d0
Removing is_pg_dbname alltogether,using postgres API. (Closes: #1660) (#1803)
The problem is that check_pgsql validates the Database name and has different assumptions
that postgres itself.

I fail to see a reason to validate the database name here. Postgres'es API should
do this - So i would suggest a fix like this by removing is_pg_dbname alltogether.

Co-authored-by: Florian Lohoff <f@zz.de>
2022-11-04 19:16:01 +01:00
Andreas Baumann
eb2dfdd5c2
fixed two PRId64 to PRIu64 in perfdata_uint64 (#1802) 2022-10-27 22:48:18 +02:00
Sven Nierlein
bacacd2cb3
check_disk: adjust test plan 2022-10-26 14:03:22 +02:00
Kristian Schuster
0d562a356f
check_disk: add tests for new option --ignore-missing 2022-10-25 20:49:51 +02:00
Kristian Schuster
8cf31437e9
check_disk: add ignore-missing option to return OK for missing fs
There a situations where UNKNOWN or CRITICAL services are not
wanted when a filesystem is missing, a regex does not match or the
filesystem is inaccessible on a system.
This new option helps to have the service in state OK.
2022-10-24 17:29:53 +02:00
Andreas Baumann
817ac2e5da
using PRId64 and PRIu64 instead of %ld directly (#1800) 2022-10-21 18:31:12 +02:00
Lorenz
b90a5757f7
Display total and scaled load values if check_load scales the values by number of CPUs (#1778)
* Renew copyright

* Display more verbose output, if scaled load values are used

* Actually use scaled value for determining status and print the fitting perfdata depending on input parameters

* Add test cases for scaled mode
2022-09-19 10:23:49 +02:00
Jan Wagner
8087291729 check_http: Fix HD6 definition 2022-09-18 20:42:26 +02:00
John C. Frickson
e2e405596a I had to make a couple of small changes. 2022-09-18 20:42:26 +02:00
Eric Wunderlin
d57d2b0bdd Remove unused code 2022-09-18 20:42:26 +02:00
Eric Wunderlin
8f54442c68 Added ability to correctly check redirects with reference format //test.server.com/folder
Referenced redirect of the format //www.server.com/folder would result
in check_http trying to contact http://hostname:80//www.server.com/folder
instead of http://www.server.com/folder. Referenced redirect of this format
is listed in rfc3986 ( https://tools.ietf.org/html/rfc3986 ). It should
work as expected now.
2022-09-18 20:42:26 +02:00
Lorenz
b89aee5696
Check ntp remove unused variables (#1781)
* Remove unused argument

* Fix typo in comment
2022-09-14 10:54:46 +02:00
Lorenz
ef57962552
Check disk compiler warnings (#1758)
* Use unused variable

* Proper format strings for printf

* Use proper functions for absolute values

* Remove and add comments at some places
2022-09-11 06:29:58 +02:00
Lorenz
a9cdbc8959
Check load compiler warnings (#1759)
* Fix compiler warnings due to implizit conversion and formats

* Make includes more specific and complement them

* Formatting fixes
2022-09-11 06:29:36 +02:00
Lorenz
fbbc9fcbd5
Check swap compiler warnings (#1756)
* Fix compiler warnings

* Fix superfluous whitespaces
2022-09-11 06:29:17 +02:00
Lorenz
3ad5fe9d84
check_swap: Fix unit for total in perfdata (#1779)
* check_swap: Fix unit for total in perfdata

* Remove trailing whitespaces
2022-07-25 10:11:43 +02:00
Sven Nierlein
a01de7b33d
fix parsing swap values (#1780)
tmp_KB changed from float to uint64, so change the sscanf format accordingly.
2022-07-25 10:00:18 +02:00
adrb
9f2a9ca3d7
check_snmp: Segfault if number of processed lines is greater than number of thresholds
Segfault at line 489 if number of processed lines is greater than number (#1589) of thresholds

Co-authored-by: Lorenz <12514511+RincewindsHat@users.noreply.github.com>
2022-07-24 16:44:16 +02:00
Lorenz
65fc706429
Remove check_http and check_curl test which are somehow always failing (#1777)
* Remove failing checks for check_http
* Remove failing checks for check_curl
2022-07-20 13:33:49 +02:00
Archie L. Cobbs
ccf4ed25f9
check_by_ssh: Add "-U" flag (#1123). (#1774)
This causes a 255 exit value from ssh(1), which indicates a connection failure,
to return UNKNOWN instead of CRITICAL; similar to check_nrpe's "-u" flag.
2022-07-14 08:47:54 +02:00
Andreas Baumann
a96bdd7349 check_curl: added option --continue-after-certificate (#1761) 2022-04-10 16:31:53 +02:00
Andreas Baumann
455fdc1072 check_http: added option --continue-after-certificate (#1761) 2022-04-10 16:31:47 +02:00
Lorenz
d485b64ef0
Description for -M was the wrong way around (#1746)
Using -M should show the mountpoint instead of the device the
file system originated from.
Seems like this was not the case for a long time and now
the default is to show the mount point. Using `-M` reverts
to showing the (block) device instead.
The usage Description was adjusted with this commit.
2022-01-30 19:41:36 +01:00
Lorenz
e781e0d101
Fix double percentage sign in usage (#1743) 2022-01-30 12:44:02 +01:00
Tobias Wiese
31bdbfce92 sslutils: use chain from client certificates
sslutils used to load only the first certificate when it was given a
client certificate file.

Added tests for check_http to connect to a http server that expects a
client certificate (simple and with chain).

Signed-off-by: Tobias Wiese <tobias@tobiaswiese.com>
2022-01-30 12:25:56 +01:00
Andreas Baumann
ee2a60fc4e fixed -ffollow for HTTP/2.0 (Fixes #1685): added major_version parsing to PicoHTTPParser 2022-01-29 12:17:37 +01:00
Andreas Baumann
737412f739 check_http and check_curl: added --max-redirs=N option (feature #1684) 2022-01-29 12:15:12 +01:00
datamuc
e2397167c7
add --queryname parameter to check_pgsql (#1741)
This is used in the long output instead of the actual query.
So instead of

    OK - 'select stuff from various, tables where some_stuff is null and other_stuff is not null' returned 42

one can use --queryname=check_greatest_basket and it will print

OK - check_greatest_basket returned 42

That's nicer for alerting purposes, at least in our use case.
2022-01-25 10:57:02 +01:00
RincewindsHat
3bcc64396d Fixes the positioning of the code and some other changes 2022-01-22 22:25:21 +01:00
Jan Wagner
b14e251d0f Implements 'host-alive' mode (Closes. #1027)
To reduce the check-duration, it addes a host-alive flag which stops testing
after the first successful reply.
2022-01-22 22:25:21 +01:00
Lorenz
cf669f5ff5
Trivial printf fix and a little bit of code style (#1695)
* Fix several warnings (and some downright bugs probably) with formating in check_disk

Update to master

* Fix merge error, I forgot the last time

* Fix indentation

Co-authored-by: rincewind <rincewind@vulgrim.de>
2022-01-22 22:23:13 +01:00
Mark A. Ziesemer
3b252b9ae6
Trivial source code formatting only: Use tabs consistently for source code indentation (whitespace), as per https://github.com/monitoring-plugins/monitoring-plugins/blob/master/CODING . (#1424)
Looks good, thank you very much.
2022-01-22 15:58:59 +01:00
Lorenz
85c8dcddfa
Merge pull request #1412 from glensc/pld/nagios-plugins-ping.patch
[check_ping] understang ping6 output from iputils package
2022-01-14 16:28:24 +01:00
Lorenz
54a3a5ea62
Merge pull request #1496 from FracKenA/Add-NullOID-Exit
Added option for null zero length string exit codes
2022-01-14 16:04:36 +01:00
Ken D
69fed9d083 Updated int state to human readable 2022-01-14 15:52:00 +01:00
Ken D
a1f3289000 Added option for null zero length string exit codes
When using a large distributed network with the same group of checks used against a large number of devices, occationally there are missing cards in a few devices that are present in other devices. Rather than having a large number of unknown results, disable active checking on those large number of result or having to create a unique check configuration for those devices.

This option allows you to select an OK, WARNING, CRITICAL or UNKNOWN status while still retaining the default behavior when not present. This also allows a for the check to immediately start checks as intended should the hardware be added that the check is looking for.
2022-01-14 15:52:00 +01:00
Lorenz
d999db01c0
Merge pull request #1301 from nafets/exit_on_stderr
check_by_ssh: added option to exit with an warning, if there is output on STDERR
2022-01-14 15:44:05 +01:00
Lorenz Kästle
d496d6523b Rename tmp variable to get even with master 2022-01-03 14:07:54 +01:00
Lorenz
2714df42fd
Merge branch 'master' into master 2022-01-03 13:48:39 +01:00