Migrating CheckMK to RHEL8

This post is part of a series

Summary

This weekend I decided to migrate a couple of the servers, I run in my home lab, to RHEL8. At the time of writing, RHEL8 has been out for almost a year (released on May 7th, 2019) and indeed we are on RHEL8.1 as I write this.

The good news is that migrating checkmk was really, really simple

Overview

In an ideal world this would be as simple as

  • Install new VM
  • Backup existing installation
  • Copy the backup to the new VM
  • Restore

The good news for us is that it was exactly that simple. Its so simple I almost didn’t post about it

The Details

I wont cover installing a fresh VM as this is trivial

Backing Up

To backup your checkmk installation you simply, ssh in and switch to the monitoring user (it will be called something else for you). I only have a single instance of checkmk running, its called monitoring and its available at https:///monitoring

This means that there is a user account called monitoring and all the data that is collected lives in this users home directory (which is mapped to /omd/sites/monitoring), but to be honest we don’t need to know any of that. To backup, as the monitoring user

# su - monitoring
OMD[monitoring]:~$ omd backup checkmk-backup.tar.gz

To learn more about backup/restore for checkmk, check their website https://checkmk.com/cms_omd_basics.html#backup

Copy The Data

Copy the backup to the new instance

OMD[monitoring]:~$ scp checkmk-backup.tar.gz root@<new instance name>:.

Restoring

This only requires two steps

  • install checkmk
  • restore the backup
Install checkmk

CheckMK requires a couple of additional repos and the checkmk RPM, which you can download from their site https://checkmk.com/download.php?edition=dcee&version=stable&dist=redhat&os=el8 (they will ask for an email address but no verification is done, as of the time of writing)

The additional repos are EPEL8 and the CentOS Power Tools Repo

Enable EPEL

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

Enable Power Tools

NOTE: If you are running CentOS rather than RHEL, then this next step isnt required

wget https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official -O /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

cat <<EOF > /etc/yum.repos.d/CentOS-PowerTools.repo
[PowerTools]
name=CentOS-$releasever - PowerTools
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=PowerTools&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/PowerTools/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOF

OK, so now we simply install

yum -y localinstall check-mk-enterprise-1.6.0p8.demo-el8-38.x86_64.rpm
Restore the Backup

Now checkmk is installed, lets restore the data

As the root user simply do this

# omd restore ./checkmk-backup.tar.gz

You will probably need to start the site also

# su - monitoring
OMD[monitoring]:~$ omd start

Clean Up

NOTE: Now is a good time to shutdown the original checkmk server, if you havent already

Thats it, your new RHEL8 instance of checkmk is up and running and all your historic data is preserved

In reality, you will probably want to change the IP address to the same as the original - or update DNS to point to the new IP address. You should also consider your SSL certificate but in my case I have all my servers behind an Nginx proxy that does all the LetsEncrypt goodness, so there is nothing else I need to do, other than ensure my proxy is directing to the new instance

CheckMK is a brilliant and utterly stable product, and this ease of backup and restore mean that I can heartily recommend it to you

Hope that was useful, it honestly took me longer to write this post than to do the entire migration

OSG

See also