You are here

function monitoring_cron in Monitoring 8

Implements hook_cron().

1 call to monitoring_cron()
MonitoringCoreKernelTest::testCronRunAllEnabledSensors in tests/src/Kernel/MonitoringCoreKernelTest.php
Tests monitoring_cron.

File

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

Code

function monitoring_cron() {

  // Run sensors to collect data for each of them, if the setting allows it.
  if (\Drupal::config('monitoring.settings')
    ->get('cron_run_sensors')) {

    // The result data can be captured through hook_monitoring_sensor_run.
    \Drupal::service('monitoring.sensor_runner')
      ->runSensors();
  }
}