[checkmk-commits] Check_MK Git: check_mk: #1011 ibm_svc_systemstats.disk_latency: introduce levels for alerting

Mathias Kettner mk at mathias-kettner.de
Thu Aug 21 10:20:06 CEST 2014


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

Author: Mathias Kettner <mk at mathias-kettner.de>
Date:   Thu Aug 21 10:20:01 2014 +0200

#1011 ibm_svc_systemstats.disk_latency: introduce levels for alerting

This check was currently always OK. Now you can optionally set fixed
or predictive levels.

---

 .werks/1011                          |   11 +++++++++++
 ChangeLog                            |    1 +
 checks/ibm_svc_nodestats             |    3 +++
 checks/ibm_svc_systemstats           |   26 +++++++++++++++++++-------
 web/plugins/wato/check_parameters.py |   31 +++++++++++++++++++++++++++++++
 5 files changed, 65 insertions(+), 7 deletions(-)

diff --git a/.werks/1011 b/.werks/1011
new file mode 100644
index 0000000..15ba0d8
--- /dev/null
+++ b/.werks/1011
@@ -0,0 +1,11 @@
+Title: ibm_svc_systemstats.disk_latency: introduce levels for alerting
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i6
+Date: 1408609145
+Class: feature
+
+This check was currently always OK. Now you can optionally set fixed
+or predictive levels.
+
diff --git a/ChangeLog b/ChangeLog
index c9d4a7a..ece018f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -26,6 +26,7 @@
     * 1006 printer_pages: add Perf-O-Meter and PNP template
     * 0646 brocade_fcport: the administrative states for which ports are inventorized can now be configured in WATO
     * 1010 chrony: new check for NTP synchronization via chrony on Linux...
+    * 1011 ibm_svc_systemstats.disk_latency: introduce levels for alerting...
     * 1051 FIX: tcp_conn_stats: fix missing performance data...
     * 1142 FIX: winperf_ts_sessions: fix computation, check has never really worked
     * 1090 FIX: zfsget: fixed exception which happened on incomplete zfs entries
diff --git a/checks/ibm_svc_nodestats b/checks/ibm_svc_nodestats
index 3bebb4f..e25dc86 100644
--- a/checks/ibm_svc_nodestats
+++ b/checks/ibm_svc_nodestats
@@ -24,6 +24,9 @@
 # to the Free Software Foundation, Inc., 51 Franklin St,  Fifth Floor,
 # Boston, MA 02110-1301 USA.
 
+# Note: This file is almost identical with ibm_svc_nodestats. We should
+# create an include file for sharing common code!
+
 # Example output from agent:
 # <<<ibm_svc_nodestats:sep(58)>>>
 # 1:BLUBBSVC01:compression_cpu_pc:0:0:140325134931
diff --git a/checks/ibm_svc_systemstats b/checks/ibm_svc_systemstats
index 92ef0e1..e2b86b9 100644
--- a/checks/ibm_svc_systemstats
+++ b/checks/ibm_svc_systemstats
@@ -24,6 +24,9 @@
 # to the Free Software Foundation, Inc., 51 Franklin St,  Fifth Floor,
 # Boston, MA 02110-1301 USA.
 
+# Note: This file is almost identical with ibm_svc_systemstats. We should
+# create an include file for sharing common code!
+
 # Example output from agent:
 # <<<ibm_svc_systemstats:sep(58)>>>
 # compression_cpu_pc:0:0:140325134929
@@ -176,26 +179,35 @@ def inventory_ibm_svc_systemstats_disk_latency(info):
     inventory = []
     parsed = ibm_svc_systemstats_parse(info)
     for key in parsed.keys():
-        inventory.append( (key, None) )
+        inventory.append( (key, {}) )
     return inventory
 
-def check_ibm_svc_systemstats_disk_latency(item, _no_params, info):
+def check_ibm_svc_systemstats_disk_latency(item, params, info):
     parsed = ibm_svc_systemstats_parse(info)
 
+
     if item not in parsed.keys():
-        return 3, "%s not found in agent output" % item
+        yield 3, "%s not found in agent output" % item
+        return
+
+    if not params:
+        params = {} # Convert from previous None
+
+    for what, latency in [
+        ('read',  parsed[item]['r_ms'] ),
+        ('write', parsed[item]['w_ms'] )]:
 
-    read_latency  = parsed[item]['r_ms']
-    write_latency = parsed[item]['w_ms']
-    perfdata = [ ("read_latency", read_latency), ("write_latency", write_latency) ]
+        state, text, extraperf = check_levels(latency, what + "_latency", params.get(what), unit = "ms")
+        yield state, ("Latency is %.1f ms for %s" % (latency, what)) + text, \
+          [ ( what + "_latency", latency) ] + extraperf
 
-    return 0, "Latency is %s ms for read, %s ms for write" % (read_latency, write_latency), perfdata
 
 check_info["ibm_svc_systemstats.disk_latency"] = {
     "check_function"        : check_ibm_svc_systemstats_disk_latency,
     "inventory_function"    : inventory_ibm_svc_systemstats_disk_latency,
     "service_description"   : "IBM SVC Latency %s Total",
     "has_perfdata"          : True,
+    "group"                 : "ibm_svc_total_latency",
 }
 
 #.
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 071b105..0142651 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -3814,6 +3814,37 @@ register_check_parameters(
 
 register_check_parameters(
     subgroup_storage,
+    "ibm_svc_total_latency",
+    _("IBM SVC: Levels for total disk latency"),
+    Dictionary(
+        elements = [
+            ( "read",
+              Levels(
+                  title = _("Read throughput"),
+                  unit = _("MB/s"),
+                  default_value = None,
+                  default_levels = (50.0, 100.0))),
+            ( "write",
+              Levels(
+                  title = _("Write throughput"),
+                  unit = _("MB/s"),
+                  default_value = None,
+                  default_levels = (50.0, 100.0))),
+        ]
+    ),
+    DropdownChoice(
+        choices = [ ( "Drives",  _("Total latency for all drives") ),
+                    ( "MDisks",  _("Total latency for all MDisks") ),
+                    ( "VDisks",  _("Total latency for all VDisks") ),
+                  ],
+        title = _("Disk/Drive type"),
+        help = _("Please enter <tt>Drives</tt>, <tt>Mdisks</tt> or <tt>VDisks</tt> here.")),
+    "first"
+)
+
+
+register_check_parameters(
+    subgroup_storage,
     "disk_io",
     _("Levels on disk IO (throughput)"),
     Dictionary(



More information about the checkmk-commits mailing list