protected function Thresholds::falls in Monitoring 8
Same name and namespace in other branches
- 7 lib/Drupal/monitoring/Sensor/Thresholds.php \Drupal\monitoring\Sensor\Thresholds::falls()
Checks if provided value falls below the configured threshold.
Parameters
int $value: The value to check.
Return value
int|null A sensor status or NULL.
File
- src/
Sensor/ Thresholds.php, line 109 - Contains \Drupal\monitoring\Sensor\Thresholds.
Class
- Thresholds
- Determine status based on thresholds during sensor run.
Namespace
Drupal\monitoring\SensorCode
protected function falls($value) {
if (($threshold = $this->sensorConfig
->getThresholdValue('critical')) !== NULL && $value < $threshold) {
$this->message = new FormattableMarkup('falls below @expected', array(
'@expected' => $threshold,
));
return SensorResultInterface::STATUS_CRITICAL;
}
if (($threshold = $this->sensorConfig
->getThresholdValue('warning')) !== NULL && $value < $threshold) {
$this->message = new FormattableMarkup('falls below @expected', array(
'@expected' => $threshold,
));
return SensorResultInterface::STATUS_WARNING;
}
}