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/json_parser.hpp b/monitor/json_parser.hpp
index 84876ff..ba53fda 100644
--- a/monitor/json_parser.hpp
+++ b/monitor/json_parser.hpp
@@ -93,4 +93,13 @@
getPowerOffRules(const json& obj,
std::shared_ptr<PowerInterfaceBase>& powerInterface);
+/**
+ * @brief Returns the 'num_nonfunc_rotors_before_error field
+ *
+ * @param[in] obj - JSON object to parse from
+ *
+ * @return optional<size_t> - The value, or std::nullopt if not present
+ */
+std::optional<size_t> getNumNonfuncRotorsBeforeError(const json& obj);
+
} // namespace phosphor::fan::monitor