sensor-mon: Create event logs
Fill in the function to create event logs. It creates a different log
for an alarm set versus an alarm clear.
The code will not create event logs for sensors of type 'utilization'
because the application that provides CPU and memory utilization
thresholds hardcodes the threshold values and high CPU usage is expected
in some cases, like during a code update. If someone does want these
event logs from those alarms then that can be fixed up in the future.
There is also a FRU callout added for the sensor's FRU. This is done by
following an association, either 'inventory' or 'chassis', depending on
what application provided the sensor. While the sensor documentation
states that the 'inventory' association would be used to point to the
FRU, nothing in the dbus-sensors code does that and frankly trying to
make that happen isn't worth the effort at this point since it can work
how it is now.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I5689cb47250def28aa2b087f8b1975f5464eb98f
diff --git a/sensor-monitor/threshold_alarm_logger.hpp b/sensor-monitor/threshold_alarm_logger.hpp
index c95f396..07dce13 100644
--- a/sensor-monitor/threshold_alarm_logger.hpp
+++ b/sensor-monitor/threshold_alarm_logger.hpp
@@ -99,6 +99,42 @@
const std::string& alarmProperty, bool alarmValue);
/**
+ * @brief Returns the type of the sensor using the path segment
+ * that precedes the sensor name.
+ *
+ * /xyz/openbmc_project/sensors/voltage/vout -> type == voltage
+ *
+ * @param[in] sensorPath - The sensor object path name
+ *
+ * @return std::string The type segment
+ */
+ std::string getSensorType(std::string sensorPath);
+
+ /**
+ * @brief Allows for skipping event logs based on the sensor type.
+ *
+ * Specifically for the 'utilization' type because its provider
+ * doesn't support configurable thresholds yet.
+ *
+ * @param[in] type - The sensor type, like 'temperature'.
+ * @return bool - If it can be skipped or not.
+ */
+ bool skipSensorType(const std::string& type);
+
+ /**
+ * @brief Returns the inventory path to use for a FRU callout
+ * for the alarm exceeded errors.
+ *
+ * It finds the path by looking for 'inventory' or 'chassis'
+ * association objects on the sensor that point to a FRU.
+ *
+ * @param[in] std::string - The sensor object path
+ * @return std::string - The inventory path for the FRU callout.
+ * May be empty if none found.
+ */
+ std::string getCallout(const std::string& sensorPath);
+
+ /**
* @brief The sdbusplus bus object
*/
sdbusplus::bus::bus& bus;