Module: check_mk
Branch: master
Commit: 2f63b216d8c3951465aee7f5fcadea979b8aa505
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2f63b216d8c395…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Nov 11 11:21:23 2016 +0100
3983 FIX mssql_instance: Be more robust agains missing instance info in case of connection
issues
---
.werks/3983 | 9 +++++++++
ChangeLog | 1 +
checks/mssql_instance | 8 +++++++-
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/.werks/3983 b/.werks/3983
new file mode 100644
index 0000000..79f2c7d
--- /dev/null
+++ b/.werks/3983
@@ -0,0 +1,9 @@
+Title: mssql_instance: Be more robust agains missing instance info in case of connection
issues
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i3
+Date: 1478859667
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 238612c..0d7db06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@
* 3939 FIX: f5_bigip_conns: readded performance data and graphs...
* 3979 FIX: vbox_guest: Only try to fetch VBox state in case the vboxguest module is
loaded
* 3750 FIX: cmc_temp: Check now also works when using Nagios core
+ * 3983 FIX: mssql_instance: Be more robust agains missing instance info in case of
connection issues
Multisite:
* 3974 FIX: Sorting comments in hover menu of comments icon by time now
diff --git a/checks/mssql_instance b/checks/mssql_instance
index dcf87d1..aa584de 100644
--- a/checks/mssql_instance
+++ b/checks/mssql_instance
@@ -47,7 +47,11 @@ def parse_mssql_instance(info):
else:
instance_id = line[0]
- instance = parsed.setdefault(instance_id, {})
+ instance = parsed.setdefault(instance_id, {
+ # it may happen that the state line is missing, add some fallback as default
here
+ "state" : "0",
+ "error_msg" : "Unable to connect to database (Agent reported
no state)",
+ })
if line[1] == "config":
instance.update({
@@ -74,6 +78,8 @@ def check_mssql_instance(item, _unused, parsed):
if not instance:
return
+ print instance
+
if instance["state"] == "0":
yield 2, "Failed to connect to database (%s)" %
instance["error_msg"]