You are here

protected function SystemLoadSensorPlugin::getLoadAverage in Monitoring 8

Gets the load average for the selected setting.

Return value

array|NULL The load averages or NULL if the method does not exist.

1 call to SystemLoadSensorPlugin::getLoadAverage()
SystemLoadSensorPlugin::runSensor in src/Plugin/monitoring/SensorPlugin/SystemLoadSensorPlugin.php
Runs the sensor, updating $sensor_result.

File

src/Plugin/monitoring/SensorPlugin/SystemLoadSensorPlugin.php, line 126

Class

SystemLoadSensorPlugin
Monitors system load time average.

Namespace

Drupal\monitoring\Plugin\monitoring\SensorPlugin

Code

protected function getLoadAverage() {
  if ($data = $this->state
    ->get('monitoring.test_load_average')) {
    return $data;
  }
  if (!function_exists('sys_getloadavg')) {
    return NULL;
  }
  else {
    return sys_getloadavg();
  }
}