Module: check_mk
Branch: master
Commit: e39f93de5607dc0d0d94231e49210aad05317387
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e39f93de5607dc…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Mar 30 11:30:12 2016 +0200
3349 FIX Added rule to disable Inline-SNMP per host
Some SNMP hosts have problems with the Inline-SNMP implemenation. Till this change
it was only possible to enable/disable Inline-SNMP for all hosts at once which was
a bit to unflexible when only a single or some devices have trouble with Inline-SNMP.
---
.werks/3349 | 12 ++++++++++++
ChangeLog | 2 +-
modules/check_mk.py | 14 ++++++++++----
modules/check_mk_base.py | 4 ++--
modules/config.py | 3 +++
modules/nagios.py | 4 ++--
modules/snmp.py | 2 +-
web/plugins/wato/check_mk_configuration.py | 9 +++++++++
8 files changed, 40 insertions(+), 10 deletions(-)
diff --git a/.werks/3349 b/.werks/3349
new file mode 100644
index 0000000..0f3aed8
--- /dev/null
+++ b/.werks/3349
@@ -0,0 +1,12 @@
+Title: Added rule to disable Inline-SNMP per host
+Level: 1
+Component: core
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1459330124
+
+Some SNMP hosts have problems with the Inline-SNMP implemenation. Till this change
+it was only possible to enable/disable Inline-SNMP for all hosts at once which was
+a bit to unflexible when only a single or some devices have trouble with Inline-SNMP.
diff --git a/ChangeLog b/ChangeLog
index 7958693..e99cc25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,7 +11,7 @@
* 3008 FIX: Fixed exception in logwatch config generation when using Nagios...
* 3105 FIX: fixed crash in cmk --dump for services containing non-ascii characters
* 3343 FIX: MKP: Verifying minimal version of packages during installation...
-
+ * 3349 FIX: Added rule to disable Inline-SNMP per host...
Checks & Agents:
* 3183 aruba_wlc_aps: new check which monitors the provisioned accesspoints of an
Aruba Network WLAN Controller
diff --git a/modules/check_mk.py b/modules/check_mk.py
index c9b3d5c..f203315 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -1538,6 +1538,12 @@ def is_snmpv2c_host(hostname):
def is_usewalk_host(hostname):
return in_binary_hostlist(hostname, usewalk_hosts)
+
+def is_inline_snmp_host(hostname):
+ return has_inline_snmp and use_inline_snmp \
+ and not in_binary_hostlist(hostname, non_inline_snmp_hosts)
+
+
def snmp_timing_of(hostname):
timing = host_extra_conf(hostname, snmp_timing)
if len(timing) > 0:
@@ -1711,7 +1717,7 @@ def get_single_oid(hostname, ipaddress, oid):
else:
try:
- if has_inline_snmp and use_inline_snmp:
+ if is_inline_snmp_host(hostname):
value = inline_snmp_get_oid(hostname, oid)
else:
value = snmp_get_oid(hostname, ipaddress, oid)
@@ -3557,7 +3563,7 @@ def do_snmpwalk_on(hostname, filename):
try:
verbose("Walk on \"%s\"..." % oid)
- if has_inline_snmp and use_inline_snmp:
+ if is_inline_snmp_host(hostname):
rows = inline_snmpwalk_on_suboid(hostname, None, oid)
rows = inline_convert_rows_for_stored_walk(rows)
else:
@@ -3746,7 +3752,7 @@ def dump_host(hostname):
if is_usewalk_host(hostname):
agenttypes.append("SNMP (use stored walk)")
else:
- if has_inline_snmp and use_inline_snmp:
+ if is_inline_snmp_host(hostname):
inline = "yes"
else:
inline = "no"
@@ -4567,7 +4573,7 @@ def cleanup_globals():
global g_timeout
g_timeout = None
- if has_inline_snmp and use_inline_snmp:
+ if has_inline_snmp:
cleanup_inline_snmp_globals()
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index feeba70..64a457d 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -1244,7 +1244,7 @@ def do_check(hostname, ipaddress, only_check_types = None):
else:
output += "execution time %.1f sec|execution_time=%.3f\n" % (run_time,
run_time)
- if record_inline_snmp_stats and has_inline_snmp and use_inline_snmp:
+ if record_inline_snmp_stats and is_inline_snmp_host(hostname):
save_snmp_stats()
if opt_keepalive:
@@ -1592,7 +1592,7 @@ def create_crash_dump_info_file(crash_dir, hostname, check_type,
item, params, d
"item" : item,
"params" : params,
"uses_snmp" : check_uses_snmp(check_type),
- "inline_snmp" : has_inline_snmp and use_inline_snmp,
+ "inline_snmp" : is_inline_snmp_host(hostname),
"manual_check" : is_manual_check(hostname, check_type, item),
},
}
diff --git a/modules/config.py b/modules/config.py
index b46450f..0d97d2c 100644
--- a/modules/config.py
+++ b/modules/config.py
@@ -55,6 +55,9 @@ fallback_agent_output_encoding = 'latin1'
# SNMP communities and encoding
has_inline_snmp = False # is set to True by inline_snmp module, when
available
use_inline_snmp = True
+non_inline_snmp_hosts = [] # Ruleset to disable Inline-SNMP per host when
+ # use_inline_snmp is enabled.
+
snmp_limit_oid_range = [] # Ruleset to recduce fetched OIDs of a check,
only inline SNMP
record_inline_snmp_stats = False
snmp_default_community = 'public'
diff --git a/modules/nagios.py b/modules/nagios.py
index bc43972..2b152d1 100644
--- a/modules/nagios.py
+++ b/modules/nagios.py
@@ -1055,7 +1055,7 @@ no_discovery_possible = None
if need_snmp_module:
output.write(stripped_python_file(modules_dir + "/snmp.py"))
- if has_inline_snmp and use_inline_snmp:
+ if is_inline_snmp_host(hostname):
output.write(stripped_python_file(modules_dir +
"/inline_snmp.py"))
output.write("\ndef oid_range_limits_of(hostname):\n return
%r\n" % oid_range_limits_of(hostname))
else:
@@ -1128,7 +1128,7 @@ no_discovery_possible = None
output.write("def is_tcp_host(hostname):\n return % r\n\n" %
is_tcp_host(hostname))
output.write("def is_usewalk_host(hostname):\n return % r\n\n" %
is_usewalk_host(hostname))
output.write("def snmpv3_contexts_of_host(hostname):\n return % r\n\n" %
snmpv3_contexts_of_host(hostname))
- if has_inline_snmp and use_inline_snmp:
+ if is_inline_snmp_host(hostname):
output.write("def is_snmpv2c_host(hostname):\n return % r\n\n" %
is_snmpv2c_host(hostname))
output.write("def is_bulkwalk_host(hostname):\n return % r\n\n" %
is_bulkwalk_host(hostname))
output.write("def snmp_timing_of(hostname):\n return % r\n\n" %
snmp_timing_of(hostname))
diff --git a/modules/snmp.py b/modules/snmp.py
index 6892abd..f7815f5 100644
--- a/modules/snmp.py
+++ b/modules/snmp.py
@@ -235,7 +235,7 @@ def perform_snmpwalk(hostname, ip, check_type, base_oid, fetchoid):
snmp_contexts = [None]
for context_name in snmp_contexts:
- if has_inline_snmp and use_inline_snmp:
+ if is_inline_snmp_host(hostname):
rows = inline_snmpwalk_on_suboid(hostname, check_type, fetchoid, base_oid,
context_name=context_name)
else:
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index ebbeee0..64c783e 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -2097,6 +2097,15 @@ register_rule(group,
match = "dict")
+register_rule(group,
+ "non_inline_snmp_hosts",
+ title = _("Hosts not using Inline-SNMP"),
+ help = _("Check_MK has an efficicient SNMP implementation called Inline-SNMP
which reduces the "
+ "load produced by SNMP monitoring on the monitoring host significant.
This option is "
+ "enabled by default for all SNMP hosts and it is a good idea to keep
this default "
+ "settings. However, there are SNMP devices which have problems with
this SNMP "
+ "implementation. You can use this rule to disable Inline-SNMP for these
hosts."))
+
register_rule(group,
"usewalk_hosts",