Module: check_mk
Branch: master
Commit: 0bbff761d27d14ec01fb49899b153e82f8e80c18
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0bbff761d27d14…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sat Nov 6 12:32:52 2010 +0100
--snmpwalk: do not translate, directly use numeric values
All checks are now only using numeric values. No mibs are
loaded in any case anyway.
---
ChangeLog | 2 ++
LIESMICH.zutun | 13 -------------
modules/check_mk.py | 7 +++----
modules/snmp.py | 12 ------------
4 files changed, 5 insertions(+), 29 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index cd99896..8be561a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,6 +31,8 @@
* Make sure, host has no duplicate service - this is possible e.g. by
monitoring via agent and snmp in parallel. duplicate services will
make Nagios reject the configuration.
+ * --snmpwalk: do not translate anymore, use numbers. All checks work
+ with numbers now anyway.
Checks & Agents:
* megaraid_pdisks: Using the real enclosure number as check item now
diff --git a/LIESMICH.zutun b/LIESMICH.zutun
index a4f1d1b..48f8913 100644
--- a/LIESMICH.zutun
+++ b/LIESMICH.zutun
@@ -63,10 +63,6 @@ springt dann immer nach ganz oben.
LARS: Im Opera wird sich die aktuelle Scroll-Position der Sidebar nicht korrekt gemerkt.
-SNMP-Checks: Es wurde berichtet, dass - wenn die Community falsch ist -
-der Check_MK gruen war, aber die Checks unknown. Sollte es dann nicht
-genau umgekehrt sein? Wird der Exit-code von snmpwalk ausgewertet?
-
LARS: Wenn man gerade die Kommandobox auf hat (oder den Filter?) dann sollte
kein Refresh stattfinden. Sonst wird man mitten im Tippen abgewürgt. Kann man
das mit Javascript hinbekommen? (kann Lars sich hier was überlegen? Man
@@ -84,10 +80,6 @@ getrennte Checks für Memory and Pagefile.
-------------------------------------------------------------------------------
ab 1.1.9i1:
--------------------------------------------------------------------------------
---snmpwalk: Braucht man das translaten noch? Ich arbeite doch jetzt eh
-nur noch ohne MIB-Dateien. Das würde das ganze deutlich vereinfachen!
-Direct rrd updates ganz entfernen.
-
IDEE: Scan-Modus: Wenn man einen Host per SNMP scannt und *keine*
Antwort kommt, dann probiert man einfach alle SNMP-Checks aus.
@@ -128,11 +120,6 @@ Multisite: Zeitanzeige der Downtimes (ende) zu ungenau. "in 6 hrs" ist
blöd. Auch bei Start "19 sec" ist dumm, hier wäre besser (vor 19 sec). Oder
bei Downtimes immer absolute Zeiten angeben? Evtl. Zusatzspalte der Duration.
-bulkwalk_hosts: Hier ist der Default None und nicht []. Problem dabei
-ist, dass dann ein += nicht funktioniert. Kann man nicht non_bulkwalk_hosts
-ganz rausschmeissen und bulkwalk_hosts auf [] setzen? Ausserdem gibt
-es ja fuer binaere Hostlisten das NEGATE (=> Doku). In 1.2 einbauen.
-
--------------------------------------------------------------------------------
IDEEN & VERBESSERUNGEN
--------------------------------------------------------------------------------
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 1558007..b77d01f 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -2637,7 +2637,7 @@ def do_snmpwalk_on(hostname, filename):
if opt_verbose:
sys.stdout.write("%s:\n" % hostname)
ip = lookup_ipaddress(hostname)
- cmd = snmp_walk_command(hostname) + " -Ob -OQ %s " % ip
+ cmd = snmp_walk_command(hostname) + " -On -Ob -OQ %s " % ip
if opt_debug:
print 'Executing: %s' % cmd
out = file(filename, "w")
@@ -2665,9 +2665,8 @@ def do_snmpwalk_on(hostname, filename):
oid = oid[1:]
oids.append(oid)
values.append(value)
- numoids = snmptranslate(oids)
- for numoid, value in zip(numoids, values):
- out.write("%s %s\n" % (numoid, value.strip()))
+ for oid, value in zip(oids, values):
+ out.write("%s %s\n" % (oid, value.strip()))
count += 1
if opt_verbose:
sys.stdout.write("%d variables.\n" % count)
diff --git a/modules/snmp.py b/modules/snmp.py
index ea45083..47d9904 100644
--- a/modules/snmp.py
+++ b/modules/snmp.py
@@ -337,18 +337,6 @@ def check_snmp_fixed(item, targetvalue, info):
return (0, "OK - %s" % (value,))
return (3, "Missing item %s in SNMP data" % item)
-def snmptranslate(oids):
- numoids = []
- while len(oids) > 0:
- m = min(len(oids), 100)
- cmd = "snmptranslate -On %s 2>/dev/null" % " ".join(["'%s'" % o.strip() for o in oids[:m]])
- n = os.popen(cmd).read().split()
- if len(n) != m:
- raise MKGeneralException("snmptranslated lost %d out of %d oids" % (m - len(n), m))
- oids = oids[m:]
- numoids += n
- return numoids
-
def get_stored_snmpwalk(hostname, oid):
if oid.startswith("."):
oid = oid[1:]
Module: check_mk
Branch: master
Commit: f54b0d6f197957b443c64f00006b7612c345bcae
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f54b0d6f197957…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sat Nov 6 12:25:02 2010 +0100
Always make implicity config check -X
---
ChangeLog | 3 +++
LIESMICH.zutun | 3 ---
modules/check_mk.py | 49 ++++++++++++++++++++++---------------------------
3 files changed, 25 insertions(+), 30 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 53c5e4f..cd99896 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,9 @@
be a dict any longer.
* bulkwalk_hosts is now initizlized with []. You can do += here just
is with all other rule variables.
+ * Configuration check (-X) is now always done. It is now impossible to
+ call any Check_MK action with an invalid configuration. This saves
+ you agains mistyped variables.
Core, Setup, etc.:
* Improve error handling: if hosts are monitored with SNMP *and* TCP,
diff --git a/LIESMICH.zutun b/LIESMICH.zutun
index 6e83eb1..a4f1d1b 100644
--- a/LIESMICH.zutun
+++ b/LIESMICH.zutun
@@ -84,9 +84,6 @@ getrennte Checks für Memory and Pagefile.
-------------------------------------------------------------------------------
ab 1.1.9i1:
--------------------------------------------------------------------------------
-check_mk -X erzwingen. Das -R soll nur noch klappen, wenn kein Configfehler
-auftritt.
-
--snmpwalk: Braucht man das translaten noch? Ich arbeite doch jetzt eh
nur noch ohne MIB-Dateien. Das würde das ganze deutlich vereinfachen!
Direct rrd updates ganz entfernen.
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 5f75973..1558007 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -37,11 +37,9 @@ check_mk_version = '(inofficial)'
if __name__ == "__main__":
opt_verbose = '-v' in sys.argv[1:] or '--verbose' in sys.argv[1:]
opt_debug = '--debug' in sys.argv[1:]
- opt_config_check = '-X' in sys.argv[1:] or '--config-check' in sys.argv[1:]
else:
opt_verbose = False
opt_debug = False
- opt_config_check = False
# are we running OMD? If yes, honor local/ hierarchy
omd_root = os.getenv("OMD_ROOT", None)
@@ -3378,8 +3376,7 @@ def ip_to_hostname(ip):
def all_nonfunction_vars():
return set([ name for name,value in globals().items() if name[0] != '_' and type(value) != type(lambda:0) ])
-if opt_config_check:
- vars_before_config = all_nonfunction_vars()
+vars_before_config = all_nonfunction_vars()
list_of_files = [ check_mk_configfile ] + glob.glob(check_mk_configdir + '/*.mk')
@@ -3463,31 +3460,29 @@ if __name__ == "__main__":
checks = autochecks + checks
-
-if opt_config_check:
- vars_after_config = all_nonfunction_vars()
- ignored_variables = set(['vars_before_config', 'rrdtool', 'final_mk', 'list_of_files', 'autochecks',
- 'parts' ,'hosttags' ,'seen_hostnames' ,'all_hosts_untagged' ,'taggedhost' ,'hostname'])
- errors = 0
- for name in vars_after_config:
- if name not in ignored_variables and name not in vars_before_config:
- sys.stderr.write("Invalid configuration variable '%s'\n" % name)
- errors += 1
-
- # Special handling for certain deprecated variables
- 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")
-
- if type(snmp_communities) == dict:
- sys.stderr.write("ERROR: snmp_communities cannot be a dict any more.\n")
+vars_after_config = all_nonfunction_vars()
+ignored_variables = set(['vars_before_config', 'rrdtool', 'final_mk', 'list_of_files', 'autochecks',
+ 'parts' ,'hosttags' ,'seen_hostnames' ,'all_hosts_untagged' ,'taggedhost' ,'hostname'])
+errors = 0
+for name in vars_after_config:
+ if name not in ignored_variables and name not in vars_before_config:
+ sys.stderr.write("Invalid configuration variable '%s'\n" % name)
errors += 1
- if errors > 0:
- sys.stderr.write("--> Found %d invalid variables\n" % errors)
- sys.stderr.write("If you use own helper variables, please prefix them with _.\n")
- sys.exit(1)
+# Special handling for certain deprecated variables
+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")
+
+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)
+ sys.stderr.write("If you use own helper variables, please prefix them with _.\n")
+ sys.exit(1)
# Convert www_group into numeric id
Module: check_mk
Branch: master
Commit: 84776aa08638776b06d6a9f21ea2bad781849a3f
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=84776aa0863877…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sat Nov 6 11:56:10 2010 +0100
check for duplicate service descriptions
---
ChangeLog | 3 +++
LIESMICH.zutun | 3 ---
modules/check_mk.py | 23 +++++++++++++++++++++++
3 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0d46dd5..53c5e4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,9 @@
is called from another directory)
* ALL_SERVICES: Instead of [ "" ] you can now write ALL_SERVICES
* debug_log: also output Check_MK version, check item and check parameters
+ * Make sure, host has no duplicate service - this is possible e.g. by
+ monitoring via agent and snmp in parallel. duplicate services will
+ make Nagios reject the configuration.
Checks & Agents:
* megaraid_pdisks: Using the real enclosure number as check item now
diff --git a/LIESMICH.zutun b/LIESMICH.zutun
index b955bd2..6e83eb1 100644
--- a/LIESMICH.zutun
+++ b/LIESMICH.zutun
@@ -4,9 +4,6 @@ Doku: Check_MK und OMD: Installieren von MKPs, local-Hierarchie
--------------------------------------------------------------------------------
BUGS beheben ab 1.1.9i1
--------------------------------------------------------------------------------
-Wenn zwei Checks mit dem gleichen Namen existieren bei einem Host
-soll mit einem Fehler abgebrochen werden.
-
ich bin mir nicht sicher ob das nun ein Thruk Problem oder ein Livestatus Problem ist. Vermutlich beides :-)
Wenn ich im Thruk im Suchfenster einfach Enter drücke, kommt folgende Query bei raus:
GET services
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 8da1029..5f75973 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -1292,7 +1292,19 @@ def create_nagios_servicedefs(outfile, hostname):
aggregated_services_conf = set([])
do_aggregation = host_is_aggregated(hostname)
have_at_least_one_service = False
+ used_descriptions = {}
for ((checkname, item), (params, description, deps)) in host_checks:
+ # Make sure, the service description is unique on this host
+ if description in used_descriptions:
+ cn, it = used_descriptions[description]
+ raise MKGeneralException(
+ "ERROR: Duplicate service description '%s' for host '%s'!\n"
+ " - 1st occurrance: checktype = %s, item = %r\n"
+ " - 2nd occurrance: checktype = %s, item = %r\n" %
+ (description, hostname, cn, it, checkname, item))
+
+ else:
+ used_descriptions[description] = ( checkname, item )
if have_perfdata(checkname):
template = passive_service_template_perf
else:
@@ -1420,6 +1432,17 @@ define servicedependency {
if len(legchecks) > 0:
outfile.write("\n\n# Legacy checks\n")
for command, description, has_perfdata in legchecks:
+ if description in used_descriptions:
+ cn, it = used_descriptions[description]
+ raise MKGeneralException(
+ "ERROR: Duplicate service description (legacy check) '%s' for host '%s'!\n"
+ " - 1st occurrance: checktype = %s, item = %r\n"
+ " - 2nd occurrance: checktype = legacy(%s), item = None\n" %
+ (description, hostname, cn, it, command))
+
+ else:
+ used_descriptions[description] = ( "legacy(" + command + ")", item )
+
extraconf = extra_service_conf_of(hostname, description)
if has_perfdata:
template = "check_mk_perf,"
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");
+ "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)
Module: check_mk
Branch: master
Commit: 0e30525fcef8f1c55be4e6b418c9ec8c05b670a2
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0e30525fcef8f1…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sat Nov 6 10:37:40 2010 +0100
aggregation_output_format now defaults to multiline
---
ChangeLog | 3 ++-
LIESMICH.zutun | 2 --
modules/check_mk.py | 2 +-
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b0d938b..11fac0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,7 +13,8 @@
* perfdata_format now defaults to "pnp". Previous default was "standard".
You might have to change that in main.mk if you are not using PNP (only
relevant for MRPE checks)
- * inventory_check_severity default to 1 now (WARNING)
+ * inventory_check_severity defaults to 1 now (WARNING)
+ * aggregation_output_format now defaults to "multiline"
Checks & Agents:
* megaraid_pdisks: Using the real enclosure number as check item now
diff --git a/LIESMICH.zutun b/LIESMICH.zutun
index 61a2842..fa64229 100644
--- a/LIESMICH.zutun
+++ b/LIESMICH.zutun
@@ -96,8 +96,6 @@ nur noch ohne MIB-Dateien. Das würde das ganze deutlich vereinfachen!
filesystem_levels rausnehmen. Hinweis, dass check_parameters verwendet
werden soll.
-aggregation_output_format: Aggregation per Default auf mehrzeilige Ausgabe
-
Direct rrd updates ganz entfernen.
snmp_communities: dictionary nicht mehr verwenden, aus Doku raus, Defaultwert
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 7289b7f..ddd8628 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -268,7 +268,7 @@ service_aggregations = []
service_dependencies = []
non_aggregated_hosts = []
aggregate_check_mk = False
-aggregation_output_format = "single" # new in 1.1.6. Possible also: "multiline"
+aggregation_output_format = "multiline" # new in 1.1.6. Possible also: "multiline"
summary_host_groups = []
summary_service_groups = [] # service groups for aggregated services
summary_service_contactgroups = [] # service contact groups for aggregated services
Module: check_mk
Branch: master
Commit: e8c6f78f1f0b5f8e03194140326ca5c56023672f
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e8c6f78f1f0b5f…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sat Nov 6 10:42:14 2010 +0100
Remove non_bulkwalk_hosts
---
ChangeLog | 15 ++++++++++-----
LIESMICH.zutun | 3 ---
modules/check_mk.py | 3 ---
3 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 11fac0c..94a5064 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,13 @@
1.1.9i1
+ INCOMPATIBLE CHANGES:
+ * perfdata_format now defaults to "pnp". Previous default was "standard".
+ You might have to change that in main.mk if you are not using PNP (only
+ relevant for MRPE checks)
+ * inventory_check_severity defaults to 1 now (WARNING)
+ * aggregation_output_format now defaults to "multiline"
+ * Removed non_bulkwalk_hosts. You can use bulkwalk_hosts with NEGATE
+ instead (see docu)
+
Core, Setup, etc.:
* Improve error handling: if hosts are monitored with SNMP *and* TCP,
then after an error with one of those two agents checks from the
@@ -10,11 +19,7 @@
* Inventory: Better error handling on invalid inventory result of checks
* setup.sh: fix problem with missing package_info (only appears if setup
is called from another directory)
- * perfdata_format now defaults to "pnp". Previous default was "standard".
- You might have to change that in main.mk if you are not using PNP (only
- relevant for MRPE checks)
- * inventory_check_severity defaults to 1 now (WARNING)
- * aggregation_output_format now defaults to "multiline"
+
Checks & Agents:
* megaraid_pdisks: Using the real enclosure number as check item now
diff --git a/LIESMICH.zutun b/LIESMICH.zutun
index fa64229..3cd0b66 100644
--- a/LIESMICH.zutun
+++ b/LIESMICH.zutun
@@ -104,9 +104,6 @@ Abbruch, wenn immer noch type ist dict. Gleiches für bulkwalk_hosts
[""] deprecaten, aus der Doku raus und durch ALL_SERVICES ersetzen
-non_bulkwalk_hosts rausschmeissen. Kann man mit NEGATE nachbilden
-mit 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 ddd8628..4d07886 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -246,7 +246,6 @@ legacy_checks = []
all_hosts = []
snmp_hosts = [ (['snmp'], ALL_HOSTS) ]
bulkwalk_hosts = None
-non_bulkwalk_hosts = None
usewalk_hosts = []
ignored_checktypes = [] # exclude from inventory
ignored_services = [] # exclude from inventory
@@ -611,8 +610,6 @@ def is_snmp_host(hostname):
def is_bulkwalk_host(hostname):
if bulkwalk_hosts:
return in_binary_hostlist(hostname, bulkwalk_hosts)
- elif non_bulkwalk_hosts:
- return not in_binary_hostlist(hostname, non_bulkwalk_hosts)
else:
return False