Module: check_mk
Branch: master
Commit: 858fedc6487521f472bf5d9bf7d78c9d728608f3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=858fedc6487521…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Apr 22 13:58:18 2016 +0200
win_dhcp_pools: Cleaned up check a bit
---
checks/win_dhcp_pools | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/checks/win_dhcp_pools b/checks/win_dhcp_pools
index 73f5d24..939ebb1 100644
--- a/checks/win_dhcp_pools
+++ b/checks/win_dhcp_pools
@@ -105,6 +105,7 @@ def inventory_win_dhcp_pools(info):
continue
if in_block:
pool_stats.append(saveint(line[1]))
+
if len(pool_stats) == 3:
in_block = False
used, free, pending = pool_stats
@@ -115,17 +116,19 @@ def inventory_win_dhcp_pools(info):
def check_win_dhcp_pools(item, params, info):
in_block = False
- pool_stats = []
+ pool_stats = [None, None, None]
for line in parse_win_dhcp_pools(info):
if win_dhcp_pools_stats_translate.get(line[0], line[0]) == 'Subnet' and
line[1] == item:
in_block = True
+ pool_stats = []
continue
+
if in_block:
pool_stats.append(saveint(line[1]))
- if len(pool_stats) == 3:
- break
+ if len(pool_stats) == 3:
+ break
- if len(pool_stats) == 3:
+ if all(v is not None for v in pool_stats):
used, free, pending = pool_stats
size = used + free + pending