Emit the controller temperature if the smart payload includes this
field.

Signed-off-by: Dan Williams <[email protected]>
---
 ndctl/util/json-smart.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/ndctl/util/json-smart.c b/ndctl/util/json-smart.c
index 4020423bb8c8..9482b35a43d6 100644
--- a/ndctl/util/json-smart.c
+++ b/ndctl/util/json-smart.c
@@ -109,6 +109,16 @@ struct json_object *util_dimm_health_to_json(struct 
ndctl_dimm *dimm)
                        json_object_object_add(jhealth, "temperature_celsius", 
jobj);
        }
 
+       if (flags & ND_SMART_CTEMP_VALID) {
+               unsigned int temp = ndctl_cmd_smart_get_ctrl_temperature(cmd);
+               double t = ndctl_decode_smart_temperature(temp);
+
+               jobj = json_object_new_double(t);
+               if (jobj)
+                       json_object_object_add(jhealth,
+                                       "controller_temperature_celsius", jobj);
+       }
+
        if (flags & ND_SMART_SPARES_VALID) {
                unsigned int spares = ndctl_cmd_smart_get_spares(cmd);
 

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to