IT Infrastructure monitoring is complex, but a tool like Checkmk makes it easier.
Many organizations have added cloud-native technologies to their tech stack to enhance the performance of their products. At the same time, they often continue to run their own networks and on-premises infrastructure. This shift to hybrid infrastructures needs to be addressed in monitoring due to the huge number of metrics being generated every second for various components such as operating system, storage, server, cloud environments, etc. They all are important to make sure applications run at peak performance.
These metrics are an essential signal for DevOps teams to understand the health of their infrastructure. This is why organizations need a monitoring solution to help them quickly identify issues in production with metrics, visualizations, and analytics. Checkmk is one of the most popular and helpful infrastructure monitoring tools. In this article, I will tell you why Checkmk deserves its good reputation and how you can take the first steps with it.
What is Checkmk?
Checkmk constantly checks the function of any aspect of modern IT environments and is especially well-suited for hybrid infrastructures. On the one hand, Checkmk is flexible and supports containers, cloud assets, and on-premises systems such as switches and servers. On the other hand, it is really easy to get started and manage your monitoring, because Checkmk comes with automatic alerts based on a lot of IT expertise and other intelligent features that will save you a lot of time.
If you want to use Checkmk for free, you have two options: First, you can go for the Checkmk Raw Edition, which is completely open-source and free to use without any limitations. Second, there is the Checkmk Enterprise Trial Edition that has all the additional features of the Checkmk Enterprise Editions, but after 30 days the number of hosts will be limited to 25.
How does Checkmk solve the problem?
Checkmk can monitor applications, servers, databases, networks, containers, storage, and whatnot. It provides a massive list of over 2,000 monitoring plug-ins. With these plug-ins. Checkmk can be extended to monitor specific technologies from different vendors available on the market. A few popular Checkmk plug-ins are for Docker, Kubernetes, Cisco, Nginx, VMware, Linux, Windows, AWS, Dell. With its 2,000+ plug-ins, Checkmk stands out as a very promising infrastructure monitoring solution available currently.
Also, for any monitoring solution, it is crucial how fast and correctly they can read the metrics and set up smart alerting and notifications. Checkmk’s solution meets all these criteria. With its auto-discovery feature, Checkmk can identify more than 90% of services and devices. Now, most businesses require scalability and automation. You can scale monitoring capacity from hundred hosts to thousands of hosts with ease in Checkmk and leverage its agents available for automation.
Install Checkmk in a Docker container
In this article, I am going to install the Checkmk Raw Edition in a Docker container on a Linux server running on Ubuntu 20.04. From Dockerhub, you can download the Checkmk Docker container. It has almost 5 million+ pulls so far, which tells how popular and widely used Checkmk is.
Take the Docker image with the latest Checkmk version and run it inside a container by using the command
docker container run.
docker container run -dit -p 8080:5000 --tmpfs /opt/omd/sites/cmk/tmp:uid=1000,gid=1000 -v monitoring:/omd/sites --name monitoring -v /etc/localtime:/etc/localtime:ro --restart always checkmk/check-mk-raw:2.0.0-latest
The name of the container will be ‘monitoring’, the webserver will listen to port 5000 and open at port 8080 of the node. The container will use the temporary file system and local time zone.
[email protected]:~$ sudo docker container run -dit -p 8080:5000 --tmpfs /opt/omd/sites/cmk/tmp:uid=1000,gid=1000 -v/omd/sites --name monitoring -v/etc/localtime:/etc/localtime:ro --restart always checkmk/check-mk-raw:2.0.0-latest Unable to find image 'checkmk/check-mk-raw:2.0.0-latest' locally 2.0.0-latest: Pulling from checkmk/check-mk-raw 33847f680f63: Pull complete 474905f2790b: Pull complete 1804f0e63047: Pull complete f36fe6334464: Pull complete 03c68dfa69cf: Pull complete b60cfdb78e96: Pull complete Digest: sha256:7788fa2e31c7270be201d75285c13ccc7a74f67f991872ea63ba0cfa6708cac6 Status: Downloaded newer image for checkmk/check-mk-raw:2.0.0-latest 9729e323a840a08b0e758cfa9e6dbf76ba5dab4b2ecc4eea5174b8ee1a5cfbcf
You can check if the Docker image got downloaded by running the command
[email protected]:~$ sudo docker images REPOSITORY TAG IMAGE ID CREATED SIZE bitnami/node-exporter latest ba0f519ca49b 34 hours ago 104MB checkmk/check-mk-raw 2.0.0-latest 097319702432 13 days ago 1.03GB hello-world latest feb5d9fea6a5 7 weeks ago 13.3kB
Run the command
docker ps to see if the Checkmk container is running.
[email protected]:~$ sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9729e323a840 checkmk/check-mk-raw:2.0.0-latest "/docker-entrypoint.…" About a minute ago Up 59 seconds (health: starting) 6557/tcp, 0.0.0.0:8080->5000/tcp, :::8080->5000/tcp monitoring 3d3a95ed3c25 bitnami/node-exporter:latest "/opt/bitnami/node-e…" 25 hours ago Up 25 hours 9100/tcp node-exporter
To get the login details for the Checkmk web interface, print the Checkmk container log.
[email protected]:~$ sudo docker container logs 9729e323a840 ### CREATING SITE 'cmk' Adding /opt/omd/sites/cmk/tmp to /etc/fstab. Going to set TMPFS to off. Temporary filesystem already mounted Updating core configuration... Generating configuration for core (type nagios)...Precompiling host checks...OK OK Executing post-create script "01_create-sample-config.py"...OK Created new site cmk with version 2.0.0p15.cre. The site can be started with omd start cmk. The default web UI is available at http://9729e323a840/cmk/ The admin user for the web applications is cmkadmin with password: ClFxBPre For command line administration of the site, log in with 'omd su cmk'. After logging in, you can change the password for cmkadmin with 'htpasswd etc/htpasswd cmkadmin'. ### STARTING XINETD [ ok ] Starting internet superserver: xinetd. ### STARTING SITE Temporary filesystem already mounted Starting mkeventd...OK Starting rrdcached...OK Starting npcd...OK Starting nagios...OK Starting apache...OK Starting redis...OK Initializing Crontab...OK ### STARTING CRON ### CONTAINER STARTED
The Checkmk Docker container will run by default at https://localhost:8080/cmk/check_mk. The output of the above command tells you the username is cmkadmin and the password, in my case the password is ClFxBPre. Open the address in a web browser and use your credentials to log in.
Once you log in, this is the ’Main dashboard’ that will appear. It is empty because you did not add any hosts yet.
Monitor Docker Using Checkmk
Usually, you would install the Checkmk agent on your machine that is hosting your Docker containers and then use the Checkmk plug-in for Docker to monitor all containers. This plug-in (mk_docker.py) uses Docker’s Python-API to track Docker containers and gain full visibility into their real-time status and performance. You can read more details about Docker monitoring with Checkmk on the Checkmk website.
Because in my Docker environment there is only one Docker container running, my Checkmk Docker container, I will just use the Checkmk agent running in the Docker container and will not install the Checkmk on my Docker host. The agent is pre-installed in the Checkmk container, thus, I just have to add my Checkmk container as host.
Let’s get the IP address on which the Docker service is running by using
ifconfig on the terminal.
[email protected]:~$ ifconfig docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255 inet6 fe80::42:59ff:fe8a:8ba8 prefixlen 64 scopeid 0x20<link> ether 02:42:59:8a:8b:a8 txqueuelen 0 (Ethernet) RX packets 5559 bytes 7230215 (7.2 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 4164 bytes 614703 (614.7 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.0.108 netmask 255.255.255.0 broadcast 192.168.0.255 inet6 fe80::144a:4682:35e7:bb2 prefixlen 64 scopeid 0x20<link> ether 08:00:27:91:82:82 txqueuelen 1000 (Ethernet) RX packets 699491 bytes 1044235622 (1.0 GB) RX errors 0 dropped 7 overruns 0 frame 0 TX packets 101260 bytes 7555470 (7.5 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 20655 bytes 8446042 (8.4 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 20655 bytes 8446042 (8.4 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 veth44ba5ce: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet6 fe80::145f:1fff:fee9:a7b0 prefixlen 64 scopeid 0x20<link> ether 16:5f:1f:e9:a7:b0 txqueuelen 0 (Ethernet) RX packets 5559 bytes 7308041 (7.3 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 4173 bytes 616263 (616.2 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 vetha82ee43: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet6 fe80::585c:6fff:fe0a:a79b prefixlen 64 scopeid 0x20<link> ether 5a:5c:6f:0a:a7:9b txqueuelen 0 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 92 bytes 9799 (9.7 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
In my case, the Docker service is running on
172.17.0.1. The next step is to add the Docker service as a host in Checkmk so that it can be monitored.
- Go to Checkmk and click on Setup -> Hosts.
- Click on “Add host.”
- Now provide the hostname and the IP address and click on ‘Save & go to the service configuration’.
- Once you do that, Checkmk will start the service discovery automatically.
Scroll down to see the monitoring services running under the Docker host. You can see the services are not getting monitored currently. If you want to monitor everything, the easiest solution is clicking on ‘Fix all’. If you want to configure which services should be monitored, you can do this in detail as well. Click on the + sign if you want to monitor a service.
Once you select the services you want to monitor, they will come in the ‘Monitored services’ tab. You will get all the status details for each service you are monitoring. If you click on ? sign, that service will move to the undecided services list. If you click on the X sign, the service will move to the ‘Disabled services’ tab.
I have disabled four services, so I can see them in the disables services tab.
When you are done with adding the services, you need to activate the changes before they go into production.
- Click on the highlighted field with the yellow exclamation point (!) at the top right corner to see the pending changes.
- Click on Activate on selected sites.
You have successfully monitored Docker services using Checkmk!
So that was all about Checkmk, an infrastructure monitoring tool. It is a very easy-to-use tool that you must try to monitor your production environments. I recommend trying the Checkmk Free Edition to start your monitoring.
- Tagged in:
More great readings on Performance
10 Best Real Time Bandwidth Monitors for Network Traffic UsageAshlin Jenifa on May 17, 2022
How to Reset Your PC Graphics CardDhruv Parmar on May 16, 2022
Wi-Fi Repeater vs Extender: Which One Should You Buy?Satish Shethi on May 10, 2022
8 Best NetFlow Analyzers and Collector Tools for Your NetworkAshlin Jenifa on May 7, 2022
How to Enable ‘God Mode’ in Windows 10/11Dhruv Parmar on May 5, 2022
9 Best File Uploader Solutions for Modern ApplicationsAmrita Pathak on May 4, 2022
Join Geekflare Newsletter
Every week we share trending articles and tools in our newsletter. More than 10,000 people enjoy reading, and you will love it too.