Module: check_mk
Branch: master
Commit: a24caf8de3b68cbc80ea05847817ac8f0a9da7db
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a24caf8de3b68c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Aug 30 11:19:14 2016 +0200
Management board: Fixed fetching SNMP data from board when using inline SNMP
---
modules/check_mk_base.py | 7 +++++--
modules/discovery.py | 4 ++++
modules/snmp.py | 3 ++-
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index 8beb09a..704e71b 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -429,6 +429,7 @@ def get_realhost_info(hostname, ipaddress, check_type, max_cache_age,
table = None
else:
table = get_snmp_table(hostname, ipaddress, check_type, oid_info,
use_snmpwalk_cache)
+
store_cached_checkinfo(hostname, check_type, table)
# only write cache file in non interactive mode. Otherwise it would
# prevent the regular checking from getting status updates during
@@ -1520,9 +1521,11 @@ def do_all_checks_on_host(hostname, ipaddress, only_check_types =
None, fetch_ag
for checkname, item, params, description, aggrname in check_table:
if is_snmp_check(checkname) and is_management_snmp:
- res = execute_check(checkname, item, params, description, aggrname,
management_addr)
+ address = management_address
else:
- res = execute_check(checkname, item, params, description, aggrname,
ipaddress)
+ address = ipaddress
+
+ res = execute_check(checkname, item, params, description, aggrname, address)
if res:
num_success += 1
diff --git a/modules/discovery.py b/modules/discovery.py
index 68c8b9e..add7672 100644
--- a/modules/discovery.py
+++ b/modules/discovery.py
@@ -575,10 +575,12 @@ def get_info_for_discovery(hostname, ipaddress, section_name,
use_caches):
max_cachefile_age = use_caches and inventory_max_cachefile_age or 0
rh_info = get_realhost_info(hostname, ipaddress, section_name, max_cachefile_age,
ignore_check_interval=True, use_snmpwalk_cache=False)
+
if rh_info != None:
info = apply_parse_function(add_nodeinfo(rh_info, section_name), section_name)
else:
info = None
+
if info != None and section_name in check_info and
check_info[section_name]["extra_sections"]:
info = [ info ]
for es in check_info[section_name]["extra_sections"]:
@@ -596,6 +598,7 @@ def get_info_for_discovery(hostname, ipaddress, section_name,
use_caches):
if opt_debug:
raise
info.append(None)
+
return info
def is_ipaddress(address):
@@ -835,6 +838,7 @@ def discover_check_type(hostname, ipaddress, check_type, use_caches,
on_error, u
if use_snmp is None:
use_snmp = is_snmp_host(hostname)
+
# Skip SNMP checks on non-SNMP hosts
if check_uses_snmp(check_type) and not use_snmp:
return []
diff --git a/modules/snmp.py b/modules/snmp.py
index 7c49ede..f67124e 100644
--- a/modules/snmp.py
+++ b/modules/snmp.py
@@ -243,7 +243,8 @@ def perform_snmpwalk(hostname, ip, check_type, base_oid, fetchoid):
for context_name in snmp_contexts:
if is_inline_snmp_host(hostname):
rows = inline_snmpwalk_on_suboid(hostname, check_type, fetchoid, base_oid,
-
context_name=context_name)
+
context_name=context_name,
+ ipaddress=ip)
else:
rows = snmpwalk_on_suboid(hostname, ip, fetchoid, context_name=context_name)