Can’t activate pending changes after copying a site

CMK version:
2.1.0p9.cee
OS version:

Error message:
[Errno 13] Permission denied: '/omd/sites/Main/tmp/check_mk/data_source_cache/push-agent/mssql02'

This Error happens when I try to apply a change on a copied site.
The new site has the name serviceapi and is a copy of the site Main.
I already tried to “Remove TLS registration” on all hosts, but it had no effect.

The web.log contains these Lines.

2022-08-25 14:14:25,492 [40] [cmk.web.site[serviceapi] 8706] error activating changes
Traceback (most recent call last):
  File "/omd/sites/serviceapi/lib/python3/cmk/gui/watolib/activate_changes.py", line 1560, in _do_run
    configuration_warnings = self._do_activate()
  File "/omd/sites/serviceapi/lib/python3/cmk/gui/watolib/activate_changes.py", line 1844, in _do_activate
    configuration_warnings = self._call_activate_changes_automation()
  File "/omd/sites/serviceapi/lib/python3/cmk/gui/watolib/activate_changes.py", line 1855, in _call_activate_changes_automation
    return execute_activate_changes(domain_requests)
  File "/omd/sites/serviceapi/lib/python3/cmk/gui/watolib/activate_changes.py", line 2070, in execute_activate_changes
    _update_links_for_agent_receiver()
  File "/omd/sites/serviceapi/lib/python3/cmk/gui/watolib/activate_changes.py", line 2089, in _update_links_for_agent_receiver
    uuid_link_manager.update_links(cmk.gui.watolib.collect_all_hosts())
  File "/omd/sites/serviceapi/lib/python3/cmk/utils/agent_registration.py", line 122, in update_links
    link.unlink_target()
  File "/omd/sites/serviceapi/lib/python3/cmk/utils/agent_registration.py", line 49, in unlink_target
    for filepath in self.target.iterdir():
  File "/omd/sites/serviceapi/lib/python3.9/pathlib.py", line 1160, in iterdir
    for name in self._accessor.listdir(self):
PermissionError: [Errno 13] Permission denied: '/omd/sites/Main/tmp/check_mk/data_source_cache/push-agent/fs02'

I tried to find the source of the Path , when calling cmk.utils.paths.data_source_cache_dir from inside the site it looks alright

OMD[serviceapi]:~$ python3
Python 3.9.10 (main, Jul  6 2022, 22:25:16) 
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cmk.utils.paths
>>> cmk.utils.paths.data_source_cache_dir
'/omd/sites/serviceapi/tmp/check_mk/data_source_cache'
>>> 
OMD[serviceapi]:~$

Hi,
do you have the file sites.mk in etc/check_mk/multisite.d? Is the original site in this file? If yes: Then replace Main with serviceapi.

Karl

Hi,

yes the file etc/check_mk/multisite.d/sites.mk exists. But the content does not contain Main

# Written by Checkmk store

sites.update({'serviceapi': {'alias': 'serviceapi', 'socket': ('local', None), 'proxy': None, 'timeout': 5, 'persist': False, 'url_prefix': '/serviceapi/', 'status_host': None, 'disabled': False, 'replication': None, 'multisiteurl': '', 'disable_wato': False, 'insecure': False, 'user_login': True, 'user_sync': 'all', 'replicate_ec': False, 'replicate_mkps': False, 'globals': {}}})

I found a fix for my Problem.
The Problem was that there were symbolic Links to the old site in the directory “/omd/sites/serviceapi/var/agent-receiver/received-outputs/”
What I don’t understand is that only 4 Links exist. in the Main Site there are over 70 Links.
So something must have been cleaned up automatically, but not all.
After the deletion I can apply changes without any errors.

2 Likes

@marcohald Great, we have the same problem but could not find a solution!
Found the symbolic links right there :slight_smile: Thanks!
I am not very happy with the 2.1p at all…

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.