Module: check_mk
Branch: master
Commit: 0db62899932d2a1863c6819997fcb89f4de3d82e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0db62899932d2a…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Feb 6 12:19:37 2017 +0100
4338 FIX aix_hacmp_resources: fixed state handling
Change-Id: Ie938545a4ce7ccd55e6cfcc365b9824fe2097edf
---
.werks/4338 | 10 ++++++++++
ChangeLog | 1 +
checks/aix_hacmp_resources | 17 +++++++++--------
3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/.werks/4338 b/.werks/4338
new file mode 100644
index 0000000..810e50d
--- /dev/null
+++ b/.werks/4338
@@ -0,0 +1,10 @@
+Title: aix_hacmp_resources: fixed state handling
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i4
+Date: 1486379960
+
+
diff --git a/ChangeLog b/ChangeLog
index 2bc468f..4fd4b22 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -92,6 +92,7 @@
* 4335 FIX: perle check and inventory plugins: some updates and improvements...
NOTE: Please refer to the migration notes!
* 4123 FIX: active check check_sql: changed handling of query results and fixed
hostname parameter...
+ * 4338 FIX: aix_hacmp_resources: fixed state handling
Multisite:
* 4169 View action: Default values of sticky, notification and persistent options can
now be configured via global settings....
diff --git a/checks/aix_hacmp_resources b/checks/aix_hacmp_resources
index f91495a..34fc1d4 100644
--- a/checks/aix_hacmp_resources
+++ b/checks/aix_hacmp_resources
@@ -56,18 +56,19 @@ def inventory_aix_hacmp_resources(parsed):
def check_aix_hacmp_resources(item, params, parsed):
if item in parsed:
resource_stats = []
- infotext = ""
+ infotexts = []
for node_name, resource_status in parsed[item]:
resource_stats.append(resource_status)
- infotext += "%s on node %s, " % (resource_status, node_name)
-
- # The first node is always online in an OK scenario
- # Something is wrong if an other node is online
- state = 0
- if resource_stats[0] != "online":
+ infotexts.append("%s on node %s" % \
+ (resource_status, node_name))
+ if "online" in resource_stats:
+ state = 0
+ elif "error" in resource_stats:
state = 2
+ else:
+ state = 1
- return state, infotext[:-2]
+ return state, "Status: %s" % ", ".join(infotexts)
check_info['aix_hacmp_resources'] = {