hardware: alarms report the crossed threshold value
The exceeded threshold value for sensors is now propagated to sysrepo.
Our alarm daemon does not implement history yet so we talked about
how the alarm message should be updated during the lifecycle of the
alarm. We thought that clearing the alarm should not change the
alarm-text so we know what was wrong and what was the last value leading
to raising the alarm. However, we decided not to go with that and rather
implement the alarm history (status-changes in RFC 8632 [1]). Therefore,
the alarm-text reflects the current state of the alarm for now.
[1] https://datatracker.ietf.org/doc/rfc8632/
Change-Id: If62c44a54981bb620931bf4b268c3cefb50e8ee4
diff --git a/src/ietf-hardware/IETFHardware.cpp b/src/ietf-hardware/IETFHardware.cpp
index c67b73f..b7f290d 100644
--- a/src/ietf-hardware/IETFHardware.cpp
+++ b/src/ietf-hardware/IETFHardware.cpp
@@ -98,7 +98,7 @@
{
SensorPollData pollData;
std::set<std::string> activeSensors;
- std::map<std::string, State> alarms;
+ std::map<std::string, ThresholdUpdate<int64_t>> alarms;
for (auto& dataReader : m_callbacks) {
pollData.merge(dataReader());
@@ -126,7 +126,7 @@
if (auto update = thresholdsWatcher.update(newValue)) {
m_log->debug("threshold: {} {}", sensorXPath, update->newState);
- alarms.emplace(sensorXPath, update->newState);
+ alarms.emplace(sensorXPath, *update);
}
}