Bobcares

Check_mk Docker Monitoring and Management

PDF Header PDF Footer

Check_mk docker monitoring directly monitors Docker containers through a Linux agent. And, it also keeps an eye on the container itself in addition to the demon or the overall container.

Bobcares answers all questions no matter the size, as part of our Docker hosting support

Let us take a look at check_mk docker monitoring in detail.

Check_mk and Docker Monitoring

Checkmk can discover full status information for the containers in addition to status and inventory information. It is done for the node to watch the container, and list each one as a separate host in Checkmk.

check_mk docker monitoring

Within the Checkmk Enterprise Editions, container hosts will ‘create or remove’ automatically using the dynamic configuration. Checkmk keeps track of a container’s health condition as supplied by the HEALTHCHECK API. Healthy statuses are as OK, starting statuses as WARN, and unhealthy statuses as CRIT. The health test command itself and the most recent output of the health test are on display by the plugin.

The user must install the agent plugin “mk docker.py” for this check to function. To use “Piggybacked docker containers,” the user must be employing agent bakery rules. Ensure to not omit the “docker container status” line if the user is configuring the plugin using the configuration file. The default setting is also fine.

Configuring check_mk docker monitoring

Installing the agent and plug-in

The ‘mk docker.py’ agent plug-in is required, and it may be obtained here: Configuration > Agents > Additional OSes > Plugins; in

/usr/lib/check_mk_agent/plugins
, install the plug-in. The user can also perform this with the Checkmk Enterprise Editions with the Agent Bakery. This has the proper rule set for monitoring Docker: containers and the Docker node.

Keep in mind that the docker ‘Python’ library is necessary (not docker-py). Version 2.0.0 is a minimum requirement. To quickly verify this, use python on the command line:

root@linux# python3
Python 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import docker
>>> docker.version
'5.0.3'

If necessary the user can install the library with

pip3
:

root@linux# pip3 install docker

Important: The user must not install the ‘docker-py’ or ‘python-docker-py’ packages. Hence, the Docker library is now accessible under the same namespace in an unworkable version. A single uninstall is insufficient if ‘docker-py’ (or both variants) is installed. This is because ‘pip3’ cannot correct the namespace. The user must run the following scripts to ensure the installation of the right version in this situation:

root@linux# pip3 uninstall docker-py docker root@linux# pip3 install docker

The user should now notice a few new services that have an impact on the Docker node itself. They can note the changes by running the service discovery in Checkmk and applying the changes.

 Finetuning the plug-in

The plug-various in’s parameters are configurable. For example, the user can save resources by turning off any sections. The sections don’t require or, if necessary, configuring the Docker API Engine endpoint.

On the Docker host, create the configuration

/etc/check_mk/docker.cfg
. A detailed note template can be found in the Checkmk directory
~/share/check_mk/agents/cfg_examples/docker.cfg
. With the Agent Bakery in the Enterprise Editions, the user can quickly configure all the parameters.

 Container Monitoring

Creating the container hosts

The monitoring of the Docker containers is, of course, an interesting component. Installing the plug-ins will automatically accomplish this. It won’t allocate the services to the docker node instead Checkmk presupposes a single host per docker container.

The process, in this case, is piggyback. The plug-in or special agent will transmit data from other hosts with its own data, or “piggybacks,”. The tmp/check_mk/piggyback directory will hold this information. The services will be automatically assigned to the hosts. It will be done after the user creates them in the Setup with the proper names.

The user can have these hosts established automatically in the Enterprise Editions. Utilize the Piggyback connector when configuring dynamically. If the user constructs the hosts manually, take note of the following.

  1. The hostname and the directory created in ‘tmp/check mk/piggyback’ must exactly match. This is the container’s 12-character short ID by default.
  2. Set Network address > IP address family# to No IP if the containers don’t have their own IP addresses.
  3. Ensure that Checkmk agent / API integrations, set to No API integrations and no Checkmk agent for monitoring agents.
  4. The user can enter the hostname of the Docker node in the Parents area under Basic settings.
  5. Monitor the Docker node and its containers from the same location.

After the creation of Container Hosts, and performing a service discovery, new services appear on these. New services start to show on the container hosts after creation and after a service discovery process If the user installed a Linux agent in the container, it will automatically run.

 Other names for container hosts

As previously indicated, the container host’s name is by default the 12-character short ID for the container. The user can choose to customize this differently. To accomplish this, set the

container_id
option in the configuration file
docker.cfg
to either
long
or name, depending on whether the user wants to utilize the container
name
or the full container ID as the name.

Users of Checkmk Enterprise Editions can configure this using the rule Docker node and containers, option Hostname used for containers, in the Agent Bakery.

Host name used for containers
Short - Use the first 12 characters of the docker container ID Short - Use the first 12 characters of the docker container ID
A
Long - Use the full docker container ID
'Name - Use the containers' name

Coincidentally: A user can establish rather flexible rules for renaming host names contained in piggyback data with the Access to agents > General settings > Hostname translation for piggybacked hosts rule set. The user may even fix issues like having identical containers on two distinct Docker nodes using this technique.

Host status monitoring

The host state of a container can’t truly be checked via ICMP or TCP packets. Hence another method must be used. This is made easier by the Docker container status service. It verifies that the container is running and may be used as a security tool to determine the host’s state. Create a rule in the Host Check Command rule set specifically for this purpose. Then change the choice to the indicated service under Use the status of the service… Don’t forget to configure the conditions so that they only apply to containers. In our illustration, every container is housed in a folder that has the same name.

Directly operating agent from the container

The user should ensure to install the Checkmk agent is functioning inside the container itself. It is done to monitor information there (such as active processes, databases, log files, etc.). This is particularly accurate for the implementation of agent plug-ins. However, the three plug-ins

mem
,
cpu
, and
diskstat
(Disk I/O) function without a container-based agent. Checkmk agent analyses them on the node.

The user might want to deploy the agent directly into the container, particularly for self-created Docker images. In this situation, the Docker node’s agent no longer analyzes the data as previously mentioned. Instead, each container runs a different agent. In this process, it will use the Docker node to call the agent in the piggyback process.

However, the agent in the container can only function if the container itself has all essential commands. It’s possible that fundamental components like Bash are absent. And, especially in containers made with care and based on Alpine Linux. In this case, the user should use the Docker node to monitor the container. In this situation, the Host Check Command rule set will only be necessary if the container can’t be pinged; otherwise, it will operate just as previously explained.

[Need assistance with similar queries? We are here to help]

Conclusion

To conclude the check_mk docker monitoring keep a close eye on the Docker containers. The check_mk docker monitoring keeps guard of it.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Docker Support

Spend time on your business, not on your servers.

Managing a server is time consuming. Whether you are an expert or a newbie, that is time you could use to focus on your product or service. Leave your server management to us, and use that time to focus on the growth and success of your business.

TALK TO US Or click here to learn more.

Speed issues driving customers away?
We’ve got your back!

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF