Skip to content

Commit

Permalink
Added power_supply plugin (#25)
Browse files Browse the repository at this point in the history
* Added power_supply plugin
  • Loading branch information
drotscher authored Jan 23, 2024
1 parent 3a1bb5a commit 33b607b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions metricq_source_ipmi/plugin_power_supply/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .plugin import *
10 changes: 10 additions & 0 deletions metricq_source_ipmi/plugin_power_supply/plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
NEEDED_SENSORS = 4
POWER_SUPPLY_STATUS_OK = ["'OK'", "'Presence detected'"]

def create_metric_value(sensors):
if {'PS1_Status', 'PS2_Status', 'PS3_Status', 'PS4_Status'}.issubset(sensors.keys()) and len(sensors) == NEEDED_SENSORS:
if sensors['PS1_Status']['status'] in POWER_SUPPLY_STATUS_OK and sensors['PS2_Status']['status'] in POWER_SUPPLY_STATUS_OK and sensors['PS3_Status']['status'] in POWER_SUPPLY_STATUS_OK and sensors['PS4_Status']['status'] in POWER_SUPPLY_STATUS_OK:
return float(1)
else:
return float(0)
return float('nan')

0 comments on commit 33b607b

Please sign in to comment.