Module: check_mk
Branch: master
Commit: b27537a8745ab879d9b87674b3d4b7d4d5d2ea94
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b27537a8745ab8…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Mon Jan 4 11:41:59 2016 +0100
#2871 msexch_database: New check to monitor access latencies to MS Exchange Databases
---
.werks/2871 | 9 ++++
ChangeLog | 1 +
agents/windows/plugins/msexch_database.ps1 | 5 ++
checkman/msexch_database | 14 +++++
checks/msexch_database | 76 ++++++++++++++++++++++++++++
web/plugins/wato/check_parameters.py | 54 ++++++++++++++++++++
6 files changed, 159 insertions(+)
diff --git a/.werks/2871 b/.werks/2871
new file mode 100644
index 0000000..2a6204f
--- /dev/null
+++ b/.werks/2871
@@ -0,0 +1,9 @@
+Title: msexch_database: New check to monitor access latencies to MS Exchange Databases
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1451904040
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 28bc6f3..c012bfa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -71,6 +71,7 @@
* 1600 check_mk_agent.linux: Diskstat Sektion now supports s390 DASDs (zLinux on IBM
Mainframes)
* 1318 cisco_asa_svcsessions: New Check to monitor VPN Connections on Cisco ASA
devices
* 2886 solaris_fmadm: new check monitors the severity and name of the fault class on
Solaris systems using the 'fmadm faulty' command
+ * 2871 msexch_database: New check to monitor access latencies to MS Exchange
Databases
* 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/agents/windows/plugins/msexch_database.ps1
b/agents/windows/plugins/msexch_database.ps1
new file mode 100644
index 0000000..eee98d8
--- /dev/null
+++ b/agents/windows/plugins/msexch_database.ps1
@@ -0,0 +1,5 @@
+# MS Exchange Database counters
+
+Write-Host "<<<msexch_database:sep(59)>>>"
+
+Get-Counter -Counter "\MSExchange Database ==> Instances(*)\*" | %
{$_.CounterSamples} | Select path,cookedvalue | ConvertTo-CSV -NoTypeInformation
-Delimiter ";"
diff --git a/checkman/msexch_database b/checkman/msexch_database
new file mode 100644
index 0000000..9515c39
--- /dev/null
+++ b/checkman/msexch_database
@@ -0,0 +1,14 @@
+title: MS Exchange Database Latency
+agents: windows
+catalog: app/exchange
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the latency of read/write accesses to the database
+ and the log.
+
+ {WARN} and {CRIT} thresholds for each latency measure can be configured,
+ defaults are based of suggestions published on microsofts technet.
+
+inventory:
+ One item per database instance.
diff --git a/checks/msexch_database b/checks/msexch_database
new file mode 100644
index 0000000..f633d34
--- /dev/null
+++ b/checks/msexch_database
@@ -0,0 +1,76 @@
+# -*- encoding: utf-8; py-indent-offset: 4 vim: set ft=python:-*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2015 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+
+factory_settings['msexch_database_defaultlevels'] = {
+ "read_attached_latency" : (200, 250),
+ "read_recovery_latency" : (150, 200),
+ "write_latency" : (40, 50),
+ "log_latency" : (5, 10),
+}
+
+
+def parse_msexch_database(info):
+ instances = {}
+ for key, value in info[1:]:
+ # values are always quoted and may have localized thousands-separators.
+ # in that case however the check will probably fail anyway
+ value = float(value[1:-1].replace(",", "."))
+ fields = key[1:-1].split("\\")
+ obj, counter = fields[-2:]
+ instance = obj.split("(")[-1].split(")")[0]
+ instances.setdefault(instance, {})[counter] = value
+ return instances
+
+
+def inventory_msexch_database(parsed):
+ return [(instance, None) for instance in parsed.keys()]
+
+
+def check_msexch_database(item, params, parsed):
+ if item in parsed:
+ for counter, setting, name in [("I/O Database Reads (Attached) Average
Latency", "read_attached_latency", "DB read (attached)
latency"),
+ ("I/O Database Reads (Recovery) Average
Latency", "read_recovery_latency", "DB read (recovery)
latency"),
+ ("I/O Database Writes (Attached) Average
Latency", "write_latency", "DB write (attached)
latency"),
+ ("I/O Log Writes Average Latency",
"log_latency", "Log latency")]:
+ value = parsed[item][counter.lower()]
+ warn, crit = params[setting]
+ status = 0
+ if value >= crit:
+ status = 2
+ elif value >= warn:
+ status = 1
+ yield status, "%.1fms %s" % (value, name), [(setting, value, warn,
crit)]
+
+
+check_info['msexch_database'] = {
+ 'inventory_function' : inventory_msexch_database,
+ 'check_function' : check_msexch_database,
+ 'parse_function' : parse_msexch_database,
+ 'has_perfdata' : True,
+ 'service_description' : "Exchange Database %s",
+ 'group' : 'msx_database',
+ 'default_levels_variable' : 'msexch_database_defaultlevels'
+}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index ca6d71b..285884f 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -2789,6 +2789,60 @@ register_check_parameters(
)
+register_check_parameters(
+ subgroup_applications,
+ 'msx_database',
+ _("MS Exchange Database"),
+ Dictionary(
+ title = _("Set Levels"),
+ elements = [
+ ('read_attached_latency',
+ Tuple(
+ title = _("I/O Database Reads (Attached) Average Latency"),
+ elements = [
+ Float(title = _("Warning at"), unit = _('ms'),
default_value = 200.0),
+ Float(title = _("Critical at"), unit = _('ms'),
default_value = 250.0)
+ ]
+ )
+ ),
+ ('read_recovery_latency',
+ Tuple(
+ title = _("I/O Database Reads (Recovery) Average Latency"),
+ elements = [
+ Float(title = _("Warning at"), unit = _('ms'),
default_value = 150.0),
+ Float(title = _("Critical at"), unit = _('ms'),
default_value = 200.0)
+ ]
+ )
+ ),
+ ('write_latency',
+ Tuple(
+ title = _("I/O Database Writes (Attached) Average Latency"),
+ elements = [
+ Float(title = _("Warning at"), unit = _('ms'),
default_value = 40.0),
+ Float(title = _("Critical at"), unit = _('ms'),
default_value = 50.0)
+ ]
+ )
+ ),
+ ('log_latency',
+ Tuple(
+ title = _("I/O Log Writes Average Latency"),
+ elements = [
+ Float(title = _("Warning at"), unit = _('ms'),
default_value = 5.0),
+ Float(title = _("Critical at"), unit = _('ms'),
default_value = 10.0)
+ ]
+ )
+ ),
+ ],
+ optional_keys=[]
+ ),
+ TextAscii(
+ title = _("Database Names"),
+ help = _("Specify database names that the rule should apply to"),
+ ),
+ match_type = 'dict'
+)
+
+
def transform_msx_queues(params):
if type(params) == tuple:
return { "levels" : ( params[0], params[1] ) }