0
0
Dockerdevops~20 mins

Grafana dashboards for containers in Docker - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Grafana Dashboard Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
What is the output of this Docker command for Grafana container logs?
You run the command docker logs grafana_container --tail 3. The last three log lines are:

t=2024-06-01T12:00:00Z lvl=info msg="Starting Grafana"
t=2024-06-01T12:00:01Z lvl=info msg="HTTP Server Listen"
t=2024-06-01T12:00:02Z lvl=warn msg="Data source not found"


What will be the exact output of the command?
Docker
docker logs grafana_container --tail 3
A
Starting Grafana
HTTP Server Listen
Data source not found
B
t=2024-06-01T12:00:00Z lvl=info msg="Starting Grafana"
t=2024-06-01T12:00:01Z lvl=info msg="HTTP Server Listen"
t=2024-06-01T12:00:02Z lvl=warn msg="Data source not found"
CError: No such container: grafana_container
D
t=2024-06-01T12:00:00Z lvl=info msg="Starting Grafana"
t=2024-06-01T12:00:01Z lvl=info msg="HTTP Server Listen"
Attempts:
2 left
💡 Hint
The --tail option limits the number of log lines shown, but the output includes full log lines.
Configuration
intermediate
2:00remaining
Which Docker Compose snippet correctly sets up Grafana with Prometheus as a data source?
You want to run Grafana and Prometheus containers together. Grafana should connect to Prometheus at http://prometheus:9090. Which Docker Compose service configuration for Grafana is correct?
Docker
version: '3.8'
services:
  prometheus:
    image: prom/prometheus
    ports:
      - 9090:9090
  grafana:
    image: grafana/grafana
    ports:
      - 3000:3000
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=admin
    depends_on:
      - prometheus
    # Which environment variable below correctly sets Prometheus as data source URL?
A
environment:
  - GF_DATASOURCE_PROMETHEUS_URL=http://prometheus:9090
B
environment:
  - GF_SECURITY_ADMIN_USER=prometheus
C
environment:
  - GF_DATASOURCE_URL=http://prometheus:9090
D
environment:
  - GF_SERVER_HTTP_PORT=9090
Attempts:
2 left
💡 Hint
Grafana uses environment variables starting with GF_DATASOURCE_ to configure data sources.
🔀 Workflow
advanced
2:30remaining
What is the correct order to create a Grafana dashboard for Docker container metrics?
Arrange these steps in the correct order to set up a Grafana dashboard that shows Docker container CPU and memory usage:
A3,1,2,4
B2,1,3,4
C1,3,2,4
D1,2,3,4
Attempts:
2 left
💡 Hint
You need data collection before adding data source and dashboards.
Troubleshoot
advanced
2:00remaining
Why does Grafana show 'Data source not found' error for Prometheus?
You have Grafana and Prometheus running in Docker containers. Grafana shows an error: Data source not found when trying to load Prometheus metrics. Which is the most likely cause?
AGrafana admin password is incorrect
BGrafana container port 3000 is not exposed
CPrometheus container is not running or unreachable from Grafana container
DPrometheus is running but has no metrics to serve
Attempts:
2 left
💡 Hint
Grafana needs network access to Prometheus to find the data source.
Best Practice
expert
3:00remaining
Which practice is best for maintaining Grafana dashboards for multiple Docker environments?
You manage Grafana dashboards for several Docker environments (dev, staging, production). What is the best practice to keep dashboards consistent and easy to update?
AExport dashboards as JSON files and manage them with version control
BManually edit dashboards in Grafana UI for each environment
CUse different Grafana instances with separate dashboards for each environment
DStore dashboards only inside Docker container volumes without backups
Attempts:
2 left
💡 Hint
Think about automation and tracking changes.