diff options
-rwxr-xr-x | plugins/tests/check_procs.t | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/plugins/tests/check_procs.t b/plugins/tests/check_procs.t index 06ad9df..1ad2c2f 100755 --- a/plugins/tests/check_procs.t +++ b/plugins/tests/check_procs.t | |||
@@ -36,13 +36,17 @@ $result = NPTest->testCmd( "$command -C launchd -c 5" ); | |||
36 | is( $result->return_code, 2, "Checking processes filtered by command name" ); | 36 | is( $result->return_code, 2, "Checking processes filtered by command name" ); |
37 | is( $result->output, "PROCS CRITICAL: 6 processes with command name 'launchd' | procs=6;;5;0;", "Output correct" ); | 37 | is( $result->output, "PROCS CRITICAL: 6 processes with command name 'launchd' | procs=6;;5;0;", "Output correct" ); |
38 | 38 | ||
39 | $result = NPTest->testCmd( "$command -u 501 -w 39 -c 41" ); | 39 | SKIP: { |
40 | is( $result->return_code, 1, "Checking processes filtered by userid" ); | 40 | skip 'user with uid 501 required', 4 unless getpwuid(501); |
41 | like( $result->output, '/^PROCS WARNING: 40 processes with UID = 501 (.*)$/', "Output correct" ); | ||
42 | 41 | ||
43 | $result = NPTest->testCmd( "$command -C launchd -u 501" ); | 42 | $result = NPTest->testCmd( "$command -u 501 -w 39 -c 41" ); |
44 | is( $result->return_code, 0, "Checking processes filtered by command name and userid" ); | 43 | is( $result->return_code, 1, "Checking processes filtered by userid" ); |
45 | like( $result->output, '/^PROCS OK: 1 process with command name \'launchd\', UID = 501 (.*)$/', "Output correct" ); | 44 | like( $result->output, '/^PROCS WARNING: 40 processes with UID = 501 (.*)$/', "Output correct" ); |
45 | |||
46 | $result = NPTest->testCmd( "$command -C launchd -u 501" ); | ||
47 | is( $result->return_code, 0, "Checking processes filtered by command name and userid" ); | ||
48 | like( $result->output, '/^PROCS OK: 1 process with command name \'launchd\', UID = 501 (.*)$/', "Output correct" ); | ||
49 | } | ||
46 | 50 | ||
47 | $result = NPTest->testCmd( "$command -u -2 -w 2:2" ); | 51 | $result = NPTest->testCmd( "$command -u -2 -w 2:2" ); |
48 | is( $result->return_code, 1, "Checking processes with userid=-2" ); | 52 | is( $result->return_code, 1, "Checking processes with userid=-2" ); |
@@ -97,9 +101,13 @@ is( $result->return_code, 1, "Checking against metric of CPU > 8" ); | |||
97 | is( $result->output, 'CPU WARNING: 1 warn out of 95 processes | procs=95;;;0; procs_warn=1;;;0; procs_crit=0;;;0;', "Output correct" ); | 101 | is( $result->output, 'CPU WARNING: 1 warn out of 95 processes | procs=95;;;0; procs_warn=1;;;0; procs_crit=0;;;0;', "Output correct" ); |
98 | 102 | ||
99 | # TODO: Because of a conversion to int, if CPU is 1.45%, will not alert, but 2.01% will. | 103 | # TODO: Because of a conversion to int, if CPU is 1.45%, will not alert, but 2.01% will. |
100 | $result = NPTest->testCmd( "$command --metric=CPU -w 1 -u 501 -v" ); | 104 | SKIP: { |
101 | is( $result->return_code, 1, "Checking against metric of CPU > 1 with uid=501 - TODO" ); | 105 | skip 'user with uid 501 required', 2 unless getpwuid(501); |
102 | is( $result->output, 'CPU WARNING: 2 warn out of 40 processes with UID = 501 (tonvoon) [Skype, PubSubAgent]', "Output correct" ); | 106 | |
107 | $result = NPTest->testCmd( "$command --metric=CPU -w 1 -u 501 -v" ); | ||
108 | is( $result->return_code, 1, "Checking against metric of CPU > 1 with uid=501 - TODO" ); | ||
109 | is( $result->output, 'CPU WARNING: 2 warn out of 40 processes with UID = 501 (tonvoon) [Skype, PubSubAgent]', "Output correct" ); | ||
110 | }; | ||
103 | 111 | ||
104 | $result = NPTest->testCmd( "$command --metric=VSZ -w 1200000 -v" ); | 112 | $result = NPTest->testCmd( "$command --metric=VSZ -w 1200000 -v" ); |
105 | is( $result->return_code, 1, "Checking against VSZ > 1.2GB" ); | 113 | is( $result->return_code, 1, "Checking against VSZ > 1.2GB" ); |