Module: check_mk
Branch: master
Commit: 3d768877d284ad19bc836315220224306421b99e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3d768877d284ad…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sat Nov 6 11:09:08 2010 +0100
snmp_communites now must be a dict
---
ChangeLog | 2 ++
LIESMICH.zutun | 4 ----
modules/check_mk.py | 20 ++++++++------------
3 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8f924a9..34c5822 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,8 @@
* aggregation_output_format now defaults to "multiline"
* Removed non_bulkwalk_hosts. You can use bulkwalk_hosts with NEGATE
instead (see docu)
+ * snmp_communites is now initialized with [], not with {}. It cannot
+ be a dict any longer.
Core, Setup, etc.:
* Improve error handling: if hosts are monitored with SNMP *and* TCP,
diff --git a/LIESMICH.zutun b/LIESMICH.zutun
index a4235f5..b955bd2 100644
--- a/LIESMICH.zutun
+++ b/LIESMICH.zutun
@@ -94,10 +94,6 @@ auftritt.
nur noch ohne MIB-Dateien. Das würde das ganze deutlich vereinfachen!
Direct rrd updates ganz entfernen.
-snmp_communities: dictionary nicht mehr verwenden, aus Doku raus, Defaultwert
-leere Liste, aus Code raus, Hinweis im ChangeLog. Evtl einen Test mit
-Abbruch, wenn immer noch type ist dict. Gleiches für bulkwalk_hosts
-
IDEE: Scan-Modus: Wenn man einen Host per SNMP scannt und *keine*
Antwort kommt, dann probiert man einfach alle SNMP-Checks aus.
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 111336e..cf8ebc2 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -214,7 +214,7 @@ max_num_processes = 50
# SNMP communities
snmp_default_community = 'public'
-snmp_communities = {}
+snmp_communities = []
# Inventory and inventory checks
inventory_check_interval = None # Nagios intervals (4h = 240)
@@ -587,16 +587,9 @@ 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):
- # Keep up old behaviour for a while...
- if type(snmp_communities) == dict:
- for com, hostlist in snmp_communities.items():
- if hostname in strip_tags(hostlist):
- return com
-
- else:
- communities = host_extra_conf(hostname, snmp_communities)
- if len(communities) > 0:
- return communities[0]
+ communities = host_extra_conf(hostname, snmp_communities)
+ if len(communities) > 0:
+ return communities[0]
# nothing configured for this host -> use default
return snmp_default_community
@@ -3462,8 +3455,11 @@ if opt_config_check:
if filesystem_levels != []:
sys.stderr.write("WARNING: filesystem_levels is deprecated and will be
removed\n"
"any decade now. Please use check_parameters instead! Details can
be\n"
- "found at
http://mathias-kettner.de/checkmk_check_parameters.html.\n")uot;);
+ "found at
http://mathias-kettner.de/checkmk_check_parameters.html.\n")
+ if type(snmp_communities) == dict:
+ sys.stderr.write("ERROR: snmp_communities cannot be a dict any
more.\n")
+ errors += 1
if errors > 0:
sys.stderr.write("--> Found %d invalid variables\n" % errors)