Module: check_mk
Branch: master
Commit: a77770fa6c7a34cc48986c6a71ff7810dbcd556f
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a77770fa6c7a34…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed May 1 09:47:39 2013 +0200
Added draft LIESMICH.globalsettings
---
doc/drafts/LIESMICH.globalsettings | 41 ++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/doc/drafts/LIESMICH.globalsettings b/doc/drafts/LIESMICH.globalsettings
new file mode 100644
index 0000000..4a624c9
--- /dev/null
+++ b/doc/drafts/LIESMICH.globalsettings
@@ -0,0 +1,41 @@
+Manche der globalen Einstellungen wären schön, wenn man sie pro Host
+einstellen könnte. Dazu gehört z.B. das if_inventory_uses_description. Aber
+auch Dinge wie agent_min_version, agent_simulator, simulation_mode,
+inventory_max_cachefile_age, inventory_check_interval, inventory_check_severity
+und andere könnte man gut pro Host gebrauchen.
+
+Folgende Idee könnte das elegant lösen: Wir führen eine neue
+generische Regelkette global_setting_per_host[] ein. Diese
+ist eigentlich ein dict von Ketten. Beispiel:
+
+global_setting_per_host["inventory_check_interval"] = [
+ ( 120, [ "linux", "prod" ], ALL_HOSTS ),
+ ( 1440, [ "linux", "test" ], ALL_HOSTS ),
+]
+
+Die Umsetzung ist denkbar einfach: Nach dem Laden der Konfig
+wird die Variable einmal ausgewertet und die entsprechenden
+globalen Varialen gesetzt. Beim precompile muss man garnix
+ändern, weil diese Variablen dann ja schon gesetzt sind
+und korrekt einkodiert werden.
+
+In Fällen, in denen es um mehrere Host geht (z.B. cmk -I),
+muss die Funktion, die die globalen Variablen setzt, immer
+dann aufgerufen werden, wenn auf einen neuen Host umgeschaltet
+wird. Hier kann man evtl. noch ein Caching einführen, wenn
+das zulange dauert.
+
+Im WATO können wir dann etliche Variablen aus den global
+settings umziehen. Frage ist, ob wir dann auch automatisch
+eine Migration machen. Die könnte so gehen: Bei jeder globalen
+Variable, die vom Default abweicht und bei der eine Regelkette
+in der neuen Form existiert, wird - wenn diese Kette leer ist -
+eine Regeln eingefügt mit ALL_HOSTS, die genau den geänderten
+Wert einsetzt. Gleichzeitig setzen wir den Wert dann wieder
+auf den Default zurück.
+
+Dumm noch: der Benutzer sieht jetzt den Defaultwert nicht
+mehr. Aber das Problem haben wir bei allen Regelketten.
+Hier müsste man sowieso mal den Defaultwert anzeigen, der
+dann gilt, wenn keine Regel greift.
+
Module: check_mk
Branch: master
Commit: d7657a44d6eaf9678b142a3476598dbaab3933b2
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d7657a44d6eaf9…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Apr 30 15:34:41 2013 +0200
Fixed passive check interval mixup
---
modules/check_mk.py | 6 +++---
modules/check_mk_base.py | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 2d807c4..4a9837d 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -703,7 +703,7 @@ def check_interval_of(hostname, checkname):
return # no values at all for non snmp checks
for match, minutes in host_extra_conf(hostname, snmp_check_interval):
if match is None or match == checkname:
- return minutes * 60 # use first match
+ return minutes # use first match
def get_single_oid(hostname, ipaddress, oid):
# New in Check_MK 1.1.11: oid can end with ".*". In that case
@@ -1784,11 +1784,11 @@ def create_nagios_servicedefs(outfile, hostname):
# Add the check interval of either the Check_MK service or
# (if configured) the snmp_check_interval for snmp based checks
- check_interval = 60 # default hardcoded interval
+ check_interval = 1 # default hardcoded interval
# Customized interval of Check_MK service
values = service_extra_conf(hostname, "Check_MK", extra_service_conf.get('check_interval', []))
if values:
- check_interval = int(values[0]) * 60
+ check_interval = int(values[0])
value = check_interval_of(hostname, checkname)
if value is not None:
check_interval = value
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index 6bd27d6..a24a650 100755
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -340,7 +340,7 @@ def get_realhost_info(hostname, ipaddress, check_type, max_cache_age, ignore_che
check_interval = check_interval_of(hostname, check_type)
if not ignore_check_interval \
and check_interval is not None and os.path.exists(cache_path) \
- and cachefile_age(cache_path) < check_interval:
+ and cachefile_age(cache_path) < check_interval * 60:
# cache file is newer than check_interval, skip this check
raise MKSkipCheck()