Module: check_mk
Branch: master
Commit: c9e6a77d509a3227080328267bee1fb4c4db6593
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c9e6a77d509a32…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Thu Jan 28 17:24:57 2016 +0100
#2457 mssql_counters.sqlstats: New check to monitor several rates from the SQL statistics
object
---
.werks/2457 | 9 +++++++++
ChangeLog | 1 +
checkman/mssql_counters.sqlstats | 16 ++++++++++++++++
checks/mssql_counters | 34 ++++++++++++++++++++++++++++++++++
web/plugins/wato/check_parameters.py | 23 +++++++++++++++++++++++
5 files changed, 83 insertions(+)
diff --git a/.werks/2457 b/.werks/2457
new file mode 100644
index 0000000..95a383c
--- /dev/null
+++ b/.werks/2457
@@ -0,0 +1,9 @@
+Title: mssql_counters.sqlstats: New check to monitor several rates from the SQL
statistics object
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1453998241
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 65cd3ff..1c949e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -100,6 +100,7 @@
* 2832 netscaler_vserver: improved check output for unknown protocols...
* 3033 check_http: Now supporting extended perfdata parameter of the check
* 2456 palo_alto, palo_alto_sessions: Two new checks for Palo Alto firewalls.
+ * 2457 mssql_counters.sqlstats: New check to monitor several rates from the SQL
statistics object
* 2660 FIX: fixed windows agent using the wrong working directory...
* 2664 FIX: ps: Speedup in situation with many matching processes...
* 2661 FIX: windows agent: fixed incomplete process list...
diff --git a/checkman/mssql_counters.sqlstats b/checkman/mssql_counters.sqlstats
new file mode 100644
index 0000000..943fcc6
--- /dev/null
+++ b/checkman/mssql_counters.sqlstats
@@ -0,0 +1,16 @@
+title: SQL Statistics values for MSSQL
+agents: windows
+catalog: app/mssql
+license: GPL
+distribution: check_mk
+description:
+ This checks monitors various rates from the SQL statistics object.
+
+item:
+ The MSSQL object, instance and counter names separated by spaces.
+
+perfdata:
+ The current rate of the counter as delivered by the SQL statistics object.
+
+inventory:
+ One separate check for each counter will be created.
diff --git a/checks/mssql_counters b/checks/mssql_counters
index 61dc160..58912ab 100644
--- a/checks/mssql_counters
+++ b/checks/mssql_counters
@@ -219,6 +219,40 @@ check_info['mssql_counters.locks'] = {
}
+def check_mssql_counters_sqlstats(item, params, info):
+ for line in info:
+ if mssql_counters_item(line, True) == item:
+ counter_type = item.split()[-1]
+ rate = float(line[-1])
+ status = 0
+ infotext = "%.1f/sec" % rate
+
+ perfdata = [ (counter_type, rate) ]
+
+ if params.get(counter_type):
+ warn, crit = params[counter_type]
+ levelstext = " (warn/crit at %.1f/%.1f per second)" % (warn,
crit)
+ if rate >= crit:
+ status = 2
+ infotext += levelstext
+ elif rate >= warn:
+ status = 1
+ infotext += levelstext
+
+ return status, infotext, perfdata
+
+
+check_info["mssql_counters.sqlstats"] = {
+ "check_function" : check_mssql_counters_sqlstats,
+ "inventory_function" : lambda info: inventory_mssql_counters(info,
+ [ "batch_requests/sec", "sql_compilations/sec",
"sql_re-compilations/sec" ],
+ perc_w_base = False, add_counter_name = True, dflt = {}),
+ "service_description" : "%s",
+ "has_perfdata" : True,
+ "group" : "mssql_stats",
+}
+
+
#.
# .--File Sizes----------------------------------------------------------.
# | _____ _ _ ____ _ |
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index aee8c9c..5c32d35 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -734,6 +734,29 @@ register_check_parameters(
match_type = "dict",
)
+register_check_parameters(
+ subgroup_applications,
+ "mssql_stats",
+ _("MSSQL Statistics"),
+ Dictionary(
+ elements = [
+ ( "batch_requests/sec", Tuple(title = _("Batch
Requests/sec"),
+ elements = [ Float(title = _("warning at"), unit =
_("/sec"), default_value = 100000.0 ),
+ Float(title = _("critical at"), unit =
_("/sec"), default_value = 200000.0 ),])),
+ ( "sql_compilations/sec", Tuple(title = _("SQL
Compilations/sec"),
+ elements = [ Float(title = _("warning at"), unit =
_("/sec"), default_value = 10000.0),
+ Float(title = _("critical at"), unit =
_("/sec"), default_value = 20000.0),])),
+ ( "sql_re-compilations/sec", Tuple(title = _("SQL
Re-Compilations/sec"),
+ elements = [ Float(title = _("warning at"), unit =
_("/sec"), default_value = 10000.0),
+ Float(title = _("critical at"), unit =
_("/sec"), default_value = 200.0),])),
+ ],
+ ),
+ TextAscii(
+ title = _("Counter ID"),
+ ),
+ "dict",
+)
+
#.
# .--Environment---------------------------------------------------------.
# | _____ _ _ |