Module: check_mk
Branch: master
Commit: ad9822ecf81bb9aca7ff5c566ce124a82d4816d1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ad9822ecf81bb9…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Feb 2 10:41:10 2017 +0100
4334 mssql_instance: now the connection status is configurable
Change-Id: I673b08df7f4b0bff4ef869756538069dedc50662
---
.werks/4334 | 9 +++++++++
ChangeLog | 1 +
checks/mssql_instance | 12 +++++++++---
web/plugins/wato/check_parameters.py | 17 +++++++++++++++++
4 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/.werks/4334 b/.werks/4334
new file mode 100644
index 0000000..0056886
--- /dev/null
+++ b/.werks/4334
@@ -0,0 +1,9 @@
+Title: mssql_instance: now the connection status is configurable
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i4
+Date: 1486028435
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index cbfff19..8f5e1be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,7 @@
* 4296 mssql_databases: new check which monitors the auto close and shrink state of
MSSQL databases...
* 4215 hp_webmgmt_status: Now also displays device model and serial number
* 4332 check_http: Add support for TLSv1.1 and TLSv1.2 as configuration option...
+ * 4334 mssql_instance: now the connection status is configurable
* 4171 FIX: perle_psmu: fixed value error...
* 4172 FIX: smart.temp: fixed discovery and check function...
* 4173 FIX: if.include: ignore some more keys in 'Network interfaces and switch
ports' rule which are only used for interface grouping
diff --git a/checks/mssql_instance b/checks/mssql_instance
index c2ba8f6..3d0bef9 100644
--- a/checks/mssql_instance
+++ b/checks/mssql_instance
@@ -70,16 +70,21 @@ def parse_mssql_instance(info):
def inventory_mssql_instance(parsed):
for instance_id, instance in parsed.items():
- yield instance_id, None
+ yield instance_id, {}
-def check_mssql_instance(item, _unused, parsed):
+def check_mssql_instance(item, params, parsed):
instance = parsed.get(item)
if not instance:
return
+ state = 2
+ if params is not None and \
+ params.get("map_connection_state") is not None:
+ state = params["map_connection_state"]
+
if instance["state"] == "0":
- yield 2, "Failed to connect to database (%s)" %
instance["error_msg"]
+ yield state, "Failed to connect to database (%s)" %
instance["error_msg"]
yield 0, "Server is running version %s, %s" %
(instance["version"], instance["edition"])
@@ -92,4 +97,5 @@ check_info["mssql_instance"] = {
'check_function' : check_mssql_instance,
'inventory_function' : inventory_mssql_instance,
'service_description' : 'MSSQL %s Instance',
+ 'group' : 'mssql_instance',
}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 8b620d8..b7633ca 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -2260,6 +2260,23 @@ register_check_parameters(
register_check_parameters(
subgroup_applications,
+ "mssql_instance",
+ _("MSSQL Instance"),
+ Dictionary(
+ elements = [
+ ("map_connection_state", MonitoringState(
+ title = _("Connection status"),
+ default_value = 2))
+ ],
+ ),
+ TextAscii(
+ title = _("Instance identifier"),
+ ),
+ "dict",
+)
+
+register_check_parameters(
+ subgroup_applications,
"mssql_databases",
_("MSSQL Databases properties"),
Dictionary(