Conditions | 3 |
Paths | 3 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
23 | public function run() |
||
24 | { |
||
25 | $command = 'ps aux | grep ' . $this->processName . ' | wc -l'; |
||
26 | |||
27 | exec($command, $output); |
||
28 | |||
29 | $count = (int)$output[0]; |
||
30 | |||
31 | var_dump($count); |
||
|
|||
32 | var_dump($this->maxNumber); |
||
33 | |||
34 | if ($count > $this->maxNumber) { |
||
35 | return new Result(Result::STATUS_FAIL, 'Too many processes found "' . $this->processName . '". Current: ' . $count . ' / expected < ' . $this->maxNumber . '.'); |
||
36 | } |
||
37 | |||
38 | if ($count < $this->minNumber) { |
||
39 | return new Result(Result::STATUS_FAIL, 'Too few processes found "' . $this->processName . '". Current: ' . $count . ' / expected > ' . $this->maxNumber . '.'); |
||
40 | } |
||
41 | |||
42 | return new Result(Result::STATUS_PASS, 'Number of processes "' . $this->processName . '" was within limits. Current number is ' . $count . '.'); |
||
43 | } |
||
50 |