Module: check_mk
Branch: master
Commit: d88e0c4d9c4b17cdd1cf9b8358ed765986f4893e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d88e0c4d9c4b17…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Feb 17 15:05:13 2016 +0100
#3226 FIX isc_dhcpd: Fixed exception during discovery when pools can not be gathered by
agent
---
.werks/3226 | 10 ++++++++++
ChangeLog | 1 +
checks/isc_dhcpd | 13 ++++++++++---
3 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/.werks/3226 b/.werks/3226
new file mode 100644
index 0000000..e838f6a
--- /dev/null
+++ b/.werks/3226
@@ -0,0 +1,10 @@
+Title: isc_dhcpd: Fixed exception during discovery when pools can not be gathered by
agent
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1455717894
+
+
diff --git a/ChangeLog b/ChangeLog
index 118ce4d..66dd375 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,6 +29,7 @@
NOTE: Please refer to the migration notes!
* 2993 FIX: zfs_arc_cache: fixed crash, no longer reports unknown if not all data is
available...
* 3188 FIX: ps.include: fixed typo
+ * 3226 FIX: isc_dhcpd: Fixed exception during discovery when pools can not be
gathered by agent
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/checks/isc_dhcpd b/checks/isc_dhcpd
index 106901b..2ebfe16 100644
--- a/checks/isc_dhcpd
+++ b/checks/isc_dhcpd
@@ -46,8 +46,13 @@ isc_dhcpd_default_levels = (15.0, 5.0)
# 10.0.1.57
def parse_isc_dhcpd(info):
- parsed = {}
+ parsed = {
+ "pids" : [],
+ "pools" : [],
+ "leases" : [],
+ }
+ mode = None
for line in info:
if line[0] == '[general]':
mode = "general"
@@ -59,10 +64,12 @@ def parse_isc_dhcpd(info):
elif mode == "general":
if line[0] == "PID:":
parsed["pids"] = map(int, line[1:])
+
elif mode == "pools":
- parsed.setdefault("pools", []).append((line[0], line[1]))
+ parsed["pools"].append((line[0], line[1]))
+
elif mode == "leases":
- parsed.setdefault("leases", []).append(line[0])
+ parsed["leases"].append(line[0])
return parsed