Working with Prometheus Metric Types

45 minutes
  • 3 Learning Objectives

About this Hands-on Lab

Prometheus exporters provide data using a handful of different metric types, each representing its own unique kind of data. When working with Prometheus, it is important to understand how these different metric types function in order to properly interpret data. In this lab, you will have the opportunity to collect data from metrics that utilize a variety of different metric types. This will allow you to work with multiple metric types hands-on.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Get the Value of the `mobile_gateway_restarts` Counter
  1. Access the Prometheus expression browser in your web browser using the Public IP address of the Prometheus server:

    http://<PROMETHEUS_SERVER_PUBLIC_IP>:9090
  2. Run a query to get the value of the mobile_gateway_restarts counter:

    mobile_gateway_restarts
  3. Log in to the Prometheus server and open the report file:

    vi /home/cloud_user/report.md
  4. Add the number of restarts to the appropriate line in the file for the mobile_gateway_restarts metric.

Get the Value of the `mobile_gateway_mem_available` Gauge
  1. From the Prometheus expression browser, run a query to get the value of the mobile_gateway_mem_available gauge:

    mobile_gateway_mem_available
  2. On the Prometheus server, add the current available memory to the appropriate line in the file for the mobile_gateway_mem_available metric.

Get the Requested Data from the `mobile_gateway_request_duration_seconds` Histogram
  1. From the Prometheus expression browser, run a query to get the value of the mobile_gateway_request_duration_seconds bucket le="3":

    mobile_gateway_request_duration_seconds_bucket{le="3"}
  2. On the Prometheus server, add the number of requests in the three-second bucket to the appropriate line in the file for the mobile_gateway_request_duration_seconds{le="3"} metric.

  3. Return to the Prometheus expression browser and run a query to get the total count for the mobile_gateway_request_duration_seconds histogram:

    mobile_gateway_request_duration_seconds_count
  4. Add the total count to the appropriate line in the report.md file for the mobile_gateway_request_duration_seconds_count metric.

Additional Resources

Your company, LimeDrop, uses Prometheus to monitor a variety of systems. One of the applications monitored by Prometheus is a gateway API that supports the LimeDrop mobile app. The data from this application contains metrics that use several different metric types. You have been asked to provide some metric data about the application for later review. You will find a file on the Prometheus server located at /home/cloud_user/report.md. Collect the requested data and enter the values into that file to complete the report.

Locate the following metric data and save it in report.md:

  • Get the current value of the mobile_gateway_restarts counter. This counter measures the number of restarts for the backend gateway that supports the LimeDrop mobile app.
  • Get the current value of the mobile_gateway_mem_available gauge. This gauge measures the amount of free memory available to the application.
  • There is a histogram metric called mobile_gateway_request_duration_seconds that tracks HTTP requests to the application in buckets by their duration. Obtain the value for the number of requests in the le="3" bucket.
  • Get the _count value for the mobile_gateway_request_duration_seconds histogram.

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.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

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