Backup and Restore
January 26. 2015
Why Check_MK provides a Backup & Restore Mechanism
Creating a manual backup of your configuration and runtime data of Check_MK is not really difficult. It is sufficient to save your main.mk, your conf.d directory (if existing) and the directories below /var/lib/check_mk. Calling Check_MK with the option --backup basically does the same, but makes a few things right that are difficult to get right manually:
How to do it
Creating a backup is simple. Choose a filename - for example backup-17.tar.gz and use the option --backup:
root@linux# check_mk --backup backup17.tar.gz
You'll find a gzip compressed tar archive backup-17.tar.gz in your current directory. You might also want to use the option -v for verbose output:
root@linux# check_mk -v --backup backup-17.tar.gz Reading default settings from /usr/share/check_mk/modules/defaults Reading config file /etc/check_mk/main.mk... Creating backup file 'backup-17.tar.gz'... Adding Main configuration file (/etc/check_mk/main.mk) (286 bytes)... Adding Configuration sub files (/etc/check_mk/conf.d) (10240 bytes)... Adding Automatically inventorized checks (/var/lib/check_mk/autochecks... Adding Performance counters (/var/lib/check_mk/counters) (10240 bytes)... Adding Agent cache (/var/lib/check_mk/cache) (10240 bytes)... Adding Logwatch (/var/lib/check_mk/logwatch) (10240 bytes)... Successfully created backup.
Restoring is just as easy. Simply do the same but with the option --restore:
root@linux# check_mk --restore backup-17.tar.gz
What happens at Backup & Restore
The following files and directories go into your backup - and will be replaced completely by a restore:
Please note that all those files and directories are deleted before doing a restore, even if they are not present in the backup.
The precompiled host checks and the created Nagios configuration are not backuped since they are created automatically.
Also - as of version 1.1.9i9 - the file local.mk is ignored by backup and restore. That way you can put settings there that are outside of the scope of the backup. A common usage is to put simulation_mode = True there on test systems, where backups of production systems are restored.