Plugin Docker

Docker statistics monitoring plugin

Introduction

Ver. 230821
This plugin is used to monitor the statistics of a Docker environment.
Type: mixed plugin

Compatibility matrix

This plugin has been developed using Docker version 18.03.1-ce, build 9ee9f40.

Prerequisites

It requires connection with the Tentacle service associated to your Pandora FMS server (for local executions of the plugin).
local executions of the plugin) under the following conditions:

If you have as_server_plugin enabled.

Configuration

General plugin settings

## Launch a pre-command before invoke docker commands
#pre_command = eval $(docker-machine env ml1)
docker = docker

## Log file
log_file = /tmp/pandora_docker.log

pre_command
Configures an environment preload command prior to executing the commands to extract information.
commands to extract information. Define the following content if you use docker_machine:

pre_command = eval $(docker-machine env node_name).

docker
Location of the complete docker binary, if it exists in the system PATH you can leave the default value 'docker'.
the default 'docker' value

log_file
Location and name of the log file to be used by the plugin.

General configuration

## Agent configuration
#agent_name = My Docker agent # hostname by default
agent_interval = 300 
agent_group = Docker

## Module interval
module_interval = 1
#module_tags = docker,stats
module_group = Docker

## Per container metrics, creates one agent per container.
metrics_per_container = 1

## Prefix for agent names per container by default "Docker"
metrics_per_container_prefix = Docker

## Plugin work mode, .by default as agent plugin
as_server_plugin = 0

agent_interval
Sets the agent interval value.

agent_group
Sets the group of agents and cluster views that will be created in Pandora
FMS Console.

module_interval
It is a multiplicative factor of the agent interval value. It defines the execution interval of the modules.
execution interval of the modules. It will prevent the modules from going unknown if we have that
the plugin execution interval is bigger than the agent one.

module_tags
Defines the list of tags that will be applied to the modules generated by the plugin.
They should be previously defined in Pandora FMS.

module_group
Defines the module group in which the modules generated by the plugin will be classified.
plugin. It should be previously defined in Pandora FMS.

metrics_per_container

Indicates that we want metrics for each container, so it generates one agent per container with its independent metrics. If this parameter is enabled, several agents are generated, so the plugin cannot be executed as an agent plugin, when it is enabled the plugin changes its mode to server plugin.

metrics_per_container_prefix

Prefix for agent names for each container, by default "Docker".

as_server_plugin

Changes the plugin type to server plugin.

Execution modes and data transfer

## Pandora Server configuration, Only neede if as_server_plugin is enabled
mode = local
temp = /tmp

## local config
local_folder = /var/spool/pandora/data_in

## tentacle config -- only if mode = tentacle
tentacle_ip = test.artica.es
tentacle_port = 41121
tentacle_opts = 
tentacle_client = tentacle_client

mode
XML file transfer mode, can be:
● local: copies the files to local_folder.
● tentacle: transfers the files to tentacle_ip via tentacle_port

temp
Temporary location where to store the files before sending them.

local_folder
Location where to move the files in local mode.

tentacle_ip
IP address or FQDN where Pandora FMS is working.

tentacle_port
Port where the Tentacle service associated to your Pandora FMS server is listening.
listening.

tentacle_opts
Extra options for the Tentacle client.

tentacle_client
Path where to find the tentacle client binary.

Manual execution

To run the plug-in, configure the configuration file according to the instructions above.
preceding.

./docker_stats.64 docker_stats.conf

When running the plugin with the as_server_plugin parameter enabled in the terminal, the result should look like this:

image-1629790903062.png

When executed without as_server_plugin, or better said. as an agent plugin, it will return an XML:

image-1629790951756.png

 

Scheduled execution

It can be executed as a server plugin, as module_plugin in an agent, or from the system cron.

Modules generated by the plugin

If the metrics_per_container parameter is not defined, it only generates an agent with the general docker statistics of the machine.

In case it is enabled, it generates an agent per container, with the specific statistics of that container, and also an agent with the general statistics of the node.

Docker blocks in Docker writing blocks
Docker blocks out Docker reading blocks
Docker cpu usage Docker CPU usage
Docker memory usage Docker RAM usage
Docker network input Docker input traffic
Docker network output Docker output traffic

image-1629720775362.png