Module: check_mk
Branch: master
Commit: 221cef050095ee3c1020070962d5ae7c444939a5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=221cef050095ee…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed May 20 16:09:57 2015 +0200
#2296 win_dhcp_pools: Convert global option for discovery empty pools into rule set
The selection wether empty DHCP should be discovered has now been moved into
a rule set. If you had set the global option then it is still functioning
and can be overridden on a per-host-basis with rules.
---
.werks/2296 | 11 +++++++++++
ChangeLog | 1 +
checks/win_dhcp_pools | 9 ++++++---
web/plugins/wato/check_mk_configuration.py | 15 ---------------
web/plugins/wato/check_parameters.py | 16 ++++++++++++++++
5 files changed, 34 insertions(+), 18 deletions(-)
diff --git a/.werks/2296 b/.werks/2296
new file mode 100644
index 0000000..6c8051c
--- /dev/null
+++ b/.werks/2296
@@ -0,0 +1,11 @@
+Title: win_dhcp_pools: Convert global option for discovery empty pools into rule set
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1432130938
+Class: feature
+
+The selection wether empty DHCP should be discovered has now been moved into
+a rule set. If you had set the global option then it is still functioning
+and can be overridden on a per-host-basis with rules.
diff --git a/ChangeLog b/ChangeLog
index 0a6494f..be4552e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -188,6 +188,7 @@
* 2232 printer_supply: move setting for "some remaining" status from global
option to check parameters...
* 2293 logwatch: Remove global setting logwatch_service_output from WATO...
* 2294 if, if64: Move global option for padding port numbers with zeroes into
rule...
+ * 2296 win_dhcp_pools: Convert global option for discovery empty pools into rule
set...
* 1457 FIX: logins: new check renamed from "users" check...
NOTE: Please refer to the migration notes!
* 1762 FIX: lnx_thermal: Now ignoring trip points with level 0...
diff --git a/checks/win_dhcp_pools b/checks/win_dhcp_pools
index 081dd64..7adfa42 100644
--- a/checks/win_dhcp_pools
+++ b/checks/win_dhcp_pools
@@ -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>
-
# Example outputs from agent:
#
# <<<win_dhcp_pools>>>
@@ -62,6 +60,7 @@
win_dhcp_pools_default_levels = (10, 5)
win_dhcp_pools_inventorize_empty = False
+discovery_win_dhcp_pools = []
win_dhcp_pools_stats_translate = {
'Entdeckungen': 'Discovers',
@@ -82,6 +81,10 @@ def parse_win_dhcp_pools(info):
return [ ' '.join(line).rstrip('.').split(' = ') for line in
info ]
def inventory_win_dhcp_pools(info):
+ settings = host_extra_conf_merged(g_hostname, discovery_win_dhcp_pools)
+ discover_empty = settings.get("empty_pools",
win_dhcp_pools_inventorize_empty)
+ print discover_empty
+
inventory = []
in_block = False
last_pool = ""
@@ -98,7 +101,7 @@ def inventory_win_dhcp_pools(info):
in_block = False
used, free, pending = pool_stats
size = used + free + pending
- if size > 0 or win_dhcp_pools_inventorize_empty:
+ if size > 0 or discover_empty:
inventory.append((last_pool, 'win_dhcp_pools_default_levels'))
return inventory
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index f635458..359e5f3 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -1434,21 +1434,6 @@ register_configvar(group,
))
-# WAS IST DAS???
-register_configvar(group,
- "win_dhcp_pools_inventorize_empty",
- Checkbox(
- title = _("Inventorize empty windows dhcp pools"),
- help = _("You can activate the inventorization of "
- "dhcp pools, which have no ip addresses in it"),
- ),
- need_restart = True
- )
-
-group = _("Check configuration")
-
-
-
#.
# .--Rulesets------------------------------------------------------------.
# | ____ _ _ |
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 5a5ef10..e0fd84b 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -426,6 +426,22 @@ register_rule(group + '/' + subgroup_inventory,
match = 'all',
)
+register_rule(group + '/' + subgroup_inventory,
+ varname = "discovery_win_dhcp_pools",
+ title = _("Discovery of Windows DHCP Pools"),
+ valuespec = Dictionary(
+ elements = [
+ ( "empty_pools",
+ Checkbox(
+ title = _("Discovery of empty DHCP pools"),
+ label = _("Include empty pools into the monitoring"),
+ help = _("You can activate the creation of services for "
+ "DHCP pools, which contain no IP addresses."),
+ )),
+ ]
+ ),
+ match = 'dict',
+)
register_rule(group + '/' + subgroup_inventory,