protected function Thresholds::falls in Monitoring 7
Same name and namespace in other branches
- 8 src/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
- lib/
Drupal/ monitoring/ Sensor/ Thresholds.php, line 107 - 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->sensorInfo
->getThresholdValue('critical')) !== NULL && $value < $threshold) {
$this->message = format_string('falls below @expected', array(
'@expected' => $threshold,
));
return SensorResultInterface::STATUS_CRITICAL;
}
if (($threshold = $this->sensorInfo
->getThresholdValue('warning')) !== NULL && $value < $threshold) {
$this->message = format_string('falls below @expected', array(
'@expected' => $threshold,
));
return SensorResultInterface::STATUS_WARNING;
}
}