diff --git a/upsilon-serviceChecks/check_power_supply.py b/upsilon-serviceChecks/check_power_supply.py index 74685f98..34c79f79 100755 --- a/upsilon-serviceChecks/check_power_supply.py +++ b/upsilon-serviceChecks/check_power_supply.py @@ -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!")