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.
Successfully complete this lab by achieving the following learning objectives:
- 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
sudo systemctl enable grafana-server
sudo systemctl start grafana-server
Make sure the service is in the
sudo systemctl status grafana-server
Verify Grafana is working by accessing it in a web browser at
- Configure a Prometheus Data Source on the Grafana Server
Log in to Grafana with the username
Reset the password when prompted.
Click Add data source.
For the URL, enter
http://10.0.1.101:9090. Note that
10.0.1.101is 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
Execute the query. You should see some data appear. If so, congratulations! This data comes from the Prometheus server.