Monitor Containers with Docker Visibility
Use the Machine Agent to monitor application nodes running inside Docker containers and to identify container issues that impact application performance. By viewing and comparing APM metrics with the underlying container and server/machine metrics, you can easily answer the question, is my application problem purely an application problem, or is the root cause in the container or the server?
Note
Container monitoring requires a Server Visibility license (>=4.3.3) for both the Controller and the Machine Agent.
You should deploy the Machine Agent inside a Docker container. The Machine Agent collects metrics for Docker containers on the same host, and it collects server and machine metrics for the host itself. The Controller shows all monitored containers for each host as well as the container and host IDs for each container.
In the BRIDGE networking mode, the containers take on the container ID as the host name. If networking is in host mode, the containers take on the node name of the host ID. This means every container on that node has the same host ID. In this case, you need to use the unique host ID settings. When you’re using Docker Visibility, if the unique host ID setting is not configured to use container ID in host network mode, the Machine Agent automatically registers the container using the container ID as the host ID. If you have an older version of the Controller or Machine Agent, AppDynamics recommends that you upgrade to Machine Agent version 20.7 or later.
With Controller version 20.11.0 or later:
• If the Machine Agent is 20.7.0 or later, the Machine Agent automatically registers the container using the container ID as the host ID. No further action is needed.
• If the Machine Agent is 20.6.0 or earlier and is configured incorrectly, the Controller rejects the misconfigured containers registration.
By default, the Machine Agent only monitors containers that have a running APM Agent. You can change this by setting the sim.docker.monitorAPMContainersOnly property on the Controller.
Note
To deploy a Machine Agent on a host outside a Docker container, create a symbolic link (ln -s / /hostroot) on the host. This symbolic link enables the Machine Agent to collect host metrics with Docker container metrics. When you deploy a Machine Agent inside a Docker container for monitoring, the symbolic link is automatically created when the volume mounts. To grant more restrictive permissions, enter this command to create symbolic links: ln -s /proc /hostroot/proc; ln -s /sys /hostroot/sys; ln -s /etc /hostroot/etc. You can make these links read-only because the AppDynamics Agent does not need write privileges to these directories.
Figure 4-34 illustrates how to deploy container monitoring, as detailed in the following list:
Figure 4-34 How to deploy container monitoring
• Install the Machine Agent in a standalone container. The Machine Agent collects hardware metrics for each monitored container, as well as Machine and Server metrics for the host , and forwards the metrics to the Controller.
• The Machine Agent can monitor all containers that are running on that host, subject to established limits, and will report runtime metrics and metadata for every container. Additionally, if any of the containers have an APM Agent installed , the Machine Agent also correlates the container metadata and runtime metrics with the associated APM Node.
Enable Container Monitoring
Follow these steps to enable Container Monitoring:
Step 1. On the Controller, log in to the Administration Console and verify that sim.docker.enabled is set to true.
Step 2. On the Agent, enable Server Visibility and Docker Visibility.
Container Monitoring Setup
The quickest and easiest way to run the Machine Agent with Container Monitoring enabled is to use one of the official images from the Docker Store (https://store.docker.com/images/appdynamics). These images are produced by AppDynamics, based on certified base images from the Docker Community, and can either be run directly or used as base images for your own application containers. For full details of how to download and run containers based on these official images, see the documentation posted on the Docker Store. To build your own base images, the full source code for building these images is posted to GitHub. You can use this as a pattern for your own builds (https://github.com/Appdynamics/appdynamics-docker-images).
For the Machine Agent to monitor containers running on the server, configure these settings:
• Server Visibility Enabled: Enable Server Visibility
• Docker Enabled: Enable Docker Visibility
• Volume Mounts: Specify one of the following:
• Volume mounts to allow read-only access to the underlying file system (/proc, /etc and /sys). This allows the Server Agent to collect host-level metrics for containers running on the server.
• The UNIX domain socket on which the Docker daemon is configured to listen for API calls.
View Container Details
Follow these steps to view container metadata and metrics in the Controller:
Step 1. In the Applications Dashboard, go to Containers to see all monitored containers used by the application.
Figure 4-35 shows an example of the Applications Dashboard.
Figure 4-35 Applications Dashboard
Step 2. In the Servers Dashboard, go to Containers to see all monitored containers on that host.
Figure 4-36 shows the Servers Dashboard.
Figure 4-36 Servers Dashboard
Step 3. To open the Container Dashboard, right-click the container name and choose View Details.
Figure 4-37 shows the Container Dashboard.
Figure 4-37 Container Dashboard
The Container Details view contains the following tabs, which provide an overview of the health and resource usage for the container:
• Overview: Container metadata, tags (name-value pairs derived from Docker/Kubernetes) and AWS tags where applicable, and single chart views for CPU, memory, network, and disk usage.
• CPU: CPU Usage and Throttled Time metrics.
• Memory: Memory Usage and Memory Fault metrics.
Step 4. The Node Dashboard also includes a Container tab for the container in which that node is running. Figure 4-38 illustrates the Container tab.
Figure 4-38 Container tab
View Container Metrics Using the Metric Browser
To view time-series metric data for containers, double-click one of container metric graphs (CPU, Memory, Network, or Disk) to open the Metric Browser with the displayed metric selected. The Metric Browser tree displays the full set of metrics available for that container, and you can add these to the Metric Browser display by double-clicking the metric you wish to select. Figure 4-39 shows an example of Container Metrics.
Figure 4-39 Container Metrics