Skip to content

Commit

Permalink
Battery mertics now included & they work ;)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesread committed Oct 29, 2013
1 parent 58f190c commit d86dcbe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions upsilon-serviceChecks/check_power_supply.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
if "BAT" in supply:
hasBattery = True

batteryCharge = open(join(powerSupplies, supply, "capacity"), 'r').read().strip()
batteryCharge = int(open(join(powerSupplies, supply, "capacity"), 'r').read().strip())

if onAcPower:
exit(OK, None, "On AC Power")
elif hasBattery:
metadata = clsmetadata()
metdata.addMetric("Battery charge", batteryCharge, OK if batteryCharge > 50 else CRITICAL)
exit(WARNING, None, "On Battery, charge is: " + str(batteryCharge) + "%")
metadata.addMetric("batteryCharge", batteryCharge, OK if batteryCharge > 25 else CRITICAL)
exit(WARNING, metadata, "On Battery, charge is: " + str(batteryCharge) + "%")
else:
exit(CRITICAL, None, "Can't detect power source!")

0 comments on commit d86dcbe

Please sign in to comment.