CheckMK

Monitoring Software

Introduction

checkmk_logo_neg_v2_vertical.png

Introduction

Checkmk is a comprehensive solution for monitoring of applications, servers, and networks. This vast set of features was designed in collaboration with our customers over many years. Checkmk is easy to learn and use, but powerful enough for the most complex IT environments.

Checkmk is available in four editions:

These Checkmk Editions are available for a range of platforms, in particular for various versions of Debian, Ubuntu, SLES and Red Hat, and also as a Docker Image. In addition, physical appliances of various sizes as well as a virtual appliance are offered to simplify the administration of the underlying operating system through a graphical user interface and to enable high-availability solutions.

The agents used by Checkmk to collect data are available for 11 platforms, including Windows.

This manual describes the installation on portainer. 

Features

checkmk provides integrations for important products, such as:

Requirements

History

I installed the "free" enterprise edition, however, after 30 days it is not so free after all. The amount of hosts is limited to 25. After I enabled another feature, it counted PVE subsystems as hosts and the host count was suddenly 59. The whole suite stopped working. Therefore it is necessary to install it again. This time I will use the raw edition on portainer.

Installation

Installation on Linux

Download

You can download the current version here:

Checkmk download

After selecting the desired version it will create a command. Copy the command and execute in a Linux terminal. It looks like this:

wget https://download.checkmk.com/checkmk/2.2.0p20/check-mk-raw-2.2.0p20_0.bookworm_amd64.deb

Installation

copy the command from the webpage and execute in a Linux terminal

sudo apt install ./check-mk-raw-2.2.0p17_0.bookworm_amd64.deb

Create a checkmk monitoring site

sudo omd create monitoring

The output will look like this:

Output
Adding /opt/omd/sites/monitoring/tmp to /etc/fstab.
Creating temporary filesystem /omd/sites/monitoring/tmp...OK
Restarting Apache...OK
Created new site monitoring with version 2.2.0p17.cre.

    The site can be started with omd start monitoring.
    The default web UI is available at http://your_server/monitoring/

    The admin user for the web applications is cmkadmin with password: generated-password
    (It can be changed with 'htpasswd -m ~/etc/htpasswd cmkadmin' as site user.)
    Please do a su - monitoring for administration of this site. 

Grab the password and change it.

omd start monitoring

Installation on Portainer

Docker Compose file

I grabbed a nice cocker compose file, created a new stack and copied the contents of the docker compose file.

version: '3.1'
services:
  controll:
    image: checkmk/check-mk-raw:2.0.0-latest
    tmpfs:
     - /opt/omd/sites/cmk/tmp:uid=1000,gid=1000
    ulimits:
      nofile: 1024
    container_name: checkmk
    restart: always
    volumes:
      - '/etc/localtime:/etc/localtime:ro'
      - './odm-sites:/omd/sites'
    ports:
      - '8095:5000'
      - '6557:6557'

The password can be seen in the log  (Quick actions). And the password can be changed on the console (Quick actions).

htpasswd /opt/omd/sites/cmk/etc/htpasswd cmkadmin

You can login here:

http://portainer.simmy.ch:8095


Securing the webinterface

So far I couldn't make that working. 

Docs: Securing the Webinterface

Activating the Apache modules

a2enmod ssl
systemctl restart apache2

locate the certificate file:

find /etc/apache2/ -type f -exec grep -Hn '^\s*SSLCertificate.*File' {} \;

/etc/apache2/sites-enabled/000-default

RewriteEngine On
# Never forward request for .well-known (important when using Let's Encrypt)
RewriteCond %{REQUEST_URI} !^/.well-known
# Next 2 lines: Force redirection if incoming request is not on 443
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}$1 [L]
# This section passes the system Apaches connection mode to the
# instance Apache. Make sure mod_headers is enabled, otherwise it
# will be ignored and "Analyze configuration" will issue "WARN".
<IfModule headers_module>
    RequestHeader set X-Forwarded-Proto expr=%{REQUEST_SCHEME}
    RequestHeader set X-Forwarded-SSL expr=%{HTTPS}
</IfModule>



checkmk Agent installation on linux

Download the Agent

Setup --> Agents --> "Windows, Linux, Solaris, AIX" --> Related --> "Linux, Solaris, AIX" --> right click on the file --> Copy link address

Install the Agent

For Debian based systems

wget http://syslog.simmy.ch/monitoring2/check_mk/agents/check-mk-agent_2.2.0p17-1_all.deb
apt install ./check-mk-agent_2.2.0p17-1_all.deb

if ufw is active, then you have to enable the service port:

ufw allow 6556

For Red Hat/Fedora based systems

wget http://syslog.simmy.ch/monitoring2/check_mk/agents/check-mk-agent-2.2.0p17-1.noarch.rpm
sudo yum install -y -q check-mk-agent-2.2.0p17-1.noarch.rpm -y

Open the firewall for checkmk-agent on port 6556

For Univention based systems

Installationsanleitung checkmk 2.0 check_mk_agent auf UCS 5.0

Register agent to the monitoring server

cmk-agent-ctl register --hostname $(hostname -f) --server syslog.simmy.ch --site monitoring2 --user cmkadmin

Useful commands

ss -tulpn | grep 6556
echo | nc <localhost> 6556
cmk-agent-ctl status



Agent installation on TrueNAS

Download the Agent

Setup --> Agents --> "Windows, Linux, Solaris, AIX" --> Related --> "Linux, Solaris, AIX" --> right click on .deb file --> Copy link address

Then you will have the address of the .deb file, which can be downloaded with wget:

wget http://syslog.simmy.ch/monitoring2/check_mk/agents/check-mk-agent_2.2.0p17-1_all.deb

Install the Agent

For some reason the apt program is not an executable. So the first step is to make this file executable.

chmod +x /usr/bin/apt
apt install ./check-mk-agent_2.2.0p17-1_all.deb

if ufw is active, then you have to enable the service port:

ufw allow 6556

Register agent to the monitoring server

cmk-agent-ctl register --hostname $HOSTNAME.simmy.ch --server syslog.simmy.ch --site monitoring2 --user cmkadmin

Useful commands

ss -tulpn | grep 6556
echo | nc <localhost> 6556
cmk-agent-ctl status



SNMP Configuration for mikrotik routers

Configuration on mikrotik

IP --> SNMP --> Communities

Create community simmy with high encryption

Bildschirmfoto 2023-12-16 um 15.05.24.png

Enable and select the trap community

Bildschirmfoto 2023-12-16 um 15.06.29.png

Configuration on checkmk

I created a folder for all mikrotik devices.

Bildschirmfoto 2023-12-16 um 15.08.41.png

Use the same community and passwords as above!

For the network scan I limited the IP-Range to the range where all mikrotik devices have their IP address.

On most of the devices I disabled the "Filesystem system disk" check, hence it would always trigger an alarm on the mikrotik defaults.

Bildschirmfoto 2023-12-16 um 15.14.16.png

 

Integration of Proxmox VE

Configuration on Proxmox VE

Create a group named read_only.

Bildschirmfoto 2023-12-16 um 15.16.30.png

Create a user named checkmk_user and add it to the group read_only.

Bildschirmfoto 2023-12-16 um 15.17.50.png

Add a group Permission:

Bildschirmfoto 2023-12-16 um 15.20.47.png

Install the Linux client.

Configuration on checkmk

Setup --> Hosts --> find and select properties of host

Bildschirmfoto 2023-12-16 um 15.31.05.png

Setup --> Agents --> VM, Cloud, Container --> Proxmox VE --> Add rule

Bildschirmfoto 2023-12-16 um 15.36.38.png

 

https://docs.checkmk.com/latest/en/

https://checkmk.com/de

 

 

 

 

Monitoring of docker services

Configuration

A very good description can be found here:

How-to-monitoring docker

Install the agent

You will need the mk_docker.py agent plug-in, which you can find here: Setup > Agents > Other operating systems > Plugins

wget http://syslog.simmy.ch/monitoring2/check_mk/agents/plugins/mk_docker.py

Install the plug-in to the agent’s plug-in folder (usually /usr/lib/check_mk_agent/plugins). 

install -m 0755 mk_docker.py /usr/lib/check_mk_agent/plugins

create the config file

Create the configuration file /etc/check_mk/docker.cfg on the Docker host. A template with detailed explanations can be found in the Checkmk directory ~/share/check_mk/agents/cfg_examples/docker.cfg.

Settings in the GUI

In addition I created a folder with the name docker-services:

Bildschirmfoto 2023-12-27 um 17.18.35.png

I had to add hosts with the names of the docker containers. 

That's all.