Module: check_mk
Branch: master
Commit: a30f41a768c0a01fa6704d3c027d32c4830ce92f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a30f41a768c0a0…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Apr 2 15:53:25 2015 +0200
winperf_if: output "Teaming Status", not "Group Status"
---
checks/if.include | 28 ++++++++++++++++++----------
checks/winperf_if | 2 +-
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/checks/if.include b/checks/if.include
index d2e81bd..4bc7a38 100644
--- a/checks/if.include
+++ b/checks/if.include
@@ -76,10 +76,16 @@ check_config_variables.append("nagios_illegal_chars")
# Name of state (lookup SNMP enum)
def if_statename(st):
- names = { '1': 'up', '2': 'down',
- '3': 'testing', '4': 'unknown',
- '5': 'dormant', '6': 'notPresent',
- '7': 'lowerLayerDown', '8': 'degraded' }
+ names = {
+ '1': 'up',
+ '2': 'down',
+ '3': 'testing',
+ '4': 'unknown',
+ '5': 'dormant',
+ '6': 'not present',
+ '7': 'lower layer down',
+ '8': 'degraded',
+ }
return names.get(st, st)
def if_extract_node(line, has_nodeinfo):
@@ -337,7 +343,7 @@ def inventory_if_common(info, has_nodeinfo = False):
return inventory
-def check_if_common(item, params, info, has_nodeinfo = False):
+def check_if_common(item, params, info, has_nodeinfo = False, group_name =
"Group"):
# If this item is in an ifgroup create a pseudo interface and pass its data to the
common instance
# This is done by simply adding the additional group_info data to the already
existing info table
if params.get("aggregate"):
@@ -489,11 +495,13 @@ def check_if_common(item, params, info, has_nodeinfo = False):
# If applicable, signal the check_if_common_single if the counter of the
# given interface has wrapped. Actually a wrap of the if group itself is
unlikely,
# however any counter wrap of one of its members causes the accumulation being
invalid
- return check_if_common_single(item, params, [group_entry], wrapped, has_nodeinfo
= has_nodeinfo, group_members = group_members)
+ return check_if_common_single(item, params, [group_entry], wrapped,
+ has_nodeinfo = has_nodeinfo, group_members = group_members,
group_name = group_name)
- return check_if_common_single(item, params, info, has_nodeinfo=has_nodeinfo)
+ return check_if_common_single(item, params, info, has_nodeinfo=has_nodeinfo,
group_name = group_name)
-def check_if_common_single(item, params, info, force_counter_wrap = False, has_nodeinfo =
False, group_members = None):
+def check_if_common_single(item, params, info, force_counter_wrap = False,
+ has_nodeinfo = False, group_members = None, group_name =
"Group"):
# Params now must be a dict. Some keys might
# be set to None
targetspeed = params.get("speed")
@@ -537,7 +545,7 @@ def check_if_common_single(item, params, info, force_counter_wrap =
False, has_n
if if_item_matches(item, ifIndex, ifAlias, ifDescr):
if group_members:
# The detailed group info is added later on
- infotext = "Group Status "
+ infotext = group_name + " Status "
else:
# Display port number or alias in infotext if that is not part
# of the service description anyway
@@ -622,7 +630,7 @@ def check_if_common_single(item, params, info, force_counter_wrap =
False, has_n
# but we spotted devices, which do report error packes even for down
interfaces.
# To deal with it, we simply skip over all performance counter checks for
down
# interfaces.
- if operstatus == "down":
+ if str(ifOperStatus) == "2":
return state, infotext
# Performance counters
diff --git a/checks/winperf_if b/checks/winperf_if
index 2ee7edc..a25fcee 100644
--- a/checks/winperf_if
+++ b/checks/winperf_if
@@ -272,7 +272,7 @@ def inventory_winperf_if(info):
return inventory_if_common(convert_winperf_if(info))
def check_winperf_if(item, params, info):
- return check_if_common(item, params, convert_winperf_if(info))
+ return check_if_common(item, params, convert_winperf_if(info), group_name =
"Teaming")
check_info["winperf_if"] = {