Copying a site in OMD

OMD provides some very useful commands to manage sites. Execute “omd help” as root to see all possible commands.

For example if you are going to update OMD to a new version and want to be sure that your OMD site wouldn’t have issues with the new version, you can create a copy of your OMD site for a test.

Assume your productive OMD site is named “sitePROD”. To create a copy of the site run the following commands:

# omd sitePROD stop
# omd cp sitePROD siteTEST
# omd sitePROD start

The commands above shuts down the site “sitePROD”, makes a copy of all data (configuration files, log files, pnp and rrd data etc.) and changes all entrances of sitePROD to siteTEST, for example in the configuration files and all other relevant things.

To minimize the copy time and not to waste disk space copying PNP graphs and log files, you can use the parameter -N. It’s a very nice feature of the copy command:

# omd sitePROD stop
# omd cp -N sitePROD siteTEST
# omd sitePROD start

If you run the command with the parameter “-N”, some data will not be copied. Unfortunately some directories will not be created as well. It sounds like a bug in OMD up to version 1.2.4p5. so you might get error messages like those right below while starting the site “siteTEST” after the copy command has been finished:

# su - siteTEST
OMD[siteTEST]:~$ omd start
Starting CMC Rushing Ahead Daemon...OK
Starting Check_MK Micro Core...OK
Starting dedicated Apache for site siteTEST...(2)No such file or directory: httpd: could not open error log file /omd/sites/siteTEST/var/log/apache/error_log.
Unable to open logs
..........ERROR
Starting xinetd...OK
Initializing Crontab...OK

To solve the issue with the Web server (and with PNP as well) you have to create some missed directories with the command like this:

mkdir var/pnp4nagios/spool var/pnp4nagios/log var/rrdcached var/log/apache

After that you can start the new test site without any problems.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.