Module: check_mk
Branch: master
Commit: 9f95fccaf81ede1cd8d99c22c980bf491bb1bca9
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9f95fccaf81edeā¦
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Nov 6 15:25:42 2015 +0100
#2753 FIX ad_replication: Made check more robust agains garbled agent output
---
.werks/2753 | 9 +++++++++
ChangeLog | 1 +
checks/ad_replication | 14 ++++++++++----
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/.werks/2753 b/.werks/2753
new file mode 100644
index 0000000..356c760
--- /dev/null
+++ b/.werks/2753
@@ -0,0 +1,9 @@
+Title: ad_replication: Made check more robust agains garbled agent output
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1446819933
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index f51e4ca..2c2d289 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -56,6 +56,7 @@
* 2730 FIX: if64: Grouping of interfaces resulted in an exception...
* 2741 FIX: isc_dhcpd: Fix problem where outdated leases where counted as active
* 2731 FIX: smart.temp: Handles case of missing temperature values correctly
+ * 2753 FIX: ad_replication: Made check more robust agains garbled agent output
Multisite:
* 2684 Added icons for downloading agent data / walks of hosts...
diff --git a/checks/ad_replication b/checks/ad_replication
index 9f19c93..ed68ed7 100644
--- a/checks/ad_replication
+++ b/checks/ad_replication
@@ -24,8 +24,6 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-# Author: Lars Michelsen <lm(a)mathias-kettner.de>
-
# <<<ad_replication>>>
# showrepl_COLUMNS,Destination DC Site,Destination DC,Naming Context,Source DC
Site,Source DC,\
#Transport Type,Number of Failures,Last Failure Time,Last Success Time,Last Failure
Status
@@ -46,8 +44,12 @@ def parse_ad_replication_dates(s):
def parse_ad_replication_info(info):
lines = []
- for l in [ ' '.join(line).replace(',CN=',
';CN=').replace(',DC=', ';DC=') for line in info ]:
- lines.append(l.split(','))
+ for line_parts in info:
+ # Make lines split by , instead of spaces
+ line_txt = ' '.join(line_parts).replace(',CN=',
';CN=').replace(',DC=', ';DC=')
+ line_parts = line_txt.split(',')
+ if len(line_parts) in [ 11, 10 ]:
+ lines.append(line_parts)
return lines
def inventory_ad_replication(info):
@@ -59,6 +61,8 @@ def inventory_ad_replication(info):
elif len(line) == 10:
source_site = line[3]
source_dc = line[4]
+ else:
+ break # unhandled data
entry = ('%s/%s' % (source_site, source_dc),
'ad_replication_default_params')
if line[0] == 'showrepl_INFO' and entry not in inv:
inv.append(entry)
@@ -78,6 +82,8 @@ def check_ad_replication(item, params, info):
(lineType, destSite, naming_context, source_site, source_dc,
transport, num_failures, time_last_failure, time_last_success,
statusLastFailure ) = l
+ else:
+ break # unhandled data
if lineType == 'showrepl_INFO' and source_site+'/'+source_dc ==
item:
foundLine = True