public function Thresholds::getMatchedThreshold in Monitoring 7
Same name and namespace in other branches
- 8 src/Sensor/Thresholds.php \Drupal\monitoring\Sensor\Thresholds::getMatchedThreshold()
Gets status based on given value.
Note that if the threshold value is NULL or an empty string no assessment will be carried out therefore the OK value will be returned.
Parameters
int $value: The sensor value to assess.
Return value
int The assessed sensor status.
File
- lib/
Drupal/ monitoring/ Sensor/ Thresholds.php, line 54 - Contains \Drupal\monitoring\Sensor\Thresholds.
Class
- Thresholds
- Determine status based on thresholds during sensor run.
Namespace
Drupal\monitoring\SensorCode
public function getMatchedThreshold($value) {
if (method_exists($this, $this->sensorInfo
->getThresholdsType())) {
$status = $this
->{$this->sensorInfo
->getThresholdsType()}($value);
if ($status !== NULL) {
return $status;
}
return SensorResultInterface::STATUS_OK;
}
else {
$this->message = format_string('Unknown threshold type @type', array(
'@type' => $this->{$this}->sensorInfo
->getThresholdsType(),
));
return SensorResultInterface::STATUS_CRITICAL;
}
}