Best way to migrating and splitting a single CheckMK site into multiple sites on two or more nodes

CheckMK supports central configuration/monitoring & deploying that configuration to multiple sites. First of, familiarize yourself with the documentation how to set up & run distributed monitoring.

Next set up one or two additional sites & create some test hosts & services on each site, just to get a feel for how working with such a setup looks. You can even do that on the same machine as you can run multiple instances (sites) of CheckMK on the same computer — though I suggest you really use different machines, just to see how that setup really works.

Next realize that “moving” a host from one site to another is as easy as setting the “Monitored from” property in the host’s configuration in WATO. You can do that for individual hosts or on whole folders. After such a change in WATO all you need to do is activate the changes as usual & the host is now monitored from somewhere else.

This is where things get a bit tricky, though.

Historical data

Switching the “Monitored from” status does not migrate metrics data or event history to the new site. Unfortunately there’s no easy way to migrate event history at all as that’s stored in a text file, and not one file per host, but one file per site where all host & service events are recorded (or something like this, I’m not 100% on the details here). Therefore I’ve never done that.

What you can do much more easily, though, is migrating the metrics as those are stored in RRDs (going from CheckMK Enterprise & above editions here, I don’t know if/how Raw differs). The RRDs are stored in the following directory:

/opt/omd/sites/<site_id>/var/check_mk/rrd/<hostname>

Therefore the steps to copy over the metrics from the old site to the new one are, ideally:

  • create TAR on old site of all hosts you want to migrate
  • copy TAR to new machine
  • unpack TAR there into new site’s corresponding directory (they’ll be different! each site_id is unique in a distributed setup!)
  • change the file/directory owners to the new site’s Linux user which has the same name as the new site’s ID
  • in WATO switch the “Monitored from” property to the new site

Notifications

In a distributed setup CheckMK distributed all configuration including installed MKPs, all rules etc., including the notification/event rules to the connected sites. Therefore your notification setups will be set up on the secondary sites in the same way.

However, you need to understand that by default notifications are generated on the site that the host they’re generated for is monitored from. If you did any kind of manual setup in the file system of your primary site (e.g. created a custom script for sending SMS) then these manual steps will not be replicated to the remote sites automatically as CheckMK only knows about stuff configured through WATO. You need to take care of such manual modifications yourself, ideally with automation tools such as Ansible or similar solutions.

Alternatively you can configure the notifications to be sent solely from the main site, even if the host a notification is triggered for is monitored from a remote site. This means, though, that in case of a lost connection between a remote site & the central site (e.g. remote site in a remote network connected via a VPN tunnel and that VPN tunnel goes down) the remote site won’t be able to send out notifications until the connection’s been re-established. Read the docs I’ve linked to earlier for how to set that up; it contains a whole section just about notifications.

How well does this work?

If you read the forum here you’ll often stumble across people who use such setups. We do, too, I’d say a mid-sized one with about 1.850 hosts monitored from roughly 70 sites. There are much smaller setups, there are much larger ones out there. The ratios of hosts per monitored site varies wildly, too. All in all it works very well for various purposes (scaling, having different sites in different network locations/in customers’ networks).