Module: check_mk
Branch: master
Commit: 18c52e6b7f27036bcb7ca97fdb24c3607c8b1ccb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=18c52e6b7f2703…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Jan 28 15:01:58 2015 +0100
#1929 netapp_api_if: improved inventory and check output of virtual interfaces
The netapp_api_if check now uses the common inventory function, which is used
by most of the other inventory checks. This allows you to choose which port states
to monitor and set whether the interface should use the interface description as service
name
---
.werks/1929 | 12 ++++++++++++
ChangeLog | 7 ++++---
checkman/netapp_api_if | 4 ++++
checks/netapp_api_if | 15 ++++++++++-----
4 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/.werks/1929 b/.werks/1929
new file mode 100644
index 0000000..41689d2
--- /dev/null
+++ b/.werks/1929
@@ -0,0 +1,12 @@
+Title: netapp_api_if: improved inventory and check output of virtual interfaces
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1422453295
+Class: feature
+
+The netapp_api_if check now uses the common inventory function, which is used
+by most of the other inventory checks. This allows you to choose which port states
+to monitor and set whether the interface should use the interface description as service
name
+
diff --git a/ChangeLog b/ChangeLog
index 381556e..afa4d95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -57,10 +57,11 @@
* 1920 df: Linux filesystem check now supports displaying data reserved for root...
* 1675 esx_vsphere_hostsystem.cpu_util_cluster: Averaged CPU utilization of all
cluster nodes...
* 1216 hp_procurve_cpu: Can now be configured with Wato
- * 1217 dell_om_sensors: Check now uses generic temperature template...
- NOTE: Please refer to the migration notes!
* 1676 if.include: now able to detect grouped interfaces...
* 1928 netapp_api_if: Improved handling and check output of virtual interfaces...
+ * 1217 dell_om_sensors: Check now uses generic temperature template...
+ NOTE: Please refer to the migration notes!
+ * 1929 netapp_api_if: improved inventory and check output of virtual interfaces...
* 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...
@@ -114,8 +115,8 @@
* 1858 FIX: docsis_channels_downstream: allow for negative values of power in dBm
* 1847 FIX: oracle_logswitches: Fixed description of WATO rule for levels...
* 1877 FIX: printer_input/printer_output: Check can now handle non reported capacity
unit
- * 1859 FIX: cups_queues: linux agent now runs section cups_queues in cached mode...
* 1921 FIX: kemp_loadmaster_realserver: reimplementation, now use vendor specific
information
+ * 1859 FIX: cups_queues: linux agent now runs section cups_queues in cached mode...
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request,
added mailto link for error report...
diff --git a/checkman/netapp_api_if b/checkman/netapp_api_if
index d1d29e4..46e7ff3 100644
--- a/checkman/netapp_api_if
+++ b/checkman/netapp_api_if
@@ -27,6 +27,10 @@ description:
in bytes. If you have configured traffic levels, then those levels are
applied to the averaged values.
+ It might be a good idea to use the option "Use description as service name
+ for network interface checks", since there is no real interface index available
+ and can change over time.
+
item:
There are three allowed ways to specify a port: {1}: the index of the interface
(depends on the order of the data reported by the agent), the {ifDescr} of
diff --git a/checks/netapp_api_if b/checks/netapp_api_if
index c89582c..e6de141 100644
--- a/checks/netapp_api_if
+++ b/checks/netapp_api_if
@@ -60,7 +60,8 @@ def netapp_convert_to_if64(info):
interfaces = parsed_data.get("net-ifconfig-get")
# Calculate speed, state and create mac-address list
- if_mac_list = {}
+ if_mac_list = {} # Dictionary with lists of common mac addresses
+ vif_list = [] # List of virtual interfaces
for name, values in interfaces.items():
mediatype = values.get("mediatype")
if mediatype:
@@ -74,8 +75,13 @@ def netapp_convert_to_if64(info):
speed = 10000000000
elif "10" in mediatype:
speed = 10000000
+ else:
+ speed = 0
values["speed"] = speed
values["state"] = tokens[-1].lower() == "up" and
"1" or "2"
+ elif values.get("port-role") != "storage-acp":
+ # If an interface has no media type and is not a storage-acp it is considered
as virtual interface
+ vif_list.append(name)
if "mac-address" in values:
if_mac_list.setdefault(values["mac-address"], [])
if_mac_list[values["mac-address"]].append(name)
@@ -101,7 +107,7 @@ def netapp_convert_to_if64(info):
mac_list = if_mac_list[values["mac-address"]]
if len(mac_list) > 1: # check if this interface is grouped
extra_info.setdefault(nic_name, {})
- extra_info[nic_name]["grouped_if"] = mac_list
+ extra_info[nic_name]["grouped_if"] = [ x for x in mac_list
if x not in vif_list ]
for tmp_if in mac_list:
if tmp_if == nic_name:
@@ -129,7 +135,7 @@ def netapp_convert_to_if64(info):
mac = ''
nic = ['0'] * 20
- nic[0] = idx + 1 # Index
+ nic[0] = str(idx + 1) # Index
nic[1] = nic_name # Description
nic[2] = "6" # Fake ethernet # Type
nic[3] = speed # Speed
@@ -158,8 +164,7 @@ def netapp_convert_to_if64(info):
def inventory_netapp_api_if(parsed):
nics, extra_info = parsed
- for entry in nics:
- yield entry[1], None
+ return inventory_if_common(nics)
def check_netapp_api_if(item, params, parsed):
nics, extra_info = parsed