- Lab
- A Cloud Guru
Building a Grafana Instance to Work with Prometheus Data
Prometheus is a powerful tool for reliably collecting and serving metric data, but its built-in visualization capabilities are limited. Luckily, Prometheus can easily integrate with more robust visualization tools such as Grafana, allowing you to build robust and useful dashboards to get the most out of your data. In this lab, you will have the opportunity to build a Grafana server and configure it to access Prometheus metric data. After completing this lab, you will know how to install Grafana and integrate it with Prometheus.
Path Info
Table of Contents
-
Challenge
Install and Run Grafana
-
Log in to the Grafana server.
-
Install some required packages:
sudo apt-get install -y apt-transport-https software-properties-common wget
-
Add the GPG key for the Grafana OSS repository, then add the repository:
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main"
-
Install the Grafana package:
sudo apt-get update
sudo apt-get install grafana=6.6.2
-
Enable and start the
grafana-server
service:sudo systemctl enable grafana-server
sudo systemctl start grafana-server
-
Make sure the service is in the
active (running)
state:sudo systemctl status grafana-server
-
Verify Grafana is working by accessing it in a web browser at
http://<GRAFANA_SERVER_PUBLIC_IP>:3000
.
-
-
Challenge
Configure a Prometheus Data Source on the Grafana Server
-
Log in to Grafana with the username
admin
and passwordadmin
. -
Reset the password when prompted.
-
Click Add data source.
-
Select Prometheus.
-
For the URL, enter
http://10.0.1.101:9090
. Note that10.0.1.101
is the private IP address of the Prometheus server. -
Click Save & Test. You should see a banner that says,
Data source is working
. -
Test your setup by running a query to get some Prometheus data. Click the Explore icon on the left.
-
In the PromQL Query input, enter a simple query, such as
up
. -
Execute the query. You should see some data appear. If so, congratulations! This data comes from the Prometheus server.
-
What's a lab?
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.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.