Module: check_mk
Branch: master
Commit: 7f57464d0c9573ebd274c1f77d935bbe5b6f1d66
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7f57464d0c9573…
Author: Sebastian Herbord <sh(a)mathias-kettner.de>
Date: Mon Feb 1 14:38:33 2016 +0100
winperf_if: check whether dhcp is enabled (plugin) could crash the check
the crash occured if description/alias was used for the item name
---
checks/winperf_if | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/checks/winperf_if b/checks/winperf_if
index 290465c..b4cf44b 100644
--- a/checks/winperf_if
+++ b/checks/winperf_if
@@ -310,7 +310,13 @@ def check_if_dhcp(item, _no_params, info, nic_names, nic_index):
as_dict = dict(zip(header, map(lambda x: x.rstrip(), line)))
name = winperf_if_normalize_nic_name(as_dict["Description"],
nic_names)
idx = nic_index.get(name)
- if idx == int(item):
+
+ try:
+ match = idx == int(item)
+ except ValueError:
+ match = name == item
+
+ if match:
if as_dict["DHCPEnabled"]:
return 1, "dhcp enabled"
else: