Module: check_mk
Branch: master
Commit: 6a8b0d7f99235ae1401d634504d89410b8fa4733
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6a8b0d7f99235a…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Jun 26 09:15:51 2018 +0200
6141 FIX mssql_databases: Fixed creating rule with 'Map Database States'
parameters and moved state bubble to right place
Change-Id: Ic70d2cad31eacbf5685469333ec07011fbd16138
---
.werks/6141 | 11 +++++++++++
checks/mssql_databases | 7 +++++--
web/plugins/wato/check_parameters.py | 2 +-
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/.werks/6141 b/.werks/6141
new file mode 100644
index 0000000..5f6f6dd
--- /dev/null
+++ b/.werks/6141
@@ -0,0 +1,11 @@
+Title: mssql_databases: Fixed creating rule with 'Map Database States' parameters
and moved state bubble to right place
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1529997221
+
+
diff --git a/checks/mssql_databases b/checks/mssql_databases
index 275e7a8..3e5cc4e 100644
--- a/checks/mssql_databases
+++ b/checks/mssql_databases
@@ -69,8 +69,11 @@ def check_mssql_databases(item, params, parsed):
if item in parsed:
data = parsed[item]
- db_state = params.get("map_db_states",
{}).get(data["Status"], 0)
- yield db_state, 'Status: %s, Recovery: %s' % (data["Status"],
data["Recovery"])
+ db_state = data["Status"]
+ state = params.get("map_db_states", {}).get(
+ db_state.replace(" ", "_").upper(), 0)
+ yield state, 'Status: %s' % db_state
+ yield 0, 'Recovery: %s' % data["Recovery"]
for what in ["close", "shrink"]:
state, state_readable = map_states[data["auto_%s" % what]]
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 581f854..db4aaf7 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -2948,7 +2948,7 @@ register_check_parameters(
("OFFLINE", MonitoringState(title=_("Database
Offline"))),
("RESTORING", MonitoringState(title=_("Database Files
are restored"))),
("RECOVERING", MonitoringState(title=_("Database is
being recovered"))),
- ("RECOVERY PENDING", MonitoringState(title=_("Database
must be recovered"))),
+ ("RECOVERY_PENDING", MonitoringState(title=_("Database
must be recovered"))),
("SUSPECT", MonitoringState(title=_("Database
Suspect"))),
("EMERGENCY", MonitoringState(title=_("Database
changed to emergency"))),
],