Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Google Cloud Platform icon
Labs

Using Grafana with Prometheus for Alerting and Monitoring

For the last six months, the Acme Anvil Corporation has been migrating some of their bare metal infrastructure to Docker containers. The team has set up Prometheus using cAdvisor to help monitor containers. After running Prometheus in the production environment for a few weeks, the team has decided to add Grafana for visualization and alerting.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Sep 23, 2025
Duration
1h 30m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Configure Docker.

    Open port 9323 in the firewall.

    firewall-cmd --zone=public --add-port=9323/tcp
    

    Open /etc/docker/daemon.json and add the following.

    {
      "metrics-addr" : "0.0.0.0:9323",
      "experimental" : true
    }
    
  2. Challenge

    Update `prometheus.yml`.

    Edit the prometheus.yml file in the /root directory.

    vi ~/prometheus.yml
    

    Change the contents to reflect the following:

    scrape_configs:
      - job_name: prometheus
        scrape_interval: 5s
        static_configs:
        - targets:
          - prometheus:9090
          - node-exporter:9100
          - pushgateway:9091
          - cadvisor:8080
    
      - job_name: docker
        scrape_interval: 5s
        static_configs:
        - targets:
          - PRIVATE_IP_ADDRESS:9323
    
  3. Challenge

    Update `docker-compose.yml`.

    Edit docker-compose.yml in the /root directory.

    vi ~/docker-compose.yml
    

    Change the contents to reflect the following:

    version: '3'
    services:
      prometheus:
        image: prom/prometheus:latest
        container_name: prometheus
        ports:
          - 9090:9090
        command:
          - --config.file=/etc/prometheus/prometheus.yml
        volumes:
          - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
        depends_on:
          - cadvisor
      cadvisor:
        image: google/cadvisor:latest
        container_name: cadvisor
        ports:
          - 8080:8080
        volumes:
          - /:/rootfs:ro
          - /var/run:/var/run:rw
          - /sys:/sys:ro
          - /var/lib/docker/:/var/lib/docker:ro
      pushgateway:
        image: prom/pushgateway
        container_name: pushgateway
        ports:
          - 9091:9091
      node-exporter:
        image: prom/node-exporter:latest
        container_name: node-exporter
        restart: unless-stopped
        expose:
          - 9100
      grafana:
        image: grafana/grafana:5.3.0
        container_name: grafana
        ports:
          - 3000:3000
        environment:
          - GF_SECURITY_ADMIN_PASSWORD=password
        depends_on:
          - prometheus
          - cadvisor
    
    
  4. Challenge

    Install the Docker and System Monitoring dashboard.

    Click the plus sign (+) on the left side of the Grafana interface. Click Import. Copy the contents of the JSON file included in the lab instructions.

    Paste the contents of the JSON file into the Import screen of the Grafana interface, and click Load. In the upper right-hand corner, click on Refresh every 5m and select Last 5 minutes.

About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight