Building a Grafana Instance to Work with Prometheus Data

45 minutes
  • 2 Learning Objectives

About this Hands-on Lab

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.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Install and Run Grafana
  1. Log in to the Grafana server.

  2. Install some required packages:

    sudo apt-get install -y apt-transport-https software-properties-common wget
  3. 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"
  4. Install the Grafana package:

    sudo apt-get update
    sudo apt-get install grafana=6.6.2
  5. Enable and start the grafana-server service:

    sudo systemctl enable grafana-server
    sudo systemctl start grafana-server
  6. Make sure the service is in the active (running) state:

    sudo systemctl status grafana-server
  7. Verify Grafana is working by accessing it in a web browser at http://<GRAFANA_SERVER_PUBLIC_IP>:3000.

Configure a Prometheus Data Source on the Grafana Server
  1. Log in to Grafana with the username admin and password admin.

  2. Reset the password when prompted.

  3. Click Add data source.

  4. Select Prometheus.

  5. For the URL, enter http://10.0.1.101:9090. Note that 10.0.1.101 is the private IP address of the Prometheus server.

  6. Click Save & Test. You should see a banner that says, Data source is working.

  7. Test your setup by running a query to get some Prometheus data. Click the Explore icon on the left.

  8. In the PromQL Query input, enter a simple query, such as up.

  9. Execute the query. You should see some data appear. If so, congratulations! This data comes from the Prometheus server.

Additional Resources

Your company, LimeDrop, has a Prometheus server collecting metrics for a variety of applications and infrastructure components. Your admins have been able to query Prometheus for data as well as build a few useful console templates, but it has become clear that a more robust visualization tool is needed.

You will need to do the following:

  • Install Grafana on the provided Grafana server.
  • Configure Grafana to pull metric data from the Prometheus server.

What are Hands-on Labs

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.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?