Skip to main content

Monitor:Docker Monitor

Collect and monitor general performance Metrics of Docker containers.

Pre-monitoring operations

If you want to monitor the container information in Docker, you need to open the port according to the following steps, so that the collection request can obtain the corresponding information.

1. Edit the docker.server file:

vi /usr/lib/systemd/system/docker.service

Find the [Service] node, modify the ExecStart property, and add -H tcp://0.0.0.0:2375

ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H tcp://0.0.0.0:2375

This is equivalent to the 2375 port that is open to the outside world. Of course, it can be modified to other ports according to your own situation.

2. Reload the Docker configuration to take effect:

systemctl daemon-reload
systemctl restart docker

Note: Remember to open the 2375 port number in the server console.

3. If the above method does not work:

Open the 2375 port number inside the server.

firewall-cmd --zone=public --add-port=2375/tcp --permanent
firewall-cmd --reload

Configuration parameters

Parameter nameParameter help description
Monitor HostMonitored peer IPV4, IPV6 or domain name. Note ⚠️ without protocol headers (eg: https://, http://).
Monitor NameIdentifies the name of this monitor. The name needs to be unique.
PortThe port provided by the database externally, the default is 2375.
Query TimeoutSet the timeout when getting the Docker server API interface, in ms, the default is 3000 ms.
Container NameGenerally monitors all running container information.
usernameconnection username, optional
passwordconnection password, optional
URLDatabase connection URL, optional, if configured, the parameters such as database name, username and password in the URL will override the parameters configured above
Collection IntervalMonitor periodical collection data interval, in seconds, the minimum interval that can be set is 30 seconds
Whether to detectWhether to detect and check the availability of monitoring before adding monitoring, and then continue to add and modify operations if the detection is successful
Description RemarksMore remarks that identify and describe this monitoring, users can remark information here

Collect metrics

Metric collection: system

Metric NameMetric UnitMetric Help Description
NameNoneServer Name
versionnonedocker version number
osnoneserver version eg: linux x86_64
root_dirnonedocker folder directory eg: /var/lib/docker
containersNoneTotal number of containers (running + not running)
containers_runningNoneNumber of running containers
containers_pausednonenumber of containers in pause
imagesNoneThe total number of container images.
ncpunonencpu
mem_totalMBTotal size of memory used
system_timenonesystem time

Metric collection: containers

Metric NameMetric UnitMetric Help Description
idNoneThe ID of the container in Docker
nameNoneThe container name in the Docker container
imageNoneImage used by the Docker container
commandNoneDefault startup command in Docker
stateNoneThe running state of the container in Docker
statusNoneUpdate time in Docker container

Metrics collection: stats

Metric NameMetric UnitMetric Help Description
nameNoneThe name in the Docker container
available_memoryMBThe amount of memory that the Docker container can utilize
used_memoryMBThe amount of memory already used by the Docker container
memory_usageNoneMemory usage of the Docker container
cpu_deltaNoneThe number of CPUs already used by the Docker container
number_cpusNoneThe number of CPUs that the Docker container can use
cpu_usageNoneDocker container CPU usage