Checkmk Monitoring Guide: From Hosts to Databases and Custom Services


Learn how to set up comprehensive monitoring with Checkmk, starting with the monitoring of databases like PostgreSQL, Microsoft SQL Server, and IBM DB2, and other services. This step-by-step guide covers everything you need to build a robust monitoring infrastructure.


Why Use Checkmk for Comprehensive Monitoring?

Checkmk is a powerful, open-source monitoring solution that provides:
End-to-end visibility across servers, applications, and databases
Automatic service discovery to reduce manual configuration
Performance metrics and historical data for trend analysis
Flexible alerting with notifications via email, Slack, PagerDuty, and more
Custom checks for monitoring any service or application
Scalability from small environments to enterprise deployments

Whether you’re monitoring a single server or a complex infrastructure with hundreds of services, Checkmk provides the tools you need to stay on top of your systems.


Prerequisites

You should already have a running Checkmk server. The installation steps are described in this post (Step1).

Adding a Monitored Host to Checkmk

1.1 Install the Checkmk Agent on the Target Host

Linux (RHEL/CentOS/OL)

# run as root
# install the checkmk agent
wget lin3.fritz.box/mysite/check_mk/agents/check-mk-agent-2.5.0p10-1.noarch.rpm
dnf -y install ./check-mk-agent-2.5.0p10-1.noarch.rpm

Linux (Ubuntu/Debian)

# run as root
wget lin3.fritz.box/mysite/check_mk/agents/check-mk-agent_2.5.0p10-1_all.deb
apt -y install ./check-mk-agent_2.5.0p10-1_all.deb

Windows

Run the following in a command prompt to allow ICMP (ping) to the host:

netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow

Then do the followoing:

  1. Download the agent from Setup > Agents > Windows in your Checkmk web interface
  2. Run the installer with administrator rights
  3. Configure the agent service to start automatically
  4. Verify the service is running in Services.msc

1.2 Add the host to Checkmk (GUI)

Navigate to the Checkmk GUI and add the new host:

  • Setup => Hosts => Add host (or click here)
  • Enter the Host name and click “Save & run service discovery”
  • Then Click “Accept all” to enable all discovered services
  • Click on Changes => Activate pending changes to perform the configuration changes

For the next step we need a agent registration password. Let’s create one in the GUI:

  • Go to Setup => Users => Edit the agent_registration user
  • Click on Create random secret and copy secret to clipboard and Save.
  • Activate the pending Changes: Changes => Activate pending Changes
  • The one time password is now saved to the clipboard (it is needed in the next step)

1.2 Configure TLS Encryption

Run this command on the monitored host to enable TLS:

On Linux:

# run as root
cmk-agent-ctl register --server lin3.fritz.box --site mysite --hostname lin6.fritz.box --user agent_registration --trust-cert
# enter the password from the previous step
Sample Output (click to expand):
[root@lin6 ~]# cmk-agent-ctl register --server lin3.fritz.box --site mysite --hostname lin6.fritz.box --user agent_registration --trust-cert

Password for Checkmk user 'agent_registration':
>
Registration complete.
[root@lin6 ~]#

On Windows

Run the following command in a command prompt and enter the registration password from the previous step:

C:\ProgramData\checkmk\agent\bin\cmk-agent-ctl.exe register --server lin3.fritz.box --site mysite --hostname win3.fritz.box --user agent_registration --trust-cert
Sample Output (click to expand):
C:\Windows\system32>C:\ProgramData\checkmk\agent\bin\cmk-agent-ctl.exe register --server lin3.fritz.box --site mysite --hostname win3.fritz.box --user agent_registration --trust-cert

Password for Checkmk user 'agent_registration':
>
Registration complete.

C:\Windows\system32>


Monitoring PostgreSQL Databases

The PostgreSQL database has been installed as documented in this post.

Install the PostgreSQL Plugin

On the Target Host (Linux)

# run as root
dnf -y install python3
wget -P /usr/lib/check_mk_agent/plugins lin3.fritz.box/mysite/check_mk/agents/plugins/mk_postgres.py
chmod +x /usr/lib/check_mk_agent/plugins/mk_postgres.py

Discover PostgreSQL Services in Checkmk

Perform the following steps to find the new PostgreSQL Checkmk services:

  • In the Host menu of the monitored host start: Run service discovery then Accept All
  • Activate the pending Changes: Changes => Activate pending Changes

After these steps the PostgreSQL Services are discovered, and after some time they all have been checked:


Monitoring Microsoft SQL Server

The SQL Server has been installed as documented in this post.

Install the SQL Server Plugin

On the monitored host download the Checkmk SQL Server plugin from the Checkmk server to %ProgramData%\checkmk\agent\plugins . Next create the config file with the following content:

# run in PowerShell
$p="$env:ProgramData\checkmk\agent\config"; mkdir $p -Force; @"
---
mssql:
  main:
    authentication:
      username: ''
      type: integrated
"@ | Out-File "$p\mk-sql.yml" -Encoding utf8


Discover SQL Server Services in Checkmk

Perform the following steps to find the new SQL Server Checkmk services:

  • In the Host menu of the monitored host start: Run service discovery then Accept All
  • Activate the pending Changes: Changes => Activate pending Changes

After these steps the SQL Server Services are discovered, and after some time they all have been checked:


Monitoring IBM DB2 databases

The IBM Db2 database server has been installed as documented in this post.

Install the DB2 Plugin

On the Target Host (Linux)

wget -P /usr/lib/check_mk_agent/plugins/ http://lin3.fritz.box/mysite/check_mk/agents/plugins/mk_db2.linux
chmod +x /usr/lib/check_mk_agent/plugins/mk_db2.linux

Discover Db2 Services in Checkmk

Perform the following steps to find the new Db2 Checkmk services:

  • In the Host menu of the monitored host start: Run service discovery then Accept All
  • Activate the pending Changes: Changes => Activate pending Changes

After these steps the Db2 Services are discovered, and after some time they all have been checked:


Conclusion

Setting up comprehensive monitoring with Checkmk gives you end-to-end visibility across your entire infrastructure. By following these steps, you can:

Monitor hosts with secure TLS connections
Track database performance for PostgreSQL, SQL Server, and DB2
Get alerts before issues impact your users
Analyze trends with historical data and dashboards

0