Module: check_mk
Branch: master
Commit: 7fedcb2c0978bd7a35a1e4bf583cc70e77165353
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7fedcb2c0978bd…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Sep 6 08:13:39 2017 +0200
5184 FIX Bake agents on restart only affects master sites now
When enabling the global setting for baking agents during restrt of the
monitoring core, the agents were baked on all sites in distributed setups.
Since the agents are only deployed from the master site, the setting is
now only affecting the master.
Change-Id: Ia1fdfd324107ed9c395304b6e8d4fc6ee6a32f70
---
.werks/5184 | 13 +++++++++++++
cmk_base/default_config/base.py | 1 +
web/htdocs/watolib.py | 7 ++++---
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/.werks/5184 b/.werks/5184
new file mode 100644
index 0000000..9e61c50
--- /dev/null
+++ b/.werks/5184
@@ -0,0 +1,13 @@
+Title: Bake agents on restart only affects master sites now
+Level: 1
+Component: agents
+Compatible: compat
+Edition: cee
+Version: 1.5.0i1
+Date: 1504678337
+Class: fix
+
+When enabling the global setting for baking agents during restrt of the
+monitoring core, the agents were baked on all sites in distributed setups.
+Since the agents are only deployed from the master site, the setting is
+now only affecting the master.
diff --git a/cmk_base/default_config/base.py b/cmk_base/default_config/base.py
index e78b6b9..3d64f51 100644
--- a/cmk_base/default_config/base.py
+++ b/cmk_base/default_config/base.py
@@ -160,6 +160,7 @@ ipaddresses = {} # mapping from hostname to
IPv4 addres
ipv6addresses = {} # mapping from hostname to IPv6 address
only_hosts = None
distributed_wato_site = None # used by distributed WATO
+is_wato_slave_site = False
extra_host_conf = {}
extra_service_conf = {}
extra_nagios_conf = ""
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 9f24526..ae05ecb 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -3958,12 +3958,13 @@ def create_nagvis_backends(sites):
store.save_file('%s/etc/nagvis/conf.d/cmk_backends.ini.php' %
cmk.paths.omd_root, '\n'.join(cfg))
-def create_distributed_wato_file(siteid):
+def create_distributed_wato_file(siteid, is_slave):
output = wato_fileheader()
output += ("# This file has been created by the master site\n"
"# push the configuration to us. It makes sure that\n"
"# we only monitor hosts that are assigned to our site.\n\n")
output += "distributed_wato_site = '%s'\n" % siteid
+ output += "is_wato_slave_site = %r\n" % is_slave
store.save_file(cmk.paths.check_mk_config_dir + "/distributed_wato.mk",
output)
@@ -3996,7 +3997,7 @@ def update_distributed_wato_file(sites):
distributed = True
if config.site_is_local(siteid):
found_local = True
- create_distributed_wato_file(siteid)
+ create_distributed_wato_file(siteid, is_slave=False)
# Remove the distributed wato file
# a) If there is no distributed WATO setup
@@ -4302,7 +4303,7 @@ def automation_push_snapshot():
call_hook_snapshot_pushed()
# Create rule making this site only monitor our hosts
- create_distributed_wato_file(site_id)
+ create_distributed_wato_file(site_id, is_slave=True)
except Exception, e:
raise MKGeneralException(_("Failed to deploy configuration:
\"%s\". "
"Please note that the site configuration has been
synchronized "