Module: check_mk
Branch: master
Commit: 91a2e0c85426a840a09746fe55f36656f719973f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=91a2e0c85426a8…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 9 14:44:59 2014 +0100
#1748 FIX win_dhcp_pools: fix naming of WATO rules and informal WARN/CRIT levels in
performance data
---
.werks/1748 | 9 ++++++++
ChangeLog | 1 +
checks/win_dhcp_pools | 40 ++++++++++++++++++----------------
web/plugins/wato/check_parameters.py | 4 ++--
4 files changed, 33 insertions(+), 21 deletions(-)
diff --git a/.werks/1748 b/.werks/1748
new file mode 100644
index 0000000..b78c2fa
--- /dev/null
+++ b/.werks/1748
@@ -0,0 +1,9 @@
+Title: win_dhcp_pools: fix naming of WATO rules and informal WARN/CRIT levels in
performance data
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i7
+Date: 1418132633
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 1b8acf4..42a2894 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -150,6 +150,7 @@
* 1732 FIX: dell_powerconnect_cpu: Fixed exception during inventory for incompatible
devices
* 1733 FIX: dell_powerconnect_psu: Skipping inventory of not supported System temp
sesnor for M6220 devices...
* 1747 FIX: zfsget: try to speed up agent code for Linux/Solaris/FreeBSD by using -t
filesystem,volume...
+ * 1748 FIX: win_dhcp_pools: fix naming of WATO rules and informal WARN/CRIT levels in
performance data
Multisite:
* 1508 Allow input of plugin output and perfdata when faking check results...
diff --git a/checks/win_dhcp_pools b/checks/win_dhcp_pools
index a64eb27..081dd64 100644
--- a/checks/win_dhcp_pools
+++ b/checks/win_dhcp_pools
@@ -123,25 +123,35 @@ def check_win_dhcp_pools(item, params, info):
if size == 0:
return (3, "DHCP Pool contains no IP addresses / is deactivated")
- if size > 0:
- perc_free = 100.0 * free / size
- else:
- perc_free = 0
+ warn_perc, crit_perc = params
+ warn_abs = size * (warn_perc / 100.0)
+ crit_abs = size * (crit_perc / 100.0)
- if perc_free < params[1]:
+ if free < crit_abs:
status = 2
- elif perc_free < params[0]:
+ elif free < warn_abs:
status = 1
- perfdata = [ ('free', free, params[0], params[1], 0, size),
- ('used', used, None, None, 0, size),
- ('pending', pending, None, None, 0, size) ]
+ perfdata = [ ('free', free, warn_abs, crit_abs, 0, size),
+ ('used', used, None, None, 0, size),
+ ('pending', pending, None, None, 0, size) ]
- return (status, 'Addresses Free: %d, Used: %d, Pending: %d' %
- (free, used, pending), perfdata)
+ infotext = 'Addresses Free: %d, Used: %d, Pending: %d' % (free, used,
pending)
+ if status:
+ infotext += " (levels at %d/%d)" % (warn_abs, crit_abs)
+ return status, infotext, perfdata
else:
return (3, 'Pool information not found')
+check_info["win_dhcp_pools"] = {
+ 'check_function': check_win_dhcp_pools,
+ 'inventory_function': inventory_win_dhcp_pools,
+ 'service_description': 'DHCP Pool %s',
+ 'has_perfdata': True,
+ 'group': 'win_dhcp_pools',
+}
+
+
def inventory_win_dhcp_pools_stats(info):
return [ (None, None) for line in info if line[0] != '' ]
@@ -166,14 +176,6 @@ def check_win_dhcp_pools_stats(item, params, info):
return 0, output.rstrip(', '), perfdata
-check_info["win_dhcp_pools"] = {
- 'check_function': check_win_dhcp_pools,
- 'inventory_function': inventory_win_dhcp_pools,
- 'service_description': 'DHCP Pool %s',
- 'has_perfdata': True,
- 'group': 'win_dhcp_pools',
-}
-
check_info["win_dhcp_pools.stats"] = {
'check_function': check_win_dhcp_pools_stats,
'inventory_function': inventory_win_dhcp_pools_stats,
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index dc01fd8..d5ff0e4 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -4219,8 +4219,8 @@ register_check_parameters(
help = _("The count of remaining entries in the DHCP pool represents
"
"the number of IP addresses left which can be assigned in the
network"),
elements = [
- Percentage(title = _("Warning if more than"), unit = _("pool
entries")),
- Percentage(title = _("Critical if more than"), unit =
_("pool entries")),
+ Percentage(title = _("Warning if less than"), unit = _("%
free pool entries")),
+ Percentage(title = _("Critical if less than"), unit = _("%
free pool entries")),
]),
TextAscii(
title = _("Service descriptions"),