Module: check_mk
Branch: master
Commit: d29ed9d0f808cc98c221ce3a4fd404714bdbde06
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d29ed9d0f808cc…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Aug 12 11:35:58 2013 +0200
New option explicit_snmp_communities to override rule based SNMP settings
---
ChangeLog | 1 +
modules/check_mk.py | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 3308240..82a0963 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,7 @@
* Predictive monitoring: correctly handle spaces in variable names (thanks
to Karl Golland)
* New man page browser for console (cmk -m)
+ * New option explicit_snmp_communities to override rule based SNMP settings
* livestatus: new service column staleness: indicator for outdated service checks
* livestatus: new host column staleness: indicator for outdated host checks
diff --git a/modules/check_mk.py b/modules/check_mk.py
index e4142c2..2dad4a8 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -233,6 +233,7 @@ snmp_default_community = 'public'
snmp_communities = []
snmp_timing = []
snmp_character_encodings = []
+explicit_snmp_communities = {} # override the rule based configuration
# Inventory and inventory checks
inventory_check_interval = None # Nagios intervals (4h = 240)
@@ -644,6 +645,11 @@ def snmp_base_command(what, hostname):
# the snmp_default_community is returned (wich is preset with
# "public", but can be overridden in main.mk
def snmp_credentials_of(hostname):
+ try:
+ return explicit_snmp_communities[hostname]
+ except KeyError:
+ pass
+
communities = host_extra_conf(hostname, snmp_communities)
if len(communities) > 0:
return communities[0]