monitor: Support set_func_on_present
The set_func_on_present JSON field determines if the fan FRU and rotors
should be set to functional immediately when a fan plug is detected. It
is optional in the JSON file, and defaults to false if not present.
When this is false, a fan will have to spin back up again before it is
set back to functional, meaning that if the new fan is faulty and never
spins up there may not be another error created. If a faulty fan is
plugged when this setting is true, then an error will be created as soon
as the configuration allows.
In some system configurations, the functional status on the fan FRU may
also control LED status, so setting the FRU to functional on the plug
would also turn off a fault LED, which is a desired behavior in the
systems that do this.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: If1a8e62a7b390e8137353a7ecc423a60df138315
diff --git a/monitor/json_parser.cpp b/monitor/json_parser.cpp
index 888a57d..ff86642 100644
--- a/monitor/json_parser.cpp
+++ b/monitor/json_parser.cpp
@@ -331,10 +331,18 @@
}
}
+ // if the fan should be set to functional when plugged in
+ bool setFuncOnPresent = false;
+ if (fan.contains("set_func_on_present"))
+ {
+ setFuncOnPresent = fan["set_func_on_present"].get<bool>();
+ }
+
fanDefs.emplace_back(std::tuple(
fan["inventory"].get<std::string>(), method, funcDelay, timeout,
deviation, nonfuncSensorsCount, monitorDelay, countInterval,
- nonfuncRotorErrorDelay, fanMissingErrorDelay, sensorDefs, cond));
+ nonfuncRotorErrorDelay, fanMissingErrorDelay, sensorDefs, cond,
+ setFuncOnPresent));
}
return fanDefs;