summaryrefslogtreecommitdiffstats
path: root/plugins/tests/check_procs.t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/tests/check_procs.t')
-rwxr-xr-xplugins/tests/check_procs.t13
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/tests/check_procs.t b/plugins/tests/check_procs.t
index 7f612e8..fcea404 100755
--- a/plugins/tests/check_procs.t
+++ b/plugins/tests/check_procs.t
@@ -8,13 +8,14 @@ use Test::More;
8use NPTest; 8use NPTest;
9 9
10if (-x "./check_procs") { 10if (-x "./check_procs") {
11 plan tests => 50; 11 plan tests => 52;
12} else { 12} else {
13 plan skip_all => "No check_procs compiled"; 13 plan skip_all => "No check_procs compiled";
14} 14}
15 15
16my $result; 16my $result;
17my $command = "./check_procs --input-file=tests/var/ps-axwo.darwin"; 17my $command = "./check_procs --input-file=tests/var/ps-axwo.darwin";
18my $cmd_etime = "./check_procs --input-file=tests/var/ps-axwo.debian";
18 19
19$result = NPTest->testCmd( "$command" ); 20$result = NPTest->testCmd( "$command" );
20is( $result->return_code, 0, "Run with no options" ); 21is( $result->return_code, 0, "Run with no options" );
@@ -77,6 +78,14 @@ SKIP: {
77 is( $result->output, "PROCS OK: 1 process with regex args 'mdworker.*501' | procs=1;;;0;", "Output correct" ); 78 is( $result->output, "PROCS OK: 1 process with regex args 'mdworker.*501' | procs=1;;;0;", "Output correct" );
78} 79}
79 80
81SKIP: {
82 skip 'check_procs is compiled without etime format support', 2 if `$cmd_etime -vvv` !~ m/etime/mx;
83
84 $result = NPTest->testCmd( "$cmd_etime -m ELAPSED -C apache2 -w 1000 -c 2000" );
85 is( $result->return_code, 2, "Checking elapsed time threshold" );
86 is( $result->output, "ELAPSED CRITICAL: 10 crit, 0 warn out of 10 processes with command name 'apache2' | procs=10;;;0; procs_warn=0;;;0; procs_crit=10;;;0;", "Output correct" );
87}
88
80$result = NPTest->testCmd( "$command --vsz 1000000" ); 89$result = NPTest->testCmd( "$command --vsz 1000000" );
81is( $result->return_code, 0, "Checking filter by VSZ" ); 90is( $result->return_code, 0, "Checking filter by VSZ" );
82is( $result->output, 'PROCS OK: 24 processes with VSZ >= 1000000 | procs=24;;;0;', "Output correct" ); 91is( $result->output, 'PROCS OK: 24 processes with VSZ >= 1000000 | procs=24;;;0;', "Output correct" );