| Conditions | 2 |
| Paths | 2 |
| Total Lines | 26 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 9 | public function collect(array $params = []) |
||
| 10 | { |
||
| 11 | $load = sys_getloadavg(); |
||
| 12 | $metrics = [ |
||
| 13 | [ |
||
| 14 | 'name' => 'system_load_average_1m', |
||
| 15 | 'help' => '', |
||
| 16 | 'type' => 'gauge', |
||
| 17 | 'value' => $load[0], |
||
| 18 | ], |
||
| 19 | [ |
||
| 20 | 'name' => 'system_load_average_5m', |
||
| 21 | 'help' => '', |
||
| 22 | 'type' => 'gauge', |
||
| 23 | 'value' => $load[1], |
||
| 24 | ], |
||
| 25 | [ |
||
| 26 | 'name' => 'system_load_average_15m', |
||
| 27 | 'help' => '', |
||
| 28 | 'type' => 'gauge', |
||
| 29 | 'value' => $load[2], |
||
| 30 | ], |
||
| 31 | ]; |
||
| 32 | foreach ($metrics as $metric) { |
||
| 33 | $key = implode($this->config['apcu_key_separator'], [$this->config['apcu_key_prefix'], $metric['name'], $metric['type'], '']); |
||
| 34 | apcu_store($key, $metric['value'], $this->config['apcu_key_max_age']); |
||
| 35 | } |
||
| 37 | } |