You are here

public function ForceRunController::forceRunSensor in Monitoring 8

Force runs a single sensor.

Parameters

\Drupal\monitoring\Entity\SensorConfig $monitoring_sensor_config:

Return value

\Symfony\Component\HttpFoundation\RedirectResponse

1 string reference to 'ForceRunController::forceRunSensor'
monitoring.routing.yml in ./monitoring.routing.yml
monitoring.routing.yml

File

src/Controller/ForceRunController.php, line 68

Class

ForceRunController

Namespace

Drupal\monitoring\Controller

Code

public function forceRunSensor(SensorConfig $monitoring_sensor_config) {
  $this->sensorRunner
    ->resetCache(array(
    $monitoring_sensor_config
      ->id(),
  ));
  $this
    ->messenger()
    ->addMessage($this
    ->t('Force run of the sensor @name executed.', array(
    '@name' => $monitoring_sensor_config
      ->getLabel(),
  )));
  return $this
    ->redirect('monitoring.sensor_list');
}