Commit graph

243 commits

Author SHA1 Message Date
Sven Nierlein
9e6361077b check_http: replace www.mozilla.com with monitoring-plugins.org
this makes tests more reliable if we test our own sites instead some 3rd party site.

Signed-off-by: Sven Nierlein <sven@consol.de>
2024-07-23 21:08:57 +02:00
Napsty
3deea4cc63 Adjust check_swap tests 2024-04-12 16:50:15 +02:00
Napsty
60614121d1 Adjust check_swap tests 2024-04-12 16:50:15 +02:00
Napsty
675f208476 Adjust check_swap tests 2024-04-12 16:50:15 +02:00
Lorenz Kästle
d3faf13961
check_disk: Fail on missing arguments for --warning and --critical and fix a test case (#1935)
* check_disk: Fail on missing arguments for --warning and --critical
* Add new test function for percentage expressions and use it in check_disk
* Add error abort in tests if they fail to parse output
* Fix typo in test which probably broke the test since forever :-(
2024-03-27 00:36:41 +01:00
Lorenz Kästle
66f62dd336
check_ssh: patches from op5 (#1738)
* check_ssh: properly parse a delayed version control string

This resolves an issue with SSH servers which do not respond with their
version control string as the first thing in the SSH protocol version
exchange phase after connection establishment.

This patch also makes sure that we disregard a potential comment in the
version exchange string to avoid nonsense mismatches. In the future, we
might want to add the capability to match against a user specified comment.

In addition, the patch largely improves the communication towards the
server, which adds better protocol adherence.

Of course, new test cases are added to support the trigger and guard
against regressions of the bugs solved by this patch.

This fixes op5#7945 (https://bugs.op5.com/view.php?id=7945)

Signed-off-by: Anton Lofgren <alofgren@op5.com>

* check_ssh.t: Fix a few typos

Signed-off-by: Anton Lofgren <alofgren@op5.com>

* check_ssh: Handle non-alpha software versions

This patch fixes a bug where we would reject version control strings
that do not contain letters, because the assumption is made that they
always do. This is not required by the RFC however, and there exist
implementations that do not contain letters.

I've also added a few references to the RFC to make the process of
parsing the control string more apparent.

This fixes op5#8716 (https://bugs.op5.com/view.php?id=8716)

Signed-off-by: Anton Lofgren <alofgren@op5.com>

* check_ssh: Fix a typo in "remote-protocol parameter

remote-protcol -> remote-protocol

Signed-off-by: Anton Lofgren <alofgren@op5.com>

* Remove unused variable

* Formating fixes

* Update translations

* Remove merge conflict artefact from previous merge

* Set fixed include paths

* Improve code style to be slightly more readable

* Update test cases for different netcat behaviour and reduce sleep time

---------

Signed-off-by: Anton Lofgren <alofgren@op5.com>
Co-authored-by: Anton Lofgren <alofgren@op5.com>
2024-03-27 00:35:16 +01:00
Sven Nierlein
117cd8e4b8
check_disk increase alert precision (#1989)
* check_disk increase alert precision

Free disk percentage value was rounded to a full integer meaning it alerted about ~1% percent too early. This is about 10GB on a 1TB disk.
The warning and critical thresholds already support float values, so just the percentage calculation needs to be improved.

old:

    ./check_disk -w 35% -c 20% -p / -f -vvv
    Thresholds(pct) for / warn: 35.000000 crit 20.000000
    calling stat on /
    For /, used_pct=65 free_pct=35 used_units=286451 free_units=156651 total_units=443102 used_inodes_pct=11 free_inodes_pct=89 fsp.fsu_blocksize=4096 mult=1048576
    Freespace_units result=0
    Freespace% result=1
    Usedspace_units result=0
    Usedspace_percent result=0
    Usedinodes_percent result=0
    Freeinodes_percent result=0
    DISK WARNING - free space: WARNING [ / 156651MiB (35% inode=89%)];| /=300365643776B;302006979788;371700898201;0;464626122752

new:

    ./check_disk -w 35% -c 20% -p / -f -vvv
    Thresholds(pct) for / warn: 35.000000 crit 20.000000
    calling stat on /
    For /, used_pct=64.649722 free_pct=35.350278 used_units=286464 free_units=156637 total_units=443102 used_inodes_pct=10.016183 free_inodes_pct=89.983817 fsp.fsu_blocksize=4096 mult=1048576
    Freespace_units result=0
    Freespace% result=0
    Usedspace_units result=0
    Usedspace_percent result=0
    Usedinodes_percent result=0
    Freeinodes_percent result=0
    DISK OK - free space: / 156637MiB (35.4% inode=90%);| /=300379275264B;302006979788;371700898201;0;464626122752

* check_disk: adjust test case to support float precision
2024-02-23 18:24:28 +01:00
Sven Nierlein
579db5a930 check_disk: fix ignore-missing in combination with includes (fixes #1963)
Using --ignore-missing together with regex matching and ignore option lead
to a wrong error message.

    ./check_disk -n -w 10% -c 5% -W 10% -r /dummy -i /dummy2
    DISK UNKNOWN: Paths need to be selected before using -i/-I. Use -A to select all paths explicitly

The use case here is a cluster with fail-over mounts. So it is a valid situation that
the regex match does not find anything in addtition with a ignore which also does not exist.

After this patch:

    ./check_disk -n -w 10% -c 5% -W 10% -r /dummy -i /dummy2
    DISK OK - No disks were found for provided parameters|
2023-11-27 13:04:10 +01:00
RincewindsHat
d9a999de7b Enhance tests to check wheter the option validation works 2023-10-31 01:50:46 +01:00
RincewindsHat
e1e1291b72 Fix some more typos 2023-10-03 22:22:51 +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
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
Jan Wagner
0f3703e641 Fix a lot of typos reported by codespell 2023-04-14 18:35:00 +00: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
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
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
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
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
RincewindsHat
ad45727dbe
Merge pull request #1688 from bazzisoft/master
check_curl.c: bugfix: verify certificates option should not force SSL to be used
2021-11-17 17:57:00 +01:00
RincewindsHat
726a29a3ac Fix some tests 2021-10-26 17:07:09 +02:00
Harald Jenny
e79ada81a6 Update check_load.t
adjust tests for new plugin output
2021-10-25 16:28:15 +02:00
RincewindsHat
280ae58ed8 Remove spaces from tests 2021-09-26 00:34:44 +02:00
Jonny007-MKD
cfc43a3275 Improvements suggested by tobiaswiese 2021-09-02 09:56:39 +02:00
Jonny007-MKD
70f55ca9db check_dns: add --expect-nxdomain 2021-09-02 09:56:39 +02:00
Barak Shohat
63cb7ecfcf check_curl.c: bugfix: verify certificates option should not force SSL to be used 2021-05-24 14:53:58 +03:00
Jacob Hansen
0bbcb60f02
Refactor check_fping
* Set correct amount of tests based on conditionals.
* When running the test as non-root, we would previously check is the
setuid bit is set. This doesn't seem to be needed, so just check if the
binary is executable for the user running the test.
* Use cmp_ok to check if tests succeeds rather than couting.

Signed-off-by: Jacob Hansen <jhansen@op5.com>
2021-05-19 13:36:04 +02:00
Jacob Hansen
ae2fe683e3
check_curl.t: Adjust test to use -f curl
It appears that `-f follow` doesn't work correctly in `check_curl` at
the moment. Test adjusted to use `-f curl` instead.

Issue for the above created: https://github.com/monitoring-plugins/monitoring-plugins/issues/1685

Signed-off-by: Jacob Hansen <jhansen@op5.com>
2021-05-18 15:19:43 +02:00
Aksel Sjögren
5ab03a7095
Fix conditional tests for check_http, check_curl
Set correct number of tests in skip- blocks to avoid the error "Bad
plan.  You planned 50 tests but ran 55" when run with/without
/usr/bin/faketime and NP_INTERNET_ACCESS=yes/no.
2021-04-30 11:13:59 +02:00
Sven Nierlein
fc71e3f930 migrate travis ci to github actions 2021-04-30 09:56:52 +02:00
Sven Nierlein
444a3579b2 fix fping test
in case of dns errors, fping returns an unknown and thats ok.
2021-04-30 09:56:52 +02:00
Sven Nierlein
f6fd14e886
Merge pull request #1669 from bazzisoft/verify-cert
Add an option to check_curl to verify the peer certificate & host using the system CA's
2021-04-07 17:51:38 +02:00
Barak Shohat
6993c21695 Add an option to check_curl to verify the peer certificate & host using the system CA's 2021-04-07 15:38:47 +03:00
Barak Shohat
2482950e26 Updated check_curl.c to display a specific human-readable error message where possible 2021-04-07 12:36:55 +03:00
Sven Nierlein
7d2582deb3 update test parameter according to check_http 2020-05-18 14:08:27 +02:00
Andreas Baumann
2f4d6764d7 Merge branch 'master' into feature_check_curl 2019-04-04 13:09:15 +02:00
Jan Wagner
2dcfbbcad0 travis-ci: Use RSA keys for SSH tests 2019-02-04 14:24:29 +01:00
Sven Nierlein
d7dcca22ae tests: rework test parameters
there were 2 variants of calling getTestParameter:

    - parameter, description, default value
    - parameter, env value, default value, description, scope

While scope was never actually used and having 2 names for the same value led
to having 2 different entries in the cache file for the same configuration.

This commit removes the variants and simplifies tests parameters by only using
the first 3 parameter variant.
2018-12-04 15:20:19 +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
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
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
Sven Nierlein
e9239b556a check_curl: make check_curl use the same tests as check_http 2018-10-22 16:30:31 +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
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