Skip to main content

Using Grafana to Visualize Prometheus Data

Hands-On Lab

 

Photo of Elle Krout

Elle Krout

Content Team Lead in Content

Length

00:30:00

Difficulty

Intermediate

While Prometheus is a wonderful took for keep track of our metrics, its graphing and dashboard capabilities leave a lot to be desired. This is where Grafana comes in. Grafana allows us to create beautiful persistent dashboards using our Prometheus data. These dashboards let us gain insight in the parts of our infrastructure that are most important to us, without having to continually manually query with PromQL or viewing and click on our recording rules. From our Node Exporter data to tracking our current alerts, Grafana provides us with visual insight into what's happening.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Adding Dashboards

  1. Access the Grafana dashboard at PUBLICIP:3000 on the monitoring server; log in using the admin username and admin password, changing the password when prompted.

  2. Click Add data source from the home page. Add the Prometheus data source by setting the URL to http://localhost:9090. Save & Test.

  3. Click the Dashboards tab. Import the Prometheus 2.0 Stats and Grafana metrics dashboards.

  4. Click the plus sign on the side menu, then select Import.

  5. In a new window or tab, open the Grafana community dashboard website and find the "Node Exporter Full" dashboard. Copy the dashboard ID.

  6. Return to your Grafana instance. Paste in the ID, then set the data source to our Prometheus option. Import the dashboard.

  7. Click the plus sign again, this time selecting Dashboard from the options. Click the cog icon on the top of the screen and rename the dashboard to Forethought. Save.

Adding a Panel

  1. Click the Add panel button. Select Heatmap.

  2. Click the panel title, then click Edit.

  3. Set the metric so that is track the average of all of our response times via bucker:

    sum(rate(forethought_request_hist_bucket[30s])) by (le)

    Ensure the Legend is also set to {{le}}

  4. Switch to the Axes tab and change the Data Format to Time series buckets.

  5. Return to the dashboard and Save the changes.