From 5d105c43e5af195b469d2614209d47e731821e28 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 12 May 2016 15:53:55 -0400 Subject: [PATCH] Add option to skip numberless Many sensors in nodesensors are not useful except when evaluated as part of nodehealth. Provide an option to allow people to skip such sensors. Particularly useful in generating time series CSV data. --- confluent_client/bin/nodesensors | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/confluent_client/bin/nodesensors b/confluent_client/bin/nodesensors index 254b5ebe..dcda5cda 100755 --- a/confluent_client/bin/nodesensors +++ b/confluent_client/bin/nodesensors @@ -46,6 +46,8 @@ argparser.add_option('-n', '--numreadings', type='int', help='Number of readings to gather') argparser.add_option('-c', '--csv', action='store_true', help='Output in CSV format') +argparser.add_option('-s', '--skipnumberless', action='store_true', + help='Output in CSV format') (options, args) = argparser.parse_args() repeatmode = False if options.interval: @@ -101,6 +103,8 @@ def sensorpass(showout=True, appendtime=False): if 'sensors' not in reading[node]: continue for sensedata in reading[node]['sensors']: + if sensedata['value'] is None and options.skipnumberless: + continue for redundant_state in ('Non-Critical', 'Critical'): try: sensedata['states'].remove(redundant_state)