Module: check_mk
Branch: master
Commit: b6561bf25a404ec7ade72544ded5ee1f58ca8e0b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b6561bf25a404e…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Thu Aug 20 08:35:12 2015 +0200
ups_modulys_battery: bugfix
---
checks/ups_modulys_battery | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/checks/ups_modulys_battery b/checks/ups_modulys_battery
index 10b68e1..f054996 100644
--- a/checks/ups_modulys_battery
+++ b/checks/ups_modulys_battery
@@ -43,6 +43,14 @@ def check_ups_modulys_battery(item, params, info):
if elapsed_sec == 0:
# not on battery so the it will not run out
remainig_min = sys.maxint
+ elif not remaining_min:
+ # The "remaining_min" value isn't always reported and we
don't know why.
+ # One theory is that it will be reported if on battery but we have no data to
verify.
+ #
+ # If the theory holds true, this branch is never taken. If it doesn't
then its likely
+ # the information is only available on some variants of the device or in
some
+ # configurations. We can still report useful data based on
"capacity"
+ remainig_min = sys.maxint
else:
remaining_min = int(remaining_min)
@@ -63,6 +71,10 @@ def check_ups_modulys_battery(item, params, info):
status = 2
elif remaining_min < warn_left or capacity < warn_perc:
status = 1
+ else:
+ status = 0
+
+ infotext = ""
if remaining_min < warn_left:
infotext = "%d minutes remaining (warn/crit at %d/%d min)" %\