Skip to main content

Docker

Overview​

Docker is a set of platform as a service (PaaS) products that uses OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating system kernel and therefore use fewer resources than virtual machines.

The service has both free and premium tiers. The software that hosts the containers is called Docker Engine. It was first started in 2013 and is developed by Docker, Inc.

Monitoring Connector assets​

Monitored objects​

  • Nodes
  • Containers

Monitored metrics​

More information about gathered metrics can be found into Docker official API documentation : https://docs.docker.com/engine/api/v1.30/

Metric nameDescription
NameName of the container.
State_nameReal state of the container.
read_ioThe average number of read bytes from disk per second. Unit: Bytes/Second
Write_ioThe average number of written bytes on disk per second. Unit: Bytes/Second
Cpu_total_usageThe percentage of CPU usage. Unit: Percent
Cpu_system_usageThe average amount of time taken per disk I/O write operation. Unit: Seconds
Memory_usageThe percentage of memory usage. Units: Percent & Bytes
Traffic_inThe percentage of inbound traffic usage. Units: Percent & Bytes/Second
Traffic_outThe percentage of outbound traffic usage. Units: Percent & Bytes/Second

Prerequisites​

API connection​

Open your favorite ssh client and configure your API to allow connections from the outside:

  • vi /lib/systemd/system/docker.service
  • Modify the line starting with ExecStart as shown below:
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H=tcp://0.0.0.0:2375
  • Save the changes
  • Apply the changes made at the systemd level : systemctl daemon-reload
  • Restart the Docker engine: systemctl restart docker

Installation​

  1. Install the plugin on every poller expected to monitor Docker resources:
yum install centreon-plugin-Applications-Docker-Restapi
  1. Install the "Docker-Restapi" Centreon Monitoring Connector from the Configuration > Monitoring Connector Manager page

Host Configuration​

Apply the "App-Docker-Restapi-custom" template to your newly created host. Then fill the macros value fileds marked as mandatory below:

MandatoryNameDescription
XDOCKERENGINEPORTDocker API TCP port to use to query the Docker engine
DOCKERENGINEEXTRAOPTIONSDocker API engine extra options

FAQ​

Why are some of my checks are very slow ?​

The container stats endpoint can be pretty slow to return a result (between 1 and 2 second), so it's considered as normal that the container-stats check may take some time.

How can I test my plugin through the CLI and what does the main command_line parameters mean ?​

Once you've installed your monitoring plugin, you can use the centreon-engine user to test it!

/usr/lib/centreon/plugins//centreon_docker_restapi.pl \
--plugin=cloud::docker::restapi::plugin \
--mode=node-status \
--hostname='192.168.0.50' \
--port='2375' \
--warning-node-status='' \
--critical-node-status='%{status} !~ /ready/ || %{manager_status} !~ /reachable|-/' \
--verbose

OK: Node '192.168.0.50' Containers Running : 7, Containers Stopped : 2, Containers Paused : 0 | 'containers_running'=7;;;0; 'containers_stopped'=2;;;0; 'containers_paused'=0;;;0;
Node '192.168.0.50' Containers Running : 7, Containers Stopped : 2, Containers Paused : 0

This command checks your docker engine node status (--mode=node-status) using tcp port 2375 (--port='2375'). It provides the overall status of the node and state of each container it manages.

A CRITICAL alert is triggered if your node is not considered as ready or the manager cannot be reached (--critical-node-status='%{status} !~ /ready/ || %{manager_status} !~ /reachable|-/')