Sort the returned sensors
Still not perfect but definitely better:
[andrewg@gfwa123 openbmc-events]$ ./openbmc-sensors --server <bmc> list
/xyz/openbmc_project/sensors/temperature/ambient
/xyz/openbmc_project/sensors/fan_tach/fan0_0
/xyz/openbmc_project/sensors/fan_tach/fan0_1
/xyz/openbmc_project/sensors/fan_tach/fan1_0
/xyz/openbmc_project/sensors/fan_tach/fan1_1
/xyz/openbmc_project/sensors/fan_tach/fan2_0
/xyz/openbmc_project/sensors/fan_tach/fan2_1
/xyz/openbmc_project/sensors/fan_tach/fan3_0
/xyz/openbmc_project/sensors/fan_tach/fan3_1
/xyz/openbmc_project/sensors/temperature/p0_vcs_temp
/xyz/openbmc_project/sensors/temperature/p0_vdd_temp
/xyz/openbmc_project/sensors/temperature/p0_vddr_temp
/xyz/openbmc_project/sensors/temperature/p0_vdn_temp
/xyz/openbmc_project/sensors/temperature/p1_vcs_temp
/xyz/openbmc_project/sensors/temperature/p1_vdd_temp
/xyz/openbmc_project/sensors/temperature/p1_vddr_temp
/xyz/openbmc_project/sensors/temperature/p1_vdn_temp
...
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
diff --git a/geissonator/openbmc-events/openbmc-sensors b/geissonator/openbmc-events/openbmc-sensors
index c54dc97..d138b33 100755
--- a/geissonator/openbmc-events/openbmc-sensors
+++ b/geissonator/openbmc-events/openbmc-sensors
@@ -30,7 +30,7 @@
raise Exception("Failed to query sensors: \n" + r.text)
sensors = j['data']
- #sensors.sort(key=lambda x: int(x.split("/")[-1]))
+ sensors = sorted(sensors,key=lambda x: x.split("/")[-1])
return sensors
@@ -41,7 +41,7 @@
if j['status'] != 'ok':
raise Exception("Failed to get sensor " + sensor + ": \n" + r.text)
- return j['data']
+ return j['data']
def do_list_all(args):
s = BMC(server=args.server)