Module: check_mk
Branch: master
Commit: 59f9eede8ab8dab32d5e192f7f5cb26e4ba3cb85
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=59f9eede8ab8da…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jul 4 22:03:38 2017 +0200
4937 SNMP bulk walk: Size of bulks can now be configured
When communicating with hosts using SNMP bulk walks the requested
bulks had a fixed maximum size of 10 OIDs. This can now be configured
using the ruleset "Bulk walk: Number of OIDs per bulk".
Change-Id: Ia1f9225a3d5dfe21d8c810ef2ee93a19daf3a128
---
.werks/4937 | 12 ++++++++++++
cmk_base/classic_snmp.py | 5 ++++-
cmk_base/config.py | 8 ++++++++
cmk_base/default_config/base.py | 1 +
web/plugins/wato/check_mk_configuration.py | 21 ++++++++++++++++++++-
5 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/.werks/4937 b/.werks/4937
new file mode 100644
index 0000000..f3195d0
--- /dev/null
+++ b/.werks/4937
@@ -0,0 +1,12 @@
+Title: SNMP bulk walk: Size of bulks can now be configured
+Level: 1
+Component: core
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1499198496
+Class: feature
+
+When communicating with hosts using SNMP bulk walks the requested
+bulks had a fixed maximum size of 10 OIDs. This can now be configured
+using the ruleset "Bulk walk: Number of OIDs per bulk".
diff --git a/cmk_base/classic_snmp.py b/cmk_base/classic_snmp.py
index 1afb356..82cff9f 100644
--- a/cmk_base/classic_snmp.py
+++ b/cmk_base/classic_snmp.py
@@ -182,16 +182,19 @@ def _snmp_walk_command(hostname):
# (5) privacy protocol (DES|AES) (-x)
# (6) privacy protocol pass phrase (-X)
def _snmp_base_command(what, hostname):
+ options = []
+
if what == 'get':
command = [ 'snmpget' ]
elif what == 'getnext':
command = [ 'snmpgetnext', '-Cf' ]
elif config.is_bulkwalk_host(hostname):
command = [ 'snmpbulkwalk' ]
+
+ options.append("-Cr%d" % config.bulk_walk_size_of(hostname))
else:
command = [ 'snmpwalk' ]
- options = []
credentials = config.snmp_credentials_of(hostname)
if type(credentials) in [ str, unicode ]:
diff --git a/cmk_base/config.py b/cmk_base/config.py
index 05298b5..77623a6 100644
--- a/cmk_base/config.py
+++ b/cmk_base/config.py
@@ -756,6 +756,14 @@ def is_bulkwalk_host(hostname):
return False
+def bulk_walk_size_of(hostname):
+ bulk_sizes = rulesets.host_extra_conf(hostname, snmp_bulk_size)
+ if not bulk_sizes:
+ return 10
+ else:
+ return bulk_sizes[0]
+
+
def is_snmpv2c_host(hostname):
return is_bulkwalk_host(hostname) or \
rulesets.in_binary_hostlist(hostname, snmpv2c_hosts)
diff --git a/cmk_base/default_config/base.py b/cmk_base/default_config/base.py
index ef4cbdc..e78b6b9 100644
--- a/cmk_base/default_config/base.py
+++ b/cmk_base/default_config/base.py
@@ -68,6 +68,7 @@ non_inline_snmp_hosts = [] # Ruleset to disable Inline-SNMP
per hos
# use_inline_snmp is enabled.
snmp_limit_oid_range = [] # Ruleset to recduce fetched OIDs of a check,
only inline SNMP
+snmp_bulk_size = [] # Ruleset to customize bulk size
record_inline_snmp_stats = False
snmp_default_community = 'public'
snmp_communities = []
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index 1cb61fb..aa91c4a 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -2348,7 +2348,7 @@ register_rule(group,
register_rule(group,
"bulkwalk_hosts",
- title = _("Hosts using SNMP bulk walk (enforces SNMP v2c)"),
+ title = _("Bulk walk: Hosts using bulk walk (enforces SNMP v2c)"),
help = _("Most SNMP hosts support SNMP version 2c. However, Check_MK defaults to
version 1, "
"in order to support as many devices as possible. Please use this
ruleset in order "
"to configure SNMP v2c for as many hosts as possible. That version has
two advantages: "
@@ -2358,6 +2358,25 @@ register_rule(group,
"bulk walk but behave very bad when it is used. When you want to enable
v2c while not using "
"bulk walk, please use the rule set snmpv2c_hosts instead."))
+
+register_rule(group,
+ "snmp_bulk_size",
+ Integer(
+ title = _("Bulk walk: Number of OIDs per bulk"),
+ label = _("Number of OIDs to request per bulk: "),
+ minvalue = 10,
+ maxvalue = 100,
+ default_value = 10,
+ ),
+ help = _("This variable allows you to configure the numbr of OIDs Check_MK
should request "
+ "at once. This rule only applies to SNMP hosts that are configured to
be bulk walk "
+ "hosts."
+ "You may want to use this rule to tune SNMP performance. Be aware: A
higher value "
+ "is not always better. It may decrease the transactions between
Check_MK and the "
+ "target system, but may increase the OID overhead in case you only need
a small "
+ "amount of OIDs."),
+)
+
register_rule(group,
"snmp_without_sys_descr",
title = _("Hosts without system description OID"),