Module: check_mk
Branch: master
Commit: 21027dd3d20c70f94df2540c9cb8075147b06402
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=21027dd3d20c70…
Author: Sven Rueß <sr(a)mathias-kettner.de>
Date: Tue Oct 25 12:28:45 2016 +0200
New bug related to distributed monitoring and automation
---
.bugs/2523 | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/.bugs/2523 b/.bugs/2523
new file mode 100644
index 0000000..c5265e3
--- /dev/null
+++ b/.bugs/2523
@@ -0,0 +1,19 @@
+Title: Distributed Monitoring: Not blocked automatic updates for slave sites
+Component: wato
+State: open
+Date: 2016-10-25 12:23:06
+Targetversion: 1.2.8
+Class: bug
+
+The user is using a distributed monitoring setup with central WATO configuration.
+The slave sites are only monitoring a part of the hosts configured on the master and
+the site ID is inherited by the folder properties.
+
+Our normal setup will disable WATO on all slave sites. The problem is, that this will not
+disable WebAPI or the direct Multisite URLs. We should block this both ways, too.
+Otherwise the user is able to make locale changes, which will be overwritten by the
+global configuration on a later time.
+
+Workaround:
+Only do those automatic changes on the Master site. Never do it on the slave site.
+Take care about, that all of the scripts are using the Master site for those configurations.
Module: check_mk
Branch: master
Commit: fe02818f51efa183fbadbf2d3a6cec6b0779171d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fe02818f51efa1…
Author: Sven Rueß <sr(a)mathias-kettner.de>
Date: Tue Oct 25 12:22:33 2016 +0200
Bug related to distributed monitoring setup
---
.bugs/2522 | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/.bugs/2522 b/.bugs/2522
new file mode 100644
index 0000000..1722aca
--- /dev/null
+++ b/.bugs/2522
@@ -0,0 +1,26 @@
+Title: Distributed Monitoring: User action breaks configuration
+Component: multisite
+State: open
+Date: 2016-10-25 12:10:19
+Targetversion: 1.2.8
+Class: bug
+
+The user is using a distributed monitoring setup with central WATO configuration.
+The slave sites are only monitoring a part of the hosts configured on the master and
+the site ID is inherited by the folder properties.
+
+Our normal setup will disable WATO on all slave sites. If the user is activating it
+or will use our WebAPI or Multisite URLs for adaptations, the configuration is broken.
+All hosts will be started to monitor on this slave. It is related to the missing site ID
+in our configuration. All unknown site IDs will be replaced with the ID from the slave.
+
+We should take care about the transfered configuration to our slave sites. Those sites should
+only receive the configuration which is needed by them.
+
+Otherwise we have to handle the missing site IDs correctly. Any modification on slave sites
+should not break the correct configuration.
+
+Workaround:
+Please modify global settings of affected slave sites. Edit and save without any change.
+After the activation, all slave sites will be updated to the correct configuration.
+If the duplicated hosts does not disappear, please login to the slave and do a cmk -R as site user.
Module: check_mk
Branch: master
Commit: b77e51cb8a52ccd0194e55017024f46882d49ebe
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b77e51cb8a52cc…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Oct 20 11:44:35 2016 +0200
Started moving in-memory cache handling to dedicated module
---
cmk_base/__init__.py | 4 ++++
cmk_base/caching.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++++
modules/check_mk.py | 10 +++++----
modules/check_mk_base.py | 17 +++++++-------
4 files changed, 76 insertions(+), 13 deletions(-)
diff --git a/cmk_base/__init__.py b/cmk_base/__init__.py
index 66c865c..a0fd6ad 100644
--- a/cmk_base/__init__.py
+++ b/cmk_base/__init__.py
@@ -27,3 +27,7 @@
"""This is the python module hierarchy used by Check_MK's core
components, former called modules. This hosts the checking,
discovery and a lot of other functionality."""
+
+import cmk_base.caching
+
+cache = cmk_base.caching.CacheManager()
diff --git a/cmk_base/caching.py b/cmk_base/caching.py
new file mode 100644
index 0000000..dea4964
--- /dev/null
+++ b/cmk_base/caching.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# tails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+"""Managing in-memory caches through the execution time of cmk"""
+
+from cmk.exceptions import MKGeneralException
+
+
+class CacheManager(object):
+ def __init__(self):
+ self._caches = {}
+
+
+ def register(self, name):
+ if name in self._caches:
+ raise MKGeneralException("The cache \"%s\" is already registered" % name)
+
+ self._caches[name] = Cache()
+ return self._caches[name]
+
+
+ def clear_all():
+ for cache in self._caches.values():
+ cache.clear()
+
+
+ def get(self, name):
+ return self._caches[name]
+
+
+
+# Just a small wrapper round a dict to get some caching specific functionality
+# for analysis etc.
+class Cache(dict):
+ pass
diff --git a/modules/check_mk.py b/modules/check_mk.py
index f03ac5d..3849925 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -58,6 +58,7 @@ import cmk.render as render
import cmk.man_pages as man_pages
import cmk_base.console as console
+import cmk_base.cache
# .--Prelude-------------------------------------------------------------.
# | ____ _ _ |
@@ -1951,11 +1952,12 @@ def get_check_table(hostname, remove_duplicates=False, use_cache=True, world='co
skip_autochecks = True
# speed up multiple lookup of same host
- if not skip_autochecks and use_cache and hostname in g_check_table_cache:
+ check_table_cache = cmk_base.cache.get("check_tables")
+ if not skip_autochecks and use_cache and hostname in check_table_cache:
if remove_duplicates and is_dual_host(hostname):
- return remove_duplicate_checks(g_check_table_cache[hostname])
+ return remove_duplicate_checks(check_table_cache[hostname])
else:
- return g_check_table_cache[hostname]
+ return check_table_cache[hostname]
check_table = {}
@@ -2078,7 +2080,7 @@ def get_check_table(hostname, remove_duplicates=False, use_cache=True, world='co
deps.append(d)
if not skip_autochecks and use_cache:
- g_check_table_cache[hostname] = check_table
+ check_table_cache[hostname] = check_table
if remove_duplicates:
return remove_duplicate_checks(check_table)
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index 3b81110..983faad 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -64,6 +64,7 @@ import cmk_base.agent_simulator
import cmk_base.utils
import cmk_base.prediction
import cmk_base.console as console
+import cmk_base.cache
# PLANNED CLEANUP:
# - central functions for outputting verbose information and bailing
@@ -99,8 +100,7 @@ def reset_global_caches():
global g_ip_lookup_cache
g_ip_lookup_cache = None # permanently cached ipaddresses from ipaddresses.cache
- for cachevar_name in g_global_caches:
- globals()[cachevar_name] = {}
+ cmk_base.cache.clear_all()
# global variables used to cache temporary values that do not need
@@ -125,10 +125,8 @@ g_global_caches = []
# global variables used to cache temporary values that need to
# be reset after a configuration change.
-g_check_table_cache = {} # per-host-checktables
-g_global_caches.append('g_check_table_cache')
-g_nodesof_cache = {} # Nodes of cluster hosts
-g_global_caches.append('g_nodesof_cache')
+cmk_base.cache.register("check_tables") # Check table of a host
+cmk_base.cache.register("nodes_of") # Nodes of cluster hosts
reset_global_caches()
@@ -1973,16 +1971,17 @@ def i_am_root():
# Returns the nodes of a cluster, or None if hostname is
# not a cluster
def nodes_of(hostname):
- nodes = g_nodesof_cache.get(hostname, False)
+ nodes_of_cache = cmk_base.cache.get("nodes_of")
+ nodes = nodes_of_cache.get(hostname, False)
if nodes != False:
return nodes
for tagged_hostname, nodes in clusters.items():
if hostname == tagged_hostname.split("|")[0]:
- g_nodesof_cache[hostname] = nodes
+ nodes_of_cache[hostname] = nodes
return nodes
- g_nodesof_cache[hostname] = None
+ nodes_of_cache[hostname] = None
return None
def check_uses_snmp(check_type):
Module: check_mk
Branch: master
Commit: fd09000bfddf0bde61ba039e09c5c238609f4044
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fd09000bfddf0b…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Oct 24 15:18:31 2016 +0200
Remove obsolete and outdated sections from check manpages
Information about the configuration is now found in WATO. If you
need the correct syntax of a check configuration then please
create a configuration example with WATO and look into the <tt>rules.mk</tt>
file as a reference. Also the information about the metrics has been dropped
since the new metric system has a correct description for each metric.
---
lib/man_pages.py | 43 -------------------------------------------
1 file changed, 43 deletions(-)
diff --git a/lib/man_pages.py b/lib/man_pages.py
index cbacf1c..c0c8377 100644
--- a/lib/man_pages.py
+++ b/lib/man_pages.py
@@ -567,55 +567,12 @@ class ManPageRenderer(object):
self._print_subheader("Item")
self._print_textbody(header['item'])
- self._print_subheader("Check parameters")
- if self.man_page.has_key('parameters'):
- self._begin_table(["Parameter", "Type", "Description"])
- first = True
- for parameter_name, text in self.man_page['parameters']:
- if not first:
- self._print_empty_line()
- first = False
- self._print_splitwrap(self._parameters_color, parameter_name + ": ", self._normal_color, text)
- self._end_table()
- else:
- self._print_line("None.")
-
- self._print_subheader("Metrics")
- if header.has_key('perfdata'):
- self._print_textbody(header['perfdata'])
- else:
- self._print_textbody("None.")
-
self._print_subheader("Discovery")
if header.has_key('inventory'):
self._print_textbody(header['inventory'])
else:
self._print_textbody("No discovery supported.")
- self._print_subheader("Configuration variables")
- if self.man_page.has_key('configuration'):
- self._begin_table(["Variable", "Type", "Description"])
- first = True
- for conf_name, text in self.man_page['configuration']:
- if not first:
- self._print_empty_line()
- first = False
- self._print_splitwrap(tty.colorset(2, 4, 1), conf_name + ": ",
- tty.normal + tty.colorset(7, 4), text)
- self._end_table()
- else:
- self._print_line("None.")
-
- if header.has_key("examples"):
- self._print_subheader("Examples")
- lines = header['examples'].split('\n')
- self._begin_main_mk()
- for line in lines:
- if line.lstrip().startswith('#'):
- self._print_line(line)
- elif line != "<br>":
- self._print_line(line, self._examples_color, True) # nomarkup
- self._end_main_mk()
self._print_empty_line()
self.output.flush()