Module: check_mk
Branch: master
Commit: 72f467acf224b2144fa0fb3ac23228c49172cfe1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=72f467acf224b2…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Thu Mar 7 15:02:30 2019 +0100
if.include: refactor III
Move two functions and inline if64adm
Change-Id: I569af78ccc3890570eebb6e4d7b12fcc17454b28
---
checks/if.include | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/checks/if.include b/checks/if.include
index 6739404..323c57c 100644
--- a/checks/if.include
+++ b/checks/if.include
@@ -73,13 +73,24 @@ def has_ifHCInOctets(oid):
return bool(oid(".1.3.6.1.2.1.31.1.1.1.6.*"))
+def if64_disabled(hostname):
+ return in_binary_hostlist(hostname, if_disable_if64_hosts)
+
+
+def need_if64adm():
+ settings = host_extra_conf_merged(host_name(), inventory_if_rules)
+ return "portstates" in settings and '9' in
settings["portstates"]
+
+
def snmp_scan_function_if_brocade(oid):
return "Brocade VDX Switch" in oid(".1.3.6.1.2.1.1.1.0") and (not
if64_disabled(
host_name())) and has_ifHCInOctets(oid)
def snmp_scan_function_if64adm(oid):
- return if64_scan_function(oid, True)
+ if if64_disabled(host_name()) or not need_if64adm():
+ return False
+ return has_ifHCInOctets(oid)
def snmp_scan_function_adva_fsp_if(oid):
@@ -119,15 +130,6 @@ def snmp_scan_function_if(oid):
return if64_disabled(host_name()) or not has_ifHCInOctets(oid)
-def if64_disabled(hostname):
- return in_binary_hostlist(hostname, if_disable_if64_hosts)
-
-
-def need_if64adm():
- settings = host_extra_conf_merged(host_name(), inventory_if_rules)
- return "portstates" in settings and '9' in
settings["portstates"]
-
-
def if64_scan_function(oid, use_if64adm=False):
if any((
if64_disabled(host_name()),