You are here

function monitoring_sensor_run in Monitoring 7

Same name and namespace in other branches
  1. 8 monitoring.module \monitoring_sensor_run()

The sensor runner function.

Note that in case there is a cached result for given sensor name, the sensor will not run and the cached result will be returned.

Parameters

string $sensor_name: The name of the sensor that is to be run.

bool $force_run: Set to TRUE to force the run. Defaults to FALSE.

bool $verbose: (optional) Set to TRUE to enable verbose execution, defaults to FALSE.

Return value

SensorResultInterface A single result object.

Throws

\Drupal\monitoring\Sensor\NonExistingSensorException Thrown if the requested sensor does not exist.

\Drupal\monitoring\Sensor\DisabledSensorException Thrown if any of the passed sensor names is not enabled.

9 calls to monitoring_sensor_run()
MonitoringApiTest::testAPI in test/tests/monitoring.api.test
Test the base class if info is set and passed correctly.
MonitoringCoreTest::testSensors in test/tests/monitoring.core.test
Tests individual sensors.
MonitoringServicesTest::assertSensorResult in test/tests/monitoring.services.test
Do sensor result assertions.
MonitoringTestBase::runSensor in test/tests/monitoring.base.test
Executes a sensor and returns the result.
MonitoringUITest::testSensorDetailpage in test/tests/monitoring.ui.test
Tests the sensor detail page.

... See full list

File

./monitoring.module, line 96
Monitoring bootstrap file.

Code

function monitoring_sensor_run($sensor_name, $force_run = FALSE, $verbose = FALSE) {
  $results = monitoring_sensor_run_multiple(array(
    $sensor_name,
  ), $force_run, $verbose);
  return reset($results);
}