Skip to content

Commit

Permalink
Added user_fahrenheit parameter to impi gmond python module
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Moate committed Jun 14, 2018
1 parent 27b39a6 commit beefff2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ipmi/python_modules/ipmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ def metric_description(metric_name):
else:
return metric_name.strip()

def c_to_f(temp):
return (temp * 9.0/5.0) + 32.0

def get_metrics():
"""Return all metrics"""

Expand Down Expand Up @@ -167,9 +170,16 @@ def get_metrics():
if not vmatch:
continue
metric_value = float(vmatch.group(1))
if data[2].strip() == "degrees C":
if 'use_fahrenheit' in params.keys() and params['use_fahrenheit']:
metric_value = c_to_f(metric_value)
units[metric_name] = "F"
else:
units[metric_name] = "C"
else:
units[metric_name] = data[2].strip()

new_metrics[metric_name] = metric_value
units[metric_name] = data[2].strip().replace("degrees C", "C")
descr[metric_name] = description

except ValueError:
Expand Down Expand Up @@ -253,6 +263,7 @@ def metric_cleanup():

params = {
"use_sudo" : False,
"use_fahrenheit" : False,
"metric_prefix" : "ipmi",
#"ipmi_ip" : "10.1.2.3",
#"username" : "ADMIN",
Expand Down

0 comments on commit beefff2

Please sign in to comment.