Module: check_mk
Branch: master
Commit: 8fbece99b96b89bc46027e172043b4031a928f34
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8fbece99b96b89…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon May 7 12:58:02 2012 +0200
New configuratin variable snmp_timeout
---
ChangeLog | 4 +++
modules/check_mk.py | 16 ++++++++++++++
web/htdocs/wato.py | 4 +-
web/plugins/wato/check_mk_configuration.py | 30 ++++++++++++++++++++++++++++
4 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0b0bb9b..26d2adf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
1.2.0b4:
+ Core:
+ * New configuration variable snmp_timing, allowing to
+ configure timeout and retries for SNMP requests (also via WATO)
+
WATO:
* ps and ps.perf configurable via WATO now (without inventory)
* FIX: honor folder-permissions when creating, deleting
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 31ed6f8..03d8e14 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -226,6 +226,7 @@ max_num_processes = 50
# SNMP communities and encoding
snmp_default_community = 'public'
snmp_communities = []
+snmp_timing = []
snmp_character_encodings = []
# Inventory and inventory checks
@@ -611,6 +612,14 @@ def snmp_base_command(what, hostname):
# Do not load *any* MIB files. This save lot's of CPU.
options += " -m '' -M ''"
+
+ # Configuration of timing and retries
+ settings = snmp_timing_of(hostname)
+ if "timeout" in settings:
+ options += " -t %d" % settings["timeout"]
+ if "retries" in settings:
+ options += " -r %d" % settings["retries"]
+
return command + ' ' + options
@@ -626,6 +635,13 @@ def snmp_credentials_of(hostname):
# nothing configured for this host -> use default
return snmp_default_community
+def snmp_timing_of(hostname):
+ timing = host_extra_conf(hostname, snmp_timing)
+ if len(timing) > 0:
+ return timing[0]
+ else:
+ return {}
+
def get_snmp_character_encoding(hostname):
entries = host_extra_conf(hostname, snmp_character_encodings)
if len(entries) > 0:
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index a6d167e..4e50688 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -9969,8 +9969,8 @@ def mode_edit_rule(phase):
div_id = "div_all_hosts"
checked = host_list != ALL_HOSTS
- html.checkbox("explicit_hosts", checked,
onclick="valuespec_toggle_option(this, %r)" % div_id)
- html.write(" " + _("Specify explicit host names"))
+ html.checkbox("explicit_hosts", checked,
onclick="valuespec_toggle_option(this, %r)" % div_id,
+ label = _("Specify explicit host names"))
html.write('<div id="%s" style="display: %s">' % (
div_id, not checked and "none" or ""))
negate_hosts = len(host_list) > 0 and host_list[0].startswith("!")
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index 826ed4d..5fa38eb 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -939,6 +939,36 @@ register_rule(group,
"If you want to use SNMP v2c on those devices, nevertheless, then use
this rule set. "
"One reason is enabling 64 bit counters."))
+register_rule(group,
+ "snmp_timing",
+ Dictionary(
+ title = _("Timing settings for SNMP access"),
+ help = _("This rule decides about the number of retries and timeout values
"
+ "for the SNMP access to devices."),
+ elements = [
+ ( "timeout",
+ Integer(
+ title = _("Timeout between retries"),
+ help = _("The default is 1 sec."),
+ default_value = 1,
+ minvalue = 1,
+ maxvalue = 60,
+ unit = _("sec"),
+ ),
+ ),
+ ( "retries",
+ Integer(
+ title = _("Number of retries"),
+ help = _("The default is 5."),
+ default_value = 5,
+ minvalue = 1,
+ maxvalue = 50,
+ )
+ ),
+ ]),
+ match = "dict")
+
+
register_rule(group,
"usewalk_hosts",