Locating Time-Series Data in Prometheus

30 minutes
  • 2 Learning Objectives

About this Hands-on Lab

Prometheus allows you to collect a wide variety of metric data in one location. It also provides useful tools for exploring and querying your data. In this lab, you will have the opportunity to perform some very basic queries to obtain some data from a Prometheus server. You will obtain the current value of a metric, and you will also look up a set of multiple time-series values for that metric.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Get the Current Temperature of the Data Center
  1. In a browser, access the Prometheus expression browser:

    http://<PROMETHEUS_SERVER_PUBLIC_IP>:9090
  2. Run a query to obtain the current datacenter_temp:

    datacenter_temp
  3. Copy the current temperature value.

  4. Log in to the Prometheus server and open the file that will contain the temperature data:

    vi /home/cloud_user/current_temp.txt
  5. Enter or paste in the current temperature value obtained from the Prometheus expression browser, and then save the file.

Get All Time-Series Entries for the Data Center Temperature Over the Last Five Minutes
  1. In the Prometheus expression browser, run a query to obtain the data:

    datacenter_temp[5m]
  2. Copy all the values (including the timestamps).

  3. Return to the Prometheus server terminal and open the file that will contain the data:

    vi /home/cloud_user/5_minute_temp.txt
  4. Paste in the time-series data obtained from the Prometheus expression browser, and save the file.

Additional Resources

Your company, LimeDrop, has an on-site data center. They are hoping to move the data center's functionality to the cloud in the future, but in the meantime it needs to be kept up and running. Unfortunately, some of the cooling equipment has been having issues, leading to temperature fluctuations.

Last week, you set up a Prometheus server to provide a central place to collect metrics for LimeDrop's large infrastructure. One of your data center admins set up the Prometheus server to collect the current temperature of the data center from a digital thermometer system.

You have been asked to check on the current status of the data center temperature using metrics collected by Prometheus. Obtain the current temperature and save the value to a file on the server. Then, obtain all the time-series temperature values collected over the last five minutes and save them to a file as well.

Some additional details:

  • The data center temperature data is stored in a metric called datacenter_temp.
  • Save the current temperature to the file /home/cloud_user/current_temp.txt.
  • Save the temperature values for the last five minutes to the file /home/cloud_user/5_minute_temp.txt.

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?