Module: check_mk
Branch: master
Commit: c5318f96ad17ea3c147d0a6307bd61e23540a0f5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c5318f96ad17ea…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Jul 8 17:37:36 2014 +0200
mssql_tablespaces: It is now possible to define thresholds
---
.werks/178 | 8 +++++
ChangeLog | 1 +
checks/mssql_tablespaces | 27 ++++++++++++---
web/plugins/wato/check_parameters.py | 63 ++++++++++++++++++++++++++++++++++
4 files changed, 95 insertions(+), 4 deletions(-)
diff --git a/.werks/178 b/.werks/178
new file mode 100644
index 0000000..392ca70
--- /dev/null
+++ b/.werks/178
@@ -0,0 +1,8 @@
+Title: mssql_tablespaces: It is now possible to define thresholds
+Level: 1
+Component: checks
+Version: 1.2.5i5
+Date: 1404833800
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 190d176..10c6a99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,7 @@
* 0998 ibm_imm_health: Trying to recognice newer versions of IBM IMM now too
* 0628 raritan_pdu_inlet: now also monitors the three phases of the inlet
* 1073 sni_octopuse_cpu: added PNP graph definition and Perf-O-Meter
+ * 0178 mssql_tablespaces: It is now possible to define thresholds
* 0994 FIX: agent plugin smart: fixed syntax error
* 0989 FIX: logwatch.ec: Fix forwarding multiple messages via syslog/TCP...
* 0943 FIX: if.include: fixed incorrect traffic percentage values in the check output
of if checks...
diff --git a/checks/mssql_tablespaces b/checks/mssql_tablespaces
index 03da02d..97c6e22 100644
--- a/checks/mssql_tablespaces
+++ b/checks/mssql_tablespaces
@@ -45,15 +45,21 @@
# 11: uom
# 12: Total amount of space reserved for objects in the database, but not yet used.
# 13: uom
-
+mssql_tablespace_default_levels = {}
def inventory_mssql_tablespaces(info):
inventory = []
for line in info:
if len(line) > 1:
- inventory.append((line[0] + ' ' + line[1], None))
+ inventory.append((line[0] + ' ' + line[1],
'mssql_tablespace_default_levels'))
return inventory
def check_mssql_tablespaces(item, params, info):
+ # First version of this check was without levels,
+ # so it is possible that params are None
+ if not params:
+ params = {}
+
+ state = 0
for line in info:
if len(line) < 2 or item != line[0] + ' ' + line[1]:
continue
@@ -77,10 +83,22 @@ def check_mssql_tablespaces(item, params, info):
elif uom == 'TB':
val_bytes = value * 1024 * 1024 * 1024 * 1024
- output.append('%s: %s' % (label,
get_bytes_human_readable(val_bytes)))
+ warn, crit = params.get(key, (None, None))
+ error_label = ""
+ if warn and crit:
+ levels = "(Warn/Crit at %s/%s)" % \
+ (get_bytes_human_readable(warn), get_bytes_human_readable(crit))
+ if val_bytes > crit:
+ state = 2
+ error_label += levels + "(!!)"
+ elif val_bytes > warn:
+ state = max(state, 1)
+ error_label += levels +"(!)"
+
+ output.append('%s: %s %s' % (label,
get_bytes_human_readable(val_bytes), error_label))
perfdata.append((key, val_bytes))
- return (0, '%s' % ', '.join(output), perfdata)
+ return state, '%s' % ', '.join(output), perfdata
return (3, 'Tablespace %s could not be found' % item)
@@ -88,5 +106,6 @@ check_info['mssql_tablespaces'] = {
'check_function': check_mssql_tablespaces,
'inventory_function': inventory_mssql_tablespaces,
'service_description': '%s Sizes',
+ 'group' : "mssql_tablespaces",
'has_perfdata': True,
}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index a07012f..a279bb1 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -2826,6 +2826,69 @@ register_check_parameters(
register_check_parameters(
subgroup_applications,
+ "mssql_tablespaces",
+ _("MSSQL Size of Tablespace"),
+ Dictionary(
+ elements = [
+ ("size",
+ Tuple(
+ title = _("Size"),
+ elements = [
+ Filesize(title = _("Warning if above")),
+ Filesize(title = _("Critical if above"))
+ ]
+ )),
+ ("unallocated",
+ Tuple(
+ title = _("Unallocated Space"),
+ elements = [
+ Filesize(title = _("Warning if above")),
+ Filesize(title = _("Critical if above"))
+ ]
+ )),
+ ("reserved",
+ Tuple(
+ title = _("Reserved Space"),
+ elements = [
+ Filesize(title = _("Warning if above")),
+ Filesize(title = _("Critical if above"))
+ ]
+ )),
+ ("data",
+ Tuple(
+ title = _("Data"),
+ elements = [
+ Filesize(title = _("Warning if above")),
+ Filesize(title = _("Critical if above"))
+ ]
+ )),
+ ("indexes",
+ Tuple(
+ title = _("Indexes"),
+ elements = [
+ Filesize(title = _("Warning if above")),
+ Filesize(title = _("Critical if above"))
+ ]
+ )),
+ ("unused",
+ Tuple(
+ title = _("Unused"),
+ elements = [
+ Filesize(title = _("Warning if above")),
+ Filesize(title = _("Critical if above"))
+ ]
+ )),
+
+ ],
+ ),
+ TextAscii(
+ title = _("Tablespace name"),
+ allow_empty = False),
+ None
+)
+
+register_check_parameters(
+ subgroup_applications,
"veeam_backup",
_("Veeam: Time since last Backup"),
Dictionary(