Skip to content
Snippets Groups Projects
Commit b024d043 authored by Lio Novelli's avatar Lio Novelli
Browse files

#3307973: Improve sensore result to healthcheck mapping.

parent f35513f6
No related branches found
No related tags found
No related merge requests found
......@@ -19,8 +19,7 @@ class OhdearHealthcheckGenerator {
SensorResultDataInterface::STATUS_CRITICAL => CheckResult::STATUS_FAILED,
SensorResultDataInterface::STATUS_UNKNOWN => CheckResult::STATUS_SKIPPED,
SensorResultDataInterface::STATUS_WARNING => CheckResult::STATUS_WARNING,
// SensorResultDataInterface::STATUS_INFO => CheckResult::STATUS_CRASHED,
// Makes no sense!
SensorResultDataInterface::STATUS_INFO => CheckResult::STATUS_OK,
];
/**
......@@ -53,7 +52,7 @@ class OhdearHealthcheckGenerator {
* Object that ohdear service expects.
*/
public function convertSensorResultToOhdearHealthcheck(SensorResultInterface $sensorResult) {
$name = $sensorResult->getSensorId();
$sensor_id = $sensorResult->getSensorId();
$sensor_config = $sensorResult->getSensorConfig();
$label = $sensor_config->getLabel();
$shortSummary = $sensor_config->getDescription() ?? '';
......@@ -66,11 +65,9 @@ class OhdearHealthcheckGenerator {
}
else {
$meta = [];
$shortSummary = '';
}
$status = self::STATUS_MAPPING[$sensorResult->getStatus()] ?? CheckResult::STATUS_SKIPPED;
return $this->getCheckResult($name, $label, $notificationMessage, $shortSummary, $status, $meta);
return $this->getCheckResult($sensor_id, $label, $notificationMessage, $shortSummary, $status, $meta);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment