Skip to content
Snippets Groups Projects
Commit 86476397 authored by Tibo's avatar Tibo
Browse files

set status to error if load is > 2*threads count. Fix issue #27

parent ff9e72ab
No related branches found
No related tags found
No related merge requests found
Pipeline #12771 passed
......@@ -46,13 +46,23 @@ class LoadAvg extends Sensor
public function status(array $records) : int
{
$max = $this->server()->info()->cpuinfo()["threads"];
$threshold = $this->server()->info()->cpuinfo()["threads"];
$max = 0;
foreach ($records as $record) {
$load = $this->parse($record->data["loadavg"]);
if ($load > $max) {
return Status::WARNING;
$max = $load;
}
}
if ($max > 2 * $threshold) {
return Status::ERROR;
}
if ($max > $threshold) {
return Status::WARNING;
}
return Status::OK;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment