@@ -233,31 +233,39 @@ def get_single_chassis_power(redfish_url, chassis_id, power_data, chassis_data):
233233 voltages_num = 0
234234 for voltage in power_data .get ("Voltages" , list ()):
235235
236- if voltage .get ("Status" ) is not None :
237- voltage_status = get_status_data (grab (voltage , "Status" ))
238- status = voltage_status .get ("Health" )
239- state = voltage_status .get ("State" )
240- reading = voltage .get ("ReadingVolts" )
241- name = voltage .get ("Name" )
242-
243- if status is not None :
244- voltages_num += 1
245-
246- status_text = f"Voltage { name } (status: { status } /{ state } ): { reading } V"
247-
248- plugin_object .add_output_data ("CRITICAL" if status not in ["OK" , "WARNING" ] else status ,
249- status_text , location = f"Chassis { chassis_id } " )
250-
251- if reading is not None and name is not None :
252- # noinspection PyBroadException
253- try :
254- if num_chassis > 1 :
255- name = f"{ chassis_id } .{ name } "
256-
257- plugin_object .add_perf_data (f"voltage_{ name } " , float (reading ),
258- location = f"Chassis { chassis_id } " )
259- except Exception :
260- pass
236+ if voltage .get ("Status" ) is None :
237+ continue
238+
239+ voltage_status = get_status_data (grab (voltage , "Status" ))
240+ status = voltage_status .get ("Health" )
241+ state = voltage_status .get ("State" )
242+ reading = voltage .get ("ReadingVolts" )
243+ name = voltage .get ("Name" )
244+
245+ if status is None or name is None :
246+ continue
247+
248+ # noinspection PyBroadException
249+ try :
250+ reading_sanitized = float (f"{ reading } " )
251+ except Exception :
252+ continue
253+
254+ voltages_num += 1
255+
256+ # voltages over 1000 Volts are very likely meant to be milli Volts
257+ if reading_sanitized >= 1000 :
258+ reading_sanitized /= 1000
259+
260+ status_text = f"Voltage { name } (status: { status } /{ state } ): { reading_sanitized } V"
261+
262+ plugin_object .add_output_data ("CRITICAL" if status not in ["OK" , "WARNING" ] else status ,
263+ status_text , location = f"Chassis { chassis_id } " )
264+
265+ if num_chassis > 1 :
266+ name = f"{ chassis_id } .{ name } "
267+
268+ plugin_object .add_perf_data (f"voltage_{ name } " , reading_sanitized , location = f"Chassis { chassis_id } " )
261269
262270 if voltages_num > 0 :
263271 default_text += f" and { voltages_num } Voltages are OK"
0 commit comments