Commit graph

102 commits

Author SHA1 Message Date
RincewindsHat
4549a95243
Merge pull request #1654 from wolfgangkarall/master
check_procs -- exchange needle and haystack in strstr() for proper st…
2021-11-17 18:09:25 +01:00
Sven Nierlein
024d268386 check_snmp: fix performance thresholds when using multiple oids
when using check_snmp with multiple oids it simply printed the unparsed content
from -w/-c into the thresholds for each oid. So each oid contained the hole -w
from all oids.

./check_snmp ... -o iso.3.6.1.2.1.25.1.3.0,iso.3.6.1.2.1.25.1.5.0 -w '1,2' -c '3,4'

before:
  SNMP ... | HOST-RESOURCES-MIB::hrSystemInitialLoadDevice.0=393216;1,2;3,4 HOST-RESOURCES-MIB::hrSystemNumUsers.0=24;1,2;3,4

after:
  SNMP ... | HOST-RESOURCES-MIB::hrSystemInitialLoadDevice.0=393216;1;3 HOST-RESOURCES-MIB::hrSystemNumUsers.0=24;2;4

This also applies to fixed thresholds since check_snmp translates negative infinities from: '~:-1' to '@-1:~'
2021-11-17 14:04:09 +01:00
Sven Nierlein
c3abdb9267 check_procs: add test for elapsed time 2021-11-01 13:35:11 +01:00
Sven Nierlein
1fda28f124 remove unused test file
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2021-11-01 13:35:11 +01:00
Sven Nierlein
282ccd4a8b check_procs: improve ps args autodetection
one of the first ps commands in the configure.ac is `axwo 'stat comm vsz rss user uid pid ppid args'` which
works on most modern linux systems (checked debian 10/11 and centos 7/8). But this test misses the etime
argument. Therefore `check_procs --metric=ELAPSED` does not work.

To fix this, we simply do the same test including etime before that one.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2021-11-01 13:35:11 +01:00
Sven Nierlein
b428cc17f7 tests: ignore sigpipes in https test daemon
check_http closes the connection after checking the certificate with -C. This leads to sigpipe
errors when the ssl daemon wants to send a response and the daemon quits which makes the
subsequent tests fail.
2021-05-20 20:57:59 +02:00
Sven Nierlein
eb75d847ae tests: increase startup sleep
github action might fail from to time otherwise
2021-05-20 18:04:49 +02:00
Sven Nierlein
5cfc93d995 fix check_curl crash if http header contains leading spaces
check_curl crashes when a (broken) http server returns invalid http header with
leading spaces or double colons. This PR adds a fix and a test case for this.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2021-03-11 13:33:16 +01:00
Wolfgang Karall-Ahlborn
9076ea36f7 check_procs -- update test data too 2021-01-03 12:18:31 +01:00
Sven Nierlein
d54f14a092 merge test changes from check_http
the example certificate has changed since.
2020-05-15 14:24:18 +02:00
Sven Nierlein
072e97d5de tests: update expired test certificate
the certificate used to test expired http checks is to old to be used
with recent ssl libraries and results in:

> SSL routines:SSL_CTX_use_certificate:ee key too small

unfortunatly the error is only visible when setting $IO::Socket::SSL::DEBUG in
the check_http.t file.
2020-05-15 14:24:18 +02:00
Andreas Baumann
2f4d6764d7 Merge branch 'master' into feature_check_curl 2019-04-04 13:09:15 +02:00
Sven Nierlein
8442ed5b41 renew test certificates
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2019-02-19 16:35:28 +01:00
Sven Nierlein
22f47fc0c5 tests: make check_snmp test more reliable
The check_snmp rate tests depend on the exact amount of time spend between the
plugin runs and will fail on busy machines, ex. the ci servers. Using faketime
mitigates this issue and also removes all the sleeps.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2019-01-21 17:41:02 +01:00
Christopher Odenbach
7e9d9a5629 added some advanced tests for check_curl 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
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
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
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
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
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
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
Sven Nierlein
9c32acf5bb fix tests for certificates expire date with seconds 2015-10-02 16:27:12 +02:00
Sven Nierlein
75d884ed1e fix snmp test for included threshold
since 6623a1 check_snmp prints the thresholds along the performance data.
This adjust our test cases accordingly.

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
2015-04-12 14:29:05 +02:00
Sven Nierlein
a5b6d94fc6 tests: skip extented snmp tests if snmpd has no perl support
solaris snmpd has no perl support by default, so this test will fail.

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
2014-07-31 21:07:18 +02:00
Holger Weiss
b785a770e4 plugins/tests/check_http.t: Adjust date strings
Adjust the expected date strings to the now-localized output produced by
plugins/sslutils.c.

Closes #1275.
2014-07-21 21:52:33 +02:00
Sven Nierlein
b2fed383b1 tests: freebsds snmpd does not use quotes
when returning syscontact. So make them optional since we want to test
check_snmp and not the snmpd.

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
2014-06-13 16:34:03 +02:00
Sven Nierlein
4102eaae0e tests: check_proc tests fail if uid -2 does not map to nobody
so make sure our tests only run if -2 maps to nobody

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
2014-06-13 15:57:21 +02:00
Sven Nierlein
fb89accaaa require at least HTTP::Daemon 6.01
since the test uses send_header from HTTP::Daemon::ClientConn which has been introduced in
HTTP::Daemon 6.01
2014-06-13 14:01:12 +02:00
Sven Nierlein
c5a6c5136a tests: testCmd has own timeout which overwrites local one
so add configurable/optional timeout to testCmd.

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
2014-06-12 13:56:48 +02:00
Sven Nierlein
3529d7465d tests: parts of the check_procs test only work when uid -2 exists
skip those tests if the uid does not exist

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
2014-06-12 11:45:49 +02:00
Sven Nierlein
385340a4ef check_procs test fails if there is no user with uid 501
thats because check_procs verifys there is a user for a
given uid filter. So even we use sample data for this
test, we still need a real user.

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
2014-02-18 16:20:11 +01:00
Thomas Guyot-Sionnest
f3078c33f6 Add perfdata in check_proc output tests 2014-01-31 13:00:53 -05:00
Thomas Guyot-Sionnest
f45adede7d Fix snmpd tests 2014-01-31 12:30:11 -05:00
Thomas Guyot-Sionnest
1dd0e4c963 Enable tests in tests/ subdirs 2014-01-31 08:54:44 -05:00
Thomas Guyot-Sionnest
c4e3cd6efd Add tests for negative thresholds in check_snmp
Next commit will work on fixing these!
2014-01-31 00:48:49 -05:00
Thomas Guyot-Sionnest
189e2aa344 Rename MP_STATE_DIRECTORY to MP_STATE_PATH 2014-01-27 08:35:23 -05:00
Thomas Guyot-Sionnest
4caf4ce4fe Rename ENV variable, keep backward compatibility
Rename NAGIOS_PLUGIN_STATE_DIRECTORY to MP_STATE_DIRECTORY
2014-01-25 03:35:46 -05:00
Holger Weiss
6141cfebf6 New default installation prefix: /usr/local
Install into /usr/local instead of /usr/local/nagios by default, in
order to comply with the Filesystem Hierarchy Standard (FHS) and
presumably the expectations of most users.
2014-01-21 13:17:36 +01:00
Monitoring Plugins Development Team
63734f52ab Project rename initial commit.
This is an initial take at renaming the project to Monitoring Plugins.
It's not expected to be fully complete, and it is expected to break
things (The perl module for instance). More testing will be required
before this goes mainline.
2014-01-19 14:18:47 -05:00
Holger Weiss
717b0e8d9c Fix the "check_http -d" tests 2013-08-18 18:31:59 +02:00
linkslice
2a8eab6b31 added ability to check regex against http headers. booyah! 2013-08-18 18:23:11 +02:00
Holger Weiss
66003414af tests/check_http.t: Fix whitespace issues
In tests/check_http.t, tabs are used for indentation.

While at it, apply another few cosmetic changes.
2012-08-10 12:49:30 +02:00
Holger Weiss
3f944a50b7 tests/check_http.t: Update the number of SSL tests 2012-08-10 12:41:41 +02:00
Holger Weiss
62d01df1fd tests/check_http.t: Fix test case
Fix the test case which is meant to make sure that

	check_http -C <n>,<m> [...]

returns a CRITICAL state if <m> is large enough.
2012-08-10 12:35:16 +02:00
Sven Nierlein
843f954056 check_snmp: use single quotes for perf data labels 2012-06-27 00:02:09 +02:00