monitor: Event logs for nonfunc fan sensors
This commit adds the code to create event logs calling out the fan when
fan sensors have been nonfunctional for a certain amount of time.
This functionality is configured in the JSON, and will only be enabled
if the 'fault_handling' JSON section is present. It uses the following
new JSON parameters:
nonfunc_rotor_error_delay (per fan):
This says how many seconds a fan sensor must be nonfunctional before the
event log will be created.
num_nonfunc_rotors_before_error (under fault_handling):
This specifies how many nonfunctional fan rotors there must be at the
same time before an event log with an error severity is created for the
rotor. When there are fewer than this many nonfunctional rotors, then
event logs with an informational severity will be created.
A new FanError class is used to create the event logs. It adds the
Logger output as FFDC, plus any JSON data that is passed in with the
commit() API. It uses CALLOUT_INVENTORY_PATH in the AdditionalData
property to specify the faulted fan FRU.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I365114357580b4f38ec943a769c1ce7f695b51ab
diff --git a/monitor/system.hpp b/monitor/system.hpp
index b1b80a5..05e08b5 100644
--- a/monitor/system.hpp
+++ b/monitor/system.hpp
@@ -73,6 +73,16 @@
*/
void fanStatusChange(const Fan& fan);
+ /**
+ * @brief Called when a fan sensor's error timer expires, which
+ * happens when the sensor has been nonfunctional for a
+ * certain amount of time. An event log will be created.
+ *
+ * @param[in] fan - The parent fan of the sensor
+ * @param[in] sensor - The faulted sensor
+ */
+ void sensorErrorTimerExpired(const Fan& fan, const TachSensor& sensor);
+
private:
/* The mode of fan monitor */
Mode _mode;
@@ -106,6 +116,22 @@
std::vector<std::unique_ptr<PowerOffRule>> _powerOffRules;
/**
+ * @brief The number of concurrently nonfunctional fan sensors
+ * there must be for an event log created due to a
+ * nonfunctional fan sensor to have an Error severity as
+ * opposed to an Informational one.
+ */
+ std::optional<size_t> _numNonfuncSensorsBeforeError;
+
+ /**
+ * @brief Captures tach sensor data as JSON for use in
+ * fan fault and fan missing event logs.
+ *
+ * @return json - The JSON data
+ */
+ json captureSensorData();
+
+ /**
* @brief Retrieve the configured trust groups
*
* @param[in] jsonObj - JSON object to parse from