Provide option to display sensor value in --list
Sometimes you just want a quick dump of all the sensors
and their current value (without all the other sensor
specific info).
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
diff --git a/geissonator/openbmc-events/openbmc-sensors b/geissonator/openbmc-events/openbmc-sensors
index d138b33..eae5a03 100755
--- a/geissonator/openbmc-events/openbmc-sensors
+++ b/geissonator/openbmc-events/openbmc-sensors
@@ -46,7 +46,11 @@
def do_list_all(args):
s = BMC(server=args.server)
for e in s.list_all():
- print(e)
+ if (args.value):
+ value = s.get_sensor(e)
+ print(e + ' : '+ str(value["Value"]))
+ else:
+ print(e)
def do_view_sensor(args):
s = BMC(server=args.server)
@@ -61,6 +65,11 @@
list_all_sensors = subparsers.add_parser('list', help='List all sensors on BMC')
list_all_sensors.set_defaults(func=do_list_all)
+list_all_sensors.add_argument(
+ '--value',
+ action='store_true',
+ default=False,
+ help='Provide current value of sensor')
view_sensor = subparsers.add_parser(
'view', help='View all data for an individual sensor')