Monitors locking related information of MSSQL tablespaces
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: 272401a081805ef6d3cc91f05dbd6b3af1ebc2b4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=272401a081805e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Oct 8 14:37:30 2012 +0200
New check mssql_counters.locks: Monitors locking related information of MSSQL tablespaces
---
ChangeLog | 4 ++
checkman/mssql_counters.locks | 27 ++++++++++++
checks/mssql_counters | 53 ++++++++++++++++++++++-
web/plugins/wato/check_parameters.py | 77 +++++++++++++++++++++++++++------
4 files changed, 145 insertions(+), 16 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ff32f6c..6e22772 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -33,6 +33,10 @@
* FIX: Implemented basic non HTTP 200 status code response handling in interactive
progress dialogs (e.g. bulk inventory mode)
* Users & Contacts: Case-insensitive sorting of 'Full name' column
+
+ Checks & Agents:
+ * New check mssql_counters.locks: Monitors locking related information of
+ MSSQL tablespaces
1.2.0p3:
Mulitisite
diff --git a/checkman/mssql_counters.locks b/checkman/mssql_counters.locks
new file mode 100644
index 0000000..f4bcaa5
--- /dev/null
+++ b/checkman/mssql_counters.locks
@@ -0,0 +1,27 @@
+title: Checks locks per second in MSSQL tablespaces
+agents: windows
+author: Lars Michelsen <lm(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This check monitors locking related information of MSSQL tablespaces
+ like for example the number of deadlocks per second or lock requests.
+
+ The check has been developed with MSSQL Server 2008 R2 but should
+ work with other versions too.
+
+ This check needs the Check_MK mssql.vbs plugin installed in
+ the agent. Please refer to the online documentation
+ for how to install that plugin.
+
+item:
+ The MSSQL instance name and the tablespace name separated by a space.
+
+perfdata:
+ lock_requests/sec(int): Number of requested locks per second.
+ lock_timeouts/sec(int): Number of lock timeouts per second.
+ number_of_deadlocks/sec(int): Number of deadlocks per second.
+ lock_waits/sec(int): Number of lock waits per second.
+
+inventory:
+ One separate check for each tablespace will be created.
diff --git a/checks/mssql_counters b/checks/mssql_counters
index 49f86d2..7f21ba5 100644
--- a/checks/mssql_counters
+++ b/checks/mssql_counters
@@ -49,7 +49,7 @@ def mssql_counters_item(line, add_counter_name):
else:
return obj + ' ' + instance
-def inventory_mssql_counters(info, want_counters, perc_w_base, add_counter_name):
+def inventory_mssql_counters(info, want_counters, perc_w_base, add_counter_name, dflt =
None):
inventory = []
for line in info:
if line[1] in want_counters:
@@ -65,7 +65,7 @@ def inventory_mssql_counters(info, want_counters, perc_w_base,
add_counter_name)
if base == 0.0:
continue # Skip counters where base is "0"
- inventory.append((mssql_counters_item(line, add_counter_name), None))
+ inventory.append((mssql_counters_item(line, add_counter_name), dflt))
return inventory
#
@@ -144,6 +144,55 @@ check_info['mssql_counters.transactions'] = {
'has_perfdata': True,
}
+def check_mssql_counters_locks(item, params, info):
+ print params
+ state = 0
+ output = []
+ perfdata = []
+ for line in info:
+ if mssql_counters_item(line, False) != item:
+ continue
+
+ for counter, label in [
+ ('lock_requests/sec', 'Requests'),
+ ('lock_timeouts/sec', 'Timeouts'),
+ ('number_of_deadlocks/sec', 'Deadlocks'),
+ ('lock_waits/sec', 'Waits'),
+ ]:
+ if line[1] == counter:
+ prob_txt = ''
+ value = float(line[-1])
+
+ p = params.get(counter)
+ if p:
+ warn, crit = p
+ if value > crit:
+ state = max(state, 1)
+ prob_txt = ' (!)'
+ elif value > warn:
+ state = max(state, 2)
+ prob_txt = ' (!!)'
+ else:
+ warn, crit = None, None
+
+ output.append('%s: %d/s%s' % (label, value, prob_txt))
+ perfdata.append((counter, value, warn, crit))
+
+ if output:
+ return (state, '%s - %s' % (nagios_state_names[state], ',
'.join(output)), perfdata)
+ else:
+ return (3, 'UNKNOWN - Counters %s could not be found in agent output' %
(item))
+
+check_info['mssql_counters.locks'] = {
+ 'check_function': check_mssql_counters_locks,
+ 'inventory_function': lambda info: inventory_mssql_counters(info,
+ [ 'number_of_deadlocks/sec', 'lock_requests/sec',
'lock_timeouts/sec', 'lock_waits/sec' ],
+ False, False, {}),
+ 'service_description': "%s Locks",
+ 'has_perfdata': True,
+ 'group': 'mssql_counters_locks',
+}
+
#
# File Sizes
#
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 1a65a74..4cc68e9 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -1072,31 +1072,80 @@ checkgroups.append((
subgroup_applications,
"mssql_backup",
_("MSSQL Backups"),
- Alternative(
+ Optional(
+ Tuple(
+ elements = [
+ Integer(title = _("Warning if more than"), unit =
_("seconds")),
+ Integer(title = _("Critical if more than"), unit =
_("seconds"))
+ ]
+ ),
+ title = _("Specify time since last successful backup"),
help = _("The levels for memory usage on Linux and UNIX systems take into
account the "
"currently used memory (RAM or SWAP) by all processes and sets this
in relation "
"to the total RAM of the system. This means that the memory usage can
exceed 100%. "
"A usage of 200% means that the total size of all processes is twice
as large as "
"the main memory, so <b>at least</b> the half of it is
currently swapped out."),
- elements = [
- FixedValue(
- None,
- totext = '',
- title = _("Don't use any threshold. Just collect the
information.")),
- Tuple(
- title = _("Specify time since last successful backup"),
- elements = [
- Integer(title = _("Warning if more than"), unit =
_("seconds")),
- Integer(title = _("Critical if more than"), unit =
_("seconds"))
- ]
- )
- ]
),
TextAscii(
title = _("Service descriptions"),
allow_empty = False),
None))
+checkgroups.append((
+ subgroup_applications,
+ "mssql_counters_locks",
+ _("MSSQL Locks"),
+ Dictionary(
+ help = _("This check monitors locking related information of MSSQL
tablespaces."),
+ elements = [
+ ("lock_requests/sec",
+ Tuple(
+ title = _("Lock Requests / sec"),
+ help = _("Number of new locks and lock conversions per second
requested from the lock manager."),
+ elements = [
+ Float(title = _("Warning at"), unit =
_("requests/sec")),
+ Float(title = _("Critical at"), unit =
_("requests/sec")),
+ ],
+ ),
+ ),
+ ( "lock_timeouts/sec",
+ Tuple(
+ title = _("Lock Timeouts / sec"),
+ help = _("Number of lock requests per second that timed out,
including requests for NOWAIT locks."),
+ elements = [
+ Float(title = _("Warning at"), unit =
_("timeouts/sec")),
+ Float(title = _("Critical at"), unit =
_("timeouts/sec")),
+ ],
+ ),
+ ),
+ ( "number_of_deadlocks/sec",
+ Tuple(
+ title = _("Number of Deadlocks / sec"),
+ help = _("Number of lock requests per second that resulted in a
deadlock."),
+ elements = [
+ Float(title = _("Warning at"), unit =
_("deadlocks/sec")),
+ Float(title = _("Critical at"), unit =
_("deadlocks/sec")),
+ ],
+ ),
+ ),
+ ( "lock_waits/sec",
+ Tuple(
+ title = _("Lock Waits / sec"),
+ help = _("Number of lock requests per second that required the
caller to wait."),
+ elements = [
+ Float(title = _("Warning at"), unit =
_("waits/sec")),
+ Float(title = _("Critical at"), unit =
_("waits/sec")),
+ ],
+ ),
+ ),
+ ]
+ ),
+ TextAscii(
+ title = _("Service descriptions"),
+ allow_empty = False
+ ),
+ None))
+
checkgroups.append((
subgroup_applications,