You are here

protected function SystemMemorySensorPlugin::readMemInfo in Monitoring 8

Reads the memory info file.

Return value

string $data The content of /proc/meminfo.

2 calls to SystemMemorySensorPlugin::readMemInfo()
SystemMemorySensorPlugin::resultVerbose in src/Plugin/monitoring/SensorPlugin/SystemMemorySensorPlugin.php
Provide additional info about sensor call.
SystemMemorySensorPlugin::runSensor in src/Plugin/monitoring/SensorPlugin/SystemMemorySensorPlugin.php
Runs the sensor, updating $sensor_result.

File

src/Plugin/monitoring/SensorPlugin/SystemMemorySensorPlugin.php, line 142

Class

SystemMemorySensorPlugin
Monitors system memory.

Namespace

Drupal\monitoring\Plugin\monitoring\SensorPlugin

Code

protected function readMemInfo() {

  // Checks if any test data is available. The state is solely used to
  // simulate data for tests.
  if ($this->state
    ->get('monitoring.test_meminfo') !== NULL) {
    return $this->state
      ->get('monitoring.test_meminfo');
  }
  else {
    return file_get_contents("/proc/meminfo");
  }
}