[checkmk-commits] Check_MK Git: check_mk: Added perf-o-meter for h3c_lanswitch_cpu

Mathias Kettner mk at mathias-kettner.de
Fri Feb 25 15:52:00 CET 2011


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

Author: Mathias Kettner <mk at mathias-kettner.de>
Date:   Fri Feb 25 15:51:23 2011 +0100

Added perf-o-meter for h3c_lanswitch_cpu

---

 README.writing_checks              |    4 +++-
 web/plugins/perfometer/check_mk.py |   15 +++++++++++++++
 2 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/README.writing_checks b/README.writing_checks
index 0e22d34..21771b0 100644
--- a/README.writing_checks
+++ b/README.writing_checks
@@ -134,7 +134,9 @@ Performance data:
   graph in its current (and maybe future) forms. Those are in pnp-rraconf.
   Use a symlink here.
 
-* pnp rra configuration
+* Each check that outputs performance data should have a perf-o-meter.
+  For checks part of Check_MK this must be done in web/plugins/perfometer/check_mk.py.
+  For third party checks this should be done in a separate file in web/plugins/perfometer.
 
 SNMP based checks:
 * Only use numeric OIDs in your checks. Name based OIDs rely on MIB files
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 28deb9c..8f6e0cd 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -241,3 +241,18 @@ def perfometer_oracle_sessions(row, check_command, perf_data):
 perfometers["check_mk-oracle_sessions"] = perfometer_oracle_sessions
 perfometers["check_mk-oracle_logswitches"] = perfometer_oracle_sessions
 
+def perfometer_h3c_lanswitch_cpu(row, check_command, perf_data):
+    util = float(perf_data[0][1]) # is already percentage
+    warn = float(perf_data[0][3])
+    crit = float(perf_data[0][4])
+    if util < warn:
+        color = "#6f2"
+    elif util < crit:
+        color = "#9f2"
+    else:
+        color = "#cf2"
+
+    return "%.0f%%" % util, perfometer_linear(util, color)
+
+#perfometer_linear(perc, color)
+perfometers["check_mk-h3c_lanswitch_cpu"] = perfometer_h3c_lanswitch_cpu



More information about the checkmk-commits mailing list