How can I add Docker integration into my Azure Managed Grafana instance?

Jorge Garcia Dominguez 0 Reputation points
2024-11-07T14:53:16.4466667+00:00

How can I add Docker integration into my Azure Managed Grafana instance?
Currently, Docker integration to monitor docker containers in any environment is supported by Grafana, but I cannot find the connection in the connection list.

Azure Managed Grafana
Azure Managed Grafana
An Azure service used to deploy Grafana dashboards for analytics and monitoring solutions.
111 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. brtrach-MSFT 16,671 Reputation points Microsoft Employee
    2024-11-07T22:44:33.2933333+00:00

    @Jorge Garcia Dominguez You will need to use Prometheus as there is no direct connection provided.

    Step 1: Set Up Docker Monitoring with Prometheus

    First, you need to set up Docker monitoring using Prometheus, which will collect the metrics from Docker containers.

    1. Install Prometheus: You can run Prometheus in a Docker container. Create a prometheus.yml configuration file:
         global:
           scrape_interval: 15s
         scrape_configs:
           - job_name: 'docker'
             static_configs:
               - targets: ['localhost:9323']
      
    2. Run Prometheus Container:
         docker run -d --name=prometheus -p 9090:9090 -v $(pwd)/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
      
    3. Install cAdvisor: cAdvisor collects container metrics and exposes them to Prometheus.
         docker run \
           --volume=/:/rootfs:ro \
           --volume=/var/run:/var/run:ro \
           --volume=/sys:/sys:ro \
           --volume=/var/lib/docker/:/var/lib/docker:ro \
           --publish=9323:9323 \
           --detach=true \
           --name=cadvisor \
           google/cadvisor:latest
         
      

    Step 2: Configure Azure Managed Grafana to Use Prometheus

    Now, you need to configure your Azure Managed Grafana to use Prometheus as a data source.

    1. Log in to Azure Managed Grafana: Open your Azure Managed Grafana instance.
    2. Add Prometheus Data Source:
      • Navigate to Configuration > Data Sources.
      • Click on Add data source.
      • Select Prometheus from the list.
      • Configure the Prometheus URL. If Prometheus is running locally, the URL will be http://<your-prometheus-host>:9090.
      • Click Save & Test to ensure the connection is working.

    Step 3: Import Docker Monitoring Dashboard

    Grafana provides pre-built dashboards for Docker monitoring.

    1. Import Dashboard:
      • In your Azure Managed Grafana, go to Create > Import.
      • You can find popular Docker monitoring dashboards on Grafana Dashboards. For example, dashboard ID 893 is a common Docker monitoring dashboard.
      • Enter the dashboard ID and click Load.
      • Select the Prometheus data source you configured earlier.
      • Click Import.

    Step 4: Visualize Docker Metrics

    Once the dashboard is imported, you should start seeing Docker metrics visualized in Grafana. The dashboard will display various metrics such as CPU usage, memory usage, network I/O, and more for your Docker containers.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.