protected function Thresholds::exceeds in Monitoring 8
Same name and namespace in other branches
- 7 lib/Drupal/monitoring/Sensor/Thresholds.php \Drupal\monitoring\Sensor\Thresholds::exceeds()
Checks if provided value exceeds 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 89 - Contains \Drupal\monitoring\Sensor\Thresholds.
Class
- Thresholds
- Determine status based on thresholds during sensor run.
Namespace
Drupal\monitoring\SensorCode
protected function exceeds($value) {
if (($threshold = $this->sensorConfig
->getThresholdValue('critical')) !== NULL && $value > $threshold) {
$this->message = new FormattableMarkup('exceeds @expected', array(
'@expected' => $threshold,
));
return SensorResultInterface::STATUS_CRITICAL;
}
if (($threshold = $this->sensorConfig
->getThresholdValue('warning')) !== NULL && $value > $threshold) {
$this->message = new FormattableMarkup('exceeds @expected', array(
'@expected' => $threshold,
));
return SensorResultInterface::STATUS_WARNING;
}
}