0
0
Dockerdevops~10 mins

Prometheus for Docker monitoring - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start a Prometheus container with the official image.

Docker
docker run -d --name prometheus [1] prom/prometheus
Drag options to blanks, or click blank then click option'
A-p 9090:9090
B-p 8080:8080
C-p 3000:3000
D-p 80:80
Attempts:
3 left
💡 Hint
Common Mistakes
Mapping the wrong port like 8080 or 3000 which are not Prometheus default ports.
Forgetting to expose any port so you can't access Prometheus UI.
2fill in blank
medium

Complete the command to mount a local Prometheus configuration file into the container.

Docker
docker run -d --name prometheus -p 9090:9090 -v [1]:/etc/prometheus/prometheus.yml prom/prometheus
Drag options to blanks, or click blank then click option'
A/etc/prometheus/prometheus.yml
B/var/lib/prometheus/data
C/home/user/prometheus.yml
D/home/user/data
Attempts:
3 left
💡 Hint
Common Mistakes
Mounting a directory instead of the config file.
Using the wrong local path that does not exist.
3fill in blank
hard

Fix the error in the Prometheus scrape config to monitor Docker metrics.

Docker
scrape_configs:
  - job_name: 'docker'
    static_configs:
      - targets: ['[1]']
Drag options to blanks, or click blank then click option'
Alocalhost:9100
Blocalhost:2375
Clocalhost:8080
Dlocalhost:9090
Attempts:
3 left
💡 Hint
Common Mistakes
Using the Prometheus port 9090 as a target.
Using node exporter port 9100 which is unrelated to Docker metrics.
4fill in blank
hard

Fill both blanks to configure Prometheus to scrape metrics from Docker and node exporter.

Docker
scrape_configs:
  - job_name: 'docker'
    static_configs:
      - targets: ['[1]']
  - job_name: 'node'
    static_configs:
      - targets: ['[2]']
Drag options to blanks, or click blank then click option'
Alocalhost:2375
Blocalhost:9100
Clocalhost:9090
Dlocalhost:8080
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up ports for Docker and node exporter.
Using Prometheus port 9090 as a scrape target.
5fill in blank
hard

Fill all three blanks to create a Docker Compose service for Prometheus with port mapping and config volume.

Docker
services:
  prometheus:
    image: prom/prometheus
    ports:
      - '[1]:9090'
    volumes:
      - '[2]:/etc/prometheus/prometheus.yml'
    command:
      - '--config.file=[3]'
Drag options to blanks, or click blank then click option'
A9090
B/home/user/prometheus.yml
C/etc/prometheus/prometheus.yml
Dprometheus.yml
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong port numbers or paths.
Not specifying the config file path in the command.