Add support to display the special occ sensors
occ has some sensors not in the sensors namespace that
are valuable to look at.
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/geissonator/openbmc-events/openbmc-sensors b/geissonator/openbmc-events/openbmc-sensors
index eae5a03..4b6aa92 100755
--- a/geissonator/openbmc-events/openbmc-sensors
+++ b/geissonator/openbmc-events/openbmc-sensors
@@ -34,6 +34,18 @@
return sensors
+ def occ_all(self):
+ r = self.session.get(self.url + 'org/open_power/control/enumerate',
+ verify=False)
+ j = r.json()
+ if j['status'] != 'ok':
+ raise Exception("Failed to query occ sensors: \n" + r.text)
+
+ sensors = j['data']
+ #sensors = sorted(sensors,key=lambda x: x.split("/")[-1])
+
+ return sensors
+
def get_sensor(self, sensor):
r = self.session.get(self.url + sensor, verify=False)
@@ -52,6 +64,11 @@
else:
print(e)
+def do_occ_all(args):
+ s = BMC(server=args.server)
+ print json.dumps(s.occ_all(), indent=4)
+
+
def do_view_sensor(args):
s = BMC(server=args.server)
print(s.get_sensor(args.sensor))
@@ -76,6 +93,10 @@
view_sensor.add_argument('sensor', help='The sensor to view')
view_sensor.set_defaults(func=do_view_sensor)
+# occ has some 'special' sensors not in the sensor namespace
+occ_sensors = subparsers.add_parser('occ', help='List the special occ sensors')
+occ_sensors.set_defaults(func=do_occ_all)
+
args = parser.parse_args()
if 'func' in args: