aboutsummaryrefslogtreecommitdiff
path: root/plugins/tests
diff options
context:
space:
mode:
authorGravatar Sven Nierlein <sven@nierlein.de> 2021-10-25 17:28:17 +0200
committerGravatar Sven Nierlein <sven@nierlein.org> 2021-11-01 13:35:11 +0100
commit282ccd4a8bbaa5d99c7c0cf6eba963ee3c0bff3a (patch)
tree0d2ee78512b1872f3673f9175c2617cfa0b7fb23 /plugins/tests
parent1738d14c0cae83a24927f34e11a673c7e29baa04 (diff)
downloadmonitoring-plugins-282ccd4a8bbaa5d99c7c0cf6eba963ee3c0bff3a.tar.gz
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>
Diffstat (limited to 'plugins/tests')
-rwxr-xr-xplugins/tests/check_procs.t11
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins/tests/check_procs.t b/plugins/tests/check_procs.t
index 54d43d9b..7f612e8a 100755
--- a/plugins/tests/check_procs.t
+++ b/plugins/tests/check_procs.t
@@ -69,9 +69,13 @@ SKIP: {
like( $result->output, '/^PROCS OK: 0 processes with UID = -2 \(nobody\), args \'UsB\'/', "Output correct" );
};
-$result = NPTest->testCmd( "$command --ereg-argument-array='mdworker.*501'" );
-is( $result->return_code, 0, "Checking regexp search of arguments" );
-is( $result->output, "PROCS OK: 1 process with regex args 'mdworker.*501' | procs=1;;;0;", "Output correct" );
+SKIP: {
+ skip 'check_procs is compiled with etime format support', 2 if `$command -vvv` =~ m/etime/mx;
+
+ $result = NPTest->testCmd( "$command --ereg-argument-array='mdworker.*501'" );
+ is( $result->return_code, 0, "Checking regexp search of arguments" );
+ is( $result->output, "PROCS OK: 1 process with regex args 'mdworker.*501' | procs=1;;;0;", "Output correct" );
+}
$result = NPTest->testCmd( "$command --vsz 1000000" );
is( $result->return_code, 0, "Checking filter by VSZ" );
@@ -129,4 +133,3 @@ is( $result->output, 'RSS CRITICAL: 5 crit, 0 warn out of 95 processes [WindowSe
$result = NPTest->testCmd( "$command --ereg-argument-array='(nosuchname|nosuch2name)'" );
is( $result->return_code, 0, "Checking no pipe symbol in output" );
is( $result->output, "PROCS OK: 0 processes with regex args '(nosuchname,nosuch2name)' | procs=0;;;0;", "Output correct" );
-