Machine Agent Settings for Docker Visibility

You can configure the Docker Visibility settings in the file: <machine-agent-home>/extensions/DockerMonitoring/conf/DockerMonitoring.yml  


Before you edit this file, please review "Editing YML Files: Important Notes" in Machine Agent Settings for Server Visibility.

Property

Description

Default

cgroupEnabled

The Machine Agent can collect Memory and CPU metrics for Docker containers using cgroupdata. This method is much faster than using the Docker API (the default metric-collection method). You can enable cgroupmetriccollection on all platforms except Amazon Linux OS. With the cgroupEnabled flag set to true, the Machine Agent can monitor up to 600 containers per host. When cgroup is enabled, you do not have to update the Docker Metric Collector Pool Size. The max container limit is independent of this.

This mode is disabled by default. To enable cgroupmetriccollection, run the agent with the following command-line option set to true:

java -Dappdynamics.docker.container.collection.cgroup.enabled=true  -jar machineagent.jar
JAVA
true

containerProcessSelectorRegex

The Machine Agent can monitor up to 150 running containers (depending on the pool size configuration, described below). The agent collects metrics from containers with one or more running processes whose command line matches a configurable regex. By default, the value of this regex is ".*" and matches all containers irrespective of the processes running in them. If you cannot restart the APM agents, or if you to want to filter APM agents based on another command-line argument, you can override this behavior by editing this regex.

Default = ".*"

".*"
criticalProcessSelectorRegex

In some scenarios, it's essential to ensure that certain critical processes are always monitored by the Machine Agent, regardless of their resource consumption or other exclusion criteria. The criticalProcessSelectorRegex setting allows you to specify a regular expression that identifies these critical processes based on their command line. This feature requires Controller 24.10.0 or later and Machine Agent 24.10.0 or later. 

Examples:

    1.    Substring Match: criticalProcessSelectorRegex: "redis|postgres|nginx|mysql|apache2|httpd|java|python|node"

        •    This regex matches any process whose command line contains any of the specified keywords (e.g., redis, postgres, etc.).

        •    Use this format to monitor processes based on partial matches in the command line.

    2.    Whole Word Match: criticalProcessSelectorRegex: "\b(redis|postgres|nginx|mysql|apache2|httpd|java|python|node)\b"

        •    This regex ensures that only exact matches of the process names are considered critical.

        •    Use this format to avoid partial matches and ensure the entire word matches (e.g., redis but not redis-server).

  • Ensure the regular expression is correctly formatted to avoid unintended matches.

  • Regular expressions are case-sensitive by default. For case-insensitive matching, use the appropriate regex flags (for example, use <?i> for case-insensitive).


 

docker.metric.collector.pool.size

Specify the local limit for the number of containers the agent can monitor. The effective limit for each agent is the minimum amount for:

  • The sim.docker.machine.container.limit on the Controller (default limit = 15 containers), or
  • The Docker Metric Collector Pool Size on the agent (default pool size = 3, or 90 containers).

You can change this setting to monitor up to 120 containers (pool size = 4) or 150 containers (pool size = 5). The trade-off is that increasing the pool size might lead to higher resource consumption on the agent host.

To change the pool size, set these properties:

System Property

-Dappdynamics.docker.metric.collector.pool.size
YML
Environment Variable
APPDYNAMICS_DOCKER_METRIC_COLLECTOR_POOL_SIZE
YML

default limit = 15 containers

default pool size = 3, or 90 containers

dockerTagsEnabledEnable (default) or disable the collection of Docker tags from containers monitored by the Machine Agent.
docker.use.container.name.selector

Use the Machine Agent to identify containers by container names only.

By default for Docker monitoring, the Machine Agent obtains a list of containers. For each container, the Machine Agent retrieves all running processes inside the container. Then, the Machine Agent matches the container to be monitored by the process full command line. Because there are many containers, the selection process lasts longer than a minute, causing gaps in reporting container metrics.

The Docker Use Container Name Selector configuration option provides an alternative way to select containers to be monitored by using the container's name.  This option allows the Machine Agent to run significantly faster since the Machine Agent does not have to gather all the processes for each container.

To enable matching with the container name, you can either use an environment variable or a JVM property. If both are defined, the environment variable is used.

System Property

-Dappdynamics.docker.use.container.name.selector=false
YML

Environment Variable

APPDYNAMICS_DOCKER_USE_CONTAINER_NAME_SELECTOR=false
YML
You can select which containers to be monitored by providing the regular expression, containerNameSelectorRegex, to match the container names. By default, the Machine Agent matches all container names. Regular expressions are part of the extensions/DockerMonitoring/conf/DockerMonitoring.yml file.

To exclude containers from monitoring, use an environment variable or the JVM property. If both are defined, the environment variable is used.

# default value
".*(machine-agent|machineagent).*"

# environment variable
export APPDYNAMICS_DOCKER_CONTAINER_NAME_SELECTOR_BLACKLIST_REGEX=".*(machine-agent|machineagent).*"

# JVM property
-Dappdynamics.docker.container.name.selector.blacklist.regex=".*(machine-agent|machineagent).*"
YML
# default value
".*(machine-agent|machineagent).*"

Controller Settings for Docker Visibility

For information about how to configure these settings, see Controller Settings for Machine Agents.

Property

Description

Default

sim.docker.apmNode.markHistorical.enabledEnables configuration to mark the APM node historical when a container running the app agent is stopped.true

sim.docker.enabled

Enable the Docker Monitoring feature.true

sim.docker.machine.container.limit

Global limit for the number of containers that each Machine Agent can monitor. The effective limit for each agent is a minimum of

  • The sim.docker.machine.container.limit on the Controller (default limit = 15 containers), or
  • The Docker Metric Collector Pool Size on the agent (default pool size = 3, or 90 containers).

You can specify this in the Administration Console as a Controller setting (all accounts) or as an Account setting for individual accounts. 150 is the maximum limit you can specify.

15

sim.machines.reuse.enabled

Reuse SIM Machine entities to handle an ephemeral environment. Support is currently limited to Docker container machines.

If set to false, each new container is considered a new machine.

true

sim.machines.tags.enabled

Enable or disable the import of Docker tags to the Controller.true