Prometheus and Grafana create a powerful combination. Grafana allows you to build useful visualizations on top of your Prometheus metric data. In this lab, you will have the opportunity to build a Grafana dashboard to visualize Prometheus metrics. This will give you some hands-on experience with building useful Grafana dashboards on top of Prometheus.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Create the Dashboard and Add a Web Server Status Panel
Click the Create button on the left, and then select Dashboard.
Click the Save Dashboard button near the top right. For the dashboard name, enter "LimeDrop Web Server", and then save.
Click the Add Panel button near the top right, and then Add Query.
For the PromQL query, enter:
up{instance="limedrop-web:9100"}
Click the Visualization icon. Click the visualization type dropdown that currently says Graph and change it to Singlestat.
Under
Value Mappings
, enter twovalue to text
mappings:1
->Up
0
->Down
Click the General icon.
Change the panel title to "Server Status".
Click the back button in the top left. You should see your dashboard, and the Server Status panel should say
Up
.Click the Save Dashboard button near the top right, and then Save to save your changes.
- Create a CPU Usage Graph Panel
Navigate to the
LimeDrop Web Server
dashboard.Click the Add Panel button near the top right, and then Add Query.
For the PromQL query, enter:
sum(rate(node_cpu_seconds_total{instance='limedrop-web:9100',mode!='idle'}[5m])) * 100
Click the General icon, and change the panel title to "CPU Usage".
Click the back button in the top left. You should see your dashboard, and there should be a graph showing CPU utilization.
Click the Save Dashboard button near the top right, and then Save to save your changes.
- Create a Memory Usage Graph Panel
Click the Add Panel button near the top right, and then Add Query.
For the PromQL query, enter:
100 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes) * 100
Click the General icon, and change the panel title to "Memory Usage".
Click the back button in the top left. You should see your dashboard, and there should be a graph showing memory utilization.
Rearrange your panels by dragging and dropping them if desired.
Click the Save Dashboard button near the top right, and then Save to save your changes.