monitor: Capture 'in range' status in sensor FFDC
This field provides information if the current sensor tach reading is
considered healthy or not without having to manually do the math based
on the current input and target values that fan monitor does.
Example output:
"/xyz/openbmc_project/sensors/fan_tach/fan0_0": {
"functional": true,
"in_range": false,
"present": true,
"prev_tachs": "[3135,3132,3130,3127,3130,3125,3127,3125]",
"prev_targets": "[9000,9040,10320,0,0,0,0,0]",
"tach": 3135.0,
"target": 9000,
"ticks": 27
}
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ifbb6693f84fd20351bffd96c0a04e4e4872c4662
diff --git a/monitor/system.cpp b/monitor/system.cpp
index 1dfb5a2..526d7fe 100644
--- a/monitor/system.cpp
+++ b/monitor/system.cpp
@@ -488,6 +488,7 @@
json values;
values["present"] = fan->present();
values["functional"] = sensor->functional();
+ values["in_range"] = !fan->outOfRange(*sensor);
values["tach"] = sensor->getInput();
if (sensor->hasTarget())