Troubleshooting VMs with SolarWinds Observability SaaS - Part Three: Working with Docker Containers
Parts One and Two of this series introduced VM metrics analysis and alerting capabilities in SolarWinds® Observability SaaS software for monitoring Azure and AWS hosted VMs. In this final installment, we’ll explore Docker containers.
Developers use Docker to package applications and their dependencies into isolated containers. Observing and monitoring the metrics affecting Docker container’s performance will help you detect and mitigate production-level issues early, enabling you to maintain optimal performance. SolarWinds Observability SaaS tools enable viewing, tracking, and correlating performance metrics for Docker containers.
This post will cover the essential metrics associated with Docker containers. We’ll also discuss strategies for troubleshooting issues and fine-tuning the performance of Docker containers using tools from SolarWinds Observability SaaS.
Key Metrics for Monitoring Docker Containers
Familiarity with the key metrics of your Docker containers is essential to better understand their performance. Let’s cover the most important metrics one by one.
CPU usage
The CPU usage metric measures the amount of processing power the Docker container consumes. Tracking CPU usage helps identify performance bottlenecks. When a container consistently uses a high CPU percentage, this may indicate inefficiencies or resource-intensive operations within the application that needs optimization. The docker stats
command provides real-time resource usage statistics for the specified container.
|
This outputs several metrics for the Docker container, including CPU usage.
|
Memory usage
The memory usage metric refers to how much RAM a Docker container uses, providing insights into the application's potential resource constraints.
The docker stats
command also outputs the memory usage for the container. It provides information about the amount of memory currently in use out of the total memory allocated to it.
Uptime
The uptime metric measures a container’s stability and reliability over time. It measures the duration for which a Docker container has been running continuously and without interruption. The Docker inspect command provides information about a container's uptime, including start time, exit code, health status, and more.
docker inspect --format '{{json .State}}' <CONTAINER_ID_OR_NAME> |
This outputs a JSON object containing the uptime information about the Docker container.
{ |
Note: Use --format '{{.State.StartedAt}}'
in the above command if you are only interested in the container’s start time.
Resource depletion
Resource depletion refers to the gradual exhaustion of system resources within a Docker container, such as CPU and memory, potentially leading to performance issues or failures.
Resource depletion for a Docker container can be measured manually by monitoring docker stats, log analysis, and custom scripts. In this article, we will look at how to automate this using Docker monitoring tools.
Number of restarts
The number of restarts metric tracks the frequency of restarts for a Docker container, indicating the reliability and stability of the containerized application. A high number may suggest ongoing issues or updates. The docker inspect
command can retrieve information about the number of restarts for a Docker container.
|
This command outputs a number indicating the number of restarts for the Docker container. If the container is healthy and has not restarted since creation, the command will output zero.
Average response time
Average response time measures a containerized application's time to respond to requests, providing insights into its performance and user experience.
You could perform a log analysis or use custom scripts to estimate the average response time. However, with SolarWinds Observability SaaS, you can easily integrate an application monitoring tool to measure response times automatically.
Container logs
Docker container logs hold records of events and activities within a container, including error messages, warnings, and other diagnostic information. This information will help you troubleshoot and monitor the application's behavior. You can use the docker logs command to view a container’s logs.
|
The command outputs the container logs, including timestamp, log level, and message.
|
The KPIs you choose for your containerized application should depend on the business goals and user expectations. Consider factors such as response time, throughput, error rates, and resource utilization, all of which will directly impact user experience. Based on your application requirements, you can prioritize optimizing specific metrics to improve the Docker container's performance.
How to Troubleshoot Performance Issues in Docker Container
Docker Monitoring capabilities in SolarWinds Observability SaaS help you track resource performance metrics, monitor deployments, and troubleshoot through metrics and log analysis. In this section, we’ll guide you through the steps to integrate Docker with SolarWinds Observability SaaS software and show how you can use it to troubleshoot issues.
Configure Docker Integration
Begin by adding the Docker integration to SolarWinds Observability SaaS. Move to the upper-right corner of the page, click Add Data, then Integrations.
Select Docker. Next, select from the list of the container hosts running SolarWinds Observability SaaS Agent. If you want to install a dedicated Agent on a dedicated host, you can add a self-managed host and then return to complete the Docker integration.
The Agent running on the container host needs to be able to access the Docker socket file. To do this, run the following command to grant the Agent user access to the Docker file:
|
Then, grant the Agent user access to the Docker logs folder:
|
Restart the Agent:
|
To complete the Docker integration, provide a display name, review the Docker socket and collection interval, then check the box to enable log monitoring. Finally, click Deploy.
Troubleshoot container issues
Once you have completed the integration setup, you can view container data in Entity Explorer.
You can also find the Docker integration in the Dashboards section.
Performance Metrics for Docker Containers
The Docker integration dashboard displays container information and performance statistics used to summarize the container’s overall health. It shows several container statistics, including those discussed in the previous section. The page displays a real-time graph of container load using CPU and memory, making it easier to detect resource depletion issues.
Individual widgets in these dashboards can be tailored to help you quickly see information to help answer your questions. For example, view historical Docker container uptime compared with established KPIs. This will clarify whether containers are performing as expected and meeting your SLAs or if any tuning needs to occur.
Monitoring Alerts and Notifications
With SolarWinds Observability SaaS, you can also configure alerts to trigger when certain conditions in your Docker container are met. You can create a new alert from scratch by selecting the Create Alert button at the top right of any page in the Alerts section.
When configuring alerts for Docker containers, you can choose from four available alert types:
For example, you can create a Logs condition alert that triggers when a certain kind of log event from your Docker containers occurs with a frequency exceeding a threshold. A Metrics condition alert lets you specify a Docker container metric to be monitored, triggering when that metric exceeds a given threshold.
From the Entity Explorer, when viewing a specific Docker container, you can create an alert directly from any given metric visualization. For example, while looking at CPU Utilization for a container, you can click Create Alert to build a new alert to monitor CPU Utilization for this specific entity.
The alert creation dialog is prefilled with this information, which you can further customize:
After configuring alert thresholds, you can define the actions to be triggered. For example, you can set up the alert to send an email notification:
Conclusion
In this series, we’ve examined the Metrics Explorer, monitoring alerting capabilities provided by SolarWinds Observability SaaS, and a solution for monitoring and optimizing cloud VM performance, regardless of your cloud provider. In Part One, we looked at how to monitor and optimize performance for VMs hosted with Azure. In Part Two, we explored using SolarWinds Observability SaaS with AWS hosted VMs.
In Part Three, we examined how Docker monitoring capabilities offered by SolarWinds Observability SaaS simplify the early detection and mitigation of Docker container performance issues. These tools, pages, and dashboards display key metrics and the health status for your containers, simplifying your task of detecting and resolving issues.
The Metrics Explorer is handy for viewing the health status of the entire container environment and filtering containers with critical or warning status. It also aids in analyzing the health of the container using historical metrics data and allows you to act on alerts and warnings.
Sign up for a free trial of SolarWinds Observability SaaS and get started with Docker monitoring.