Troubleshooting duplicate hosts using omd copy/move

This article explains what to do if you have duplicate hosts after using omd copy / move to a new site.

LAST TESTED ON CHECKMK 2.0.0P1

Table of Contents

Problem

After copying or moving a site with omd mv or omd cp, Checkmk will show you duplicate hosts and services.

This known issue needs a bigger rewrite of our code, which will take a while.

Solution

To avoid the issue, you might want to modify the following .mk files

  • ~/etc/check_mk/multisite.d/sites.mk
  • ~/etc/check_mk/liveproxyd.mk
  • ~/etc/check_mk/conf.d/distributed_wato.mk
  • ~/etc/nagvis/conf.d/cmk_backends.ini.php
  • ~/etc/nagvis/maps/<mapname>.cfg
  • ~/etc/nagvis/*
  • ~/local

If you're using the dcd, you must modify the dcd connection and recreate the hosts.

Screenshot of a host folder labeled Main. This shows four host with alphanumeric names and one named localhost.


In large environments, you could modify the following files:

  • ~/etc/check_mk/dcd.d/wato/connections.mk
  • ~/etc/checkmk/conf.d/wato/hosts.mk
  • ~/etc/checkmk/conf.d/wato/*/hosts.mk


Please be careful with modifying these files. We don't support any modification. We recommend modifying the hosts via WATO/SETUP or removing and recreating the hosts via the DCD.

Issue with Agent Bakery

ValueError ('/omd/sites/mysite/share/check_mk/agents/check_mk_agent.aix' does not start with '/omd/sites/mybackupsite/share/check_mk/agents')

Screenshot of an error on the Agent Bakery page. An internal error occurred while processing your request. You can report this issue to the Checkmk team to help fixing this issue. Please open the crash report page and use the form for reporting the problem.


Internal error: ‘/omd/sites/mysite/share/check_mk/agents/check_mk_agent.aix’ does not start with ‘/omd/sites/mybackupsite/share/check_mk/agents’

An internal error occurred while processing your request. 
You can report this issue to the Checkmk team to help fixing this issue. 
Please open the crash report page and use the form for reporting the problem. 


Solution 

Every time the bakery is running, we create a status file. After copying or moving the site, you need to delete this file. 

OMD[mysite]~# cat ~/var/check_mk/wato/bakery_file_status.mk


{'/omd/sites/mysite/share/check_mk/agents/check_mk_agent.aix': 1615930830.0, '/omd/sites/mysite/share/check_mk/agents/check_mk_agent.linux': 1615930830.0, '/omd/sites/mysite/share/check_mk/agents/check_mk_agent.solaris': 1615930830.0, '/omd/sites/mysite/share/check_mk/agents/check_mk_caching_agent.linux': 1615930824.0, '/omd/sites/mysite/share/check_mk/agents/mk-job': 1615930824.0, '/omd/sites/mysite/share/check_mk/agents/mk-job.aix': 1615930824.0, '/omd/sites/mysite/share/check_mk/agents/mk-job.solaris': 1615930824.0, '/omd/sites/mysite/share/check_mk/agents/waitmax': 1615930824.0}