Module: check_mk
Branch: master
Commit: 8d1ec51c36150547ca9a70448d1d2289f00d98fe
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8d1ec51c361505…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Tue Mar 15 10:41:16 2016 +0100
3098 FIX isc_dhcpd: fixed handling of leases that never expire
---
.werks/3098 | 10 ++++++++++
ChangeLog | 1 +
agents/plugins/isc_dhcpd | 9 +++++----
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/.werks/3098 b/.werks/3098
new file mode 100644
index 0000000..f003ada
--- /dev/null
+++ b/.werks/3098
@@ -0,0 +1,10 @@
+Title: isc_dhcpd: fixed handling of leases that never expire
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1458034851
+
+
diff --git a/ChangeLog b/ChangeLog
index e3de1cd..b0a6b2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -78,6 +78,7 @@
* 3006 FIX: agent_vsphere: fixed exception when providing the wrong login
credentials
* 3261 FIX: cisco_temperature: fixed wrong datatype handling
* 3007 FIX: Interface groups: fixed exception when port type or interface items were
not set in the WATO rule...
+ * 3098 FIX: isc_dhcpd: fixed handling of leases that never expire
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/agents/plugins/isc_dhcpd b/agents/plugins/isc_dhcpd
index ef6b6f0..7334858 100755
--- a/agents/plugins/isc_dhcpd
+++ b/agents/plugins/isc_dhcpd
@@ -66,10 +66,11 @@ for line in file(leases_file):
if parts[0] == "lease":
ip_address = parts[1]
elif parts[0] == "ends":
- ends_date_string = parts[2] + " " + parts[3]
- ends_date = calendar.timegm(time.strptime(ends_date_string, "%Y/%m/%d
%H:%M:%S"))
- if ends_date < now:
- ip_address = None # skip this address, this lease is outdated
+ if parts[1] != "never":
+ ends_date_string = parts[2] + " " + parts[3]
+ ends_date = calendar.timegm(time.strptime(ends_date_string, "%Y/%m/%d
%H:%M:%S"))
+ if ends_date < now:
+ ip_address = None # skip this address, this lease is outdated
elif parts[0] == "binding" and parts[1] == "state":
binding_state = parts[2]