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

Monitoring Infrastructure and Containers with Prometheus

Prometheus is able to monitor our infrastructure and applications at multiple levels: on the host itself, on any containers, and on the application. In this hands-on lab, we're going to address the first two options for monitoring: our virtual machine host and our containers. We'll first set up monitoring for our virtual machine by using Prometheus's Node Exporter, and then we'll set up container monitoring for the provided container using Google's cAdvisor. By the time we're done, we'll be able to view metrics across two levels of our system in Prometheus to track changes and view trends on our systems.

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

Contact sales

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

    Set up the Node Exporter.

    Work on the application server.

    1. Create a system user:

      $ sudo useradd --no-create-home --shell /bin/false node_exporter
      
    2. Download the Node Exporter from Prometheus's download page:

      $ cd /tmp/
      $ wget https://github.com/prometheus/node_exporter/releases/download/v0.17.0/node_exporter-0.17.0.linux-amd64.tar.gz
      
    3. Extract its contents:

      $ tar -xvf node_exporter-0.17.0.linux-amd64.tar.gz
      
    4. Move into the newly-created directory:

      $ cd node_exporter-0.17.0.linux-amd64/
      
    5. Move the provided binary:

      $ sudo mv node_exporter /usr/local/bin/
      
    6. Set the ownership:

      $ sudo chown node_exporter:node_exporter /usr/local/bin/node_exporter
      
    7. Create a systemd service file:

      $ sudo vim /etc/systemd/system/node_exporter.service
      
      [Unit]
      Description=Node Exporter
      After=network.target
      
      [Service]
      User=node_exporter
      Group=node_exporter
      Type=simple
      ExecStart=/usr/local/bin/node_exporter
      
      [Install]
      WantedBy=multi-user.target
      

      Save and exit when done.

    8. Start the Node Exporter:

      $ sudo systemctl start node_exporter
      
  2. Challenge

    Set up cAdvisor.

    Work on the application server.

    1. Launch cAdvisor:

      $ sudo docker run 
        --volume=/:/rootfs:ro 
        --volume=/var/run:/var/run:ro 
        --volume=/sys:/sys:ro 
        --volume=/var/lib/docker/:/var/lib/docker:ro 
        --volume=/dev/disk/:/dev/disk:ro 
        --publish=8000:8080 
        --detach=true 
        --name=cadvisor 
        google/cadvisor:latest
      
    2. List available containers to confirm it's working:

      $ docker ps
      
  3. Challenge

    Add the new endpoints to Prometheus.

    Work on the monitoring server.

    1. Open the Prometheus configuration file:

      $ sudo vim /etc/prometheus/prometheus.yml
      
    2. Add the Node Exporter and cAdvisor endpoints:

      - job_name: 'node_exporter'
        static_configs:
        - targets: ['10.0.1.101:9100']
      - job_name: 'cadvisor'
        static_configs:
        - targets: ['10.0.1.101:8000']
      
    3. Save and exit.

    4. Restart Prometheus:

      $ sudo systemctl restart prometheus
      
    5. Check the Targets page on the web UI to ensure the endpoints are working.

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