[checkmk-commits] Check_MK Git: check_mk: Added new perfometer for ups_capacity

git version control git at mathias-kettner.de
Mon Nov 5 14:51:29 CET 2012


Module: check_mk
Branch: master
Commit: e8d82e780314a70cedacabed3c08615a80438a69
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e8d82e780314a70cedacabed3c08615a80438a69

Author: Bastian Kuhn <bk at mathias-kettner.de>
Date:   Fri Nov  2 10:08:42 2012 +0100

Added new perfometer for ups_capacity

---

 checks/ups_capacity                |    4 +++-
 web/plugins/perfometer/check_mk.py |   14 ++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/checks/ups_capacity b/checks/ups_capacity
index 2b7c193..1ae2480 100644
--- a/checks/ups_capacity
+++ b/checks/ups_capacity
@@ -57,8 +57,10 @@ def check_ups_capacity(item, params, info):
 
     time_on_bat, minutes_left, percent_fuel = map(int, info[0])
     perf = [
-      ('capacity', minutes_left)
+      ('capacity', minutes_left, warn, crit),
+      ('percent', percent_fuel),
     ]
+
     info_text = "remaining capacity %d minutes (%d%%)" % (minutes_left, percent_fuel)
     if time_on_bat > crit:
         return(2, "CRIT - On battery since %ds(!!) " % time_on_bat + info_text, perf)
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 7332e2a..a36cbb3 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -592,14 +592,12 @@ def perfometer_carel_uniflair_cooling(row, check_command, perf_data):
 perfometers['check_mk-carel_uniflair_cooling'] = perfometer_carel_uniflair_cooling
 
 def perfometer_eaton(row, command, perf):
-    h = "<table><tr>"
-    vname, wert, einheit, warn, crit, minw, maxw = perf[0]
-
-    h += perfometer_td(int(wert), "silver")
-    diff = 100 - int(wert)
-    h += perfometer_td(diff, "white")
-    h += "</tr></table>"
-    return u"%s°C" % wert, h
+    return u"%s°C" % str(perf[0][1]), perfometer_linear(float(perf[0][1]), 'silver') 
 
 perfometers['check_mk-ups_eaton_enviroment'] = perfometer_eaton
 
+
+def perfometer_ups_capacity(row, command, perf):
+    return "%0.2f%%" % float(perf[1][1]), perfometer_linear(float(perf[1][1]), '#B2FF7F')
+
+perfometers['check_mk-ups_capacity'] = perfometer_ups_capacity 



More information about the checkmk-commits mailing list