Difficulty: beginner
Estimated Time: 10-15 minutes

In this tutorial you will learn how to use Prometheus to scrape and store metrics from a sample application, and then use Grafana to visualize the collected metrics.

Let's get started

If you are not familiar with the OpenShift Container Platform, it's worth taking a few minutes to understand the basics of the platform as well as the environment that you will be using for this self paced tutorial. There is a scenario set up just for OpenShift introduction.

Command Line Interface

In this scenario, you should have all the commands that you need available with the instructions on how to execute them.

The command line tool that we will be using as part of this tutorial is called the oc tool. This tool is written in the Go programming language and is a single executable that is provided for Windows, MacOS, and the Linux Operating Systems. If you are familiar with Kubernetes, this tool encapsulates a lot of kubectl commands.

Web Console

OpenShift also provides a feature rich Web Console that provides a friendly graphical interface for interacting with the platform. The Web Console has both an Administrator Perspective and a Developer Perspective.

The Environment

During this tutorial you will be using a hosted OpenShift 4.2 environment that is created just for you. This environment is not shared with other users of the system.
Your environment will only be active for a one hour period. Keep this in mind before embarking on getting through the content.
Each time you start this tutorial, a new environment will be created on the fly.

Let's get started!

Feedback for this scenario

Did you like this scenario? or Do you think we can improve on something?
You can help us by providing your feedback/suggestions here.

Continue Learning

More information about the applications we used

  • Prometheus - A Cloud native application monitoring system.
  • Grafana - A data visualization tool with alerting.

How to work with Prometheus Data in Python

Time-series forecasting on Prometheus metrics

Workshops to learn more about Openshift

Deploying Prometheus and Grafana on OpenShift

Step 1 of 4

Step 1 - Example of Prometheus metrics being exposed by an application

Playing with the demo application

The demo application is a simulated E-commerce food store application that also exposes some of it's metrics (the food store application might take up to an additional minute to be initialized).

Generating some metrics

The url for the food store is: http://metrics-demo-app-metrics-demo.[[HOST_SUBDOMAIN]]-80-[[KATACODA_HOST]].environments.katacoda.com/

Demo Application Home Page

  • Once you are able to access the food store application, play around with it, try to buy the products you like [Everything here is free ;) ].
  • When you play around with the food store, you make the server serve some requests (GET/POST/..),
    some of the metrics for these requests are generated and exposed for Prometheus to collect.

Exposed metrics

The exposed metrics can be found here: http://metrics-demo-app-metrics-demo.[[HOST_SUBDOMAIN]]-80-[[KATACODA_HOST]].environments.katacoda.com/metrics

  • This is the endpoint where Prometheus will scrape (collect) metrics from periodically and store them on a persistent storage device like a hard drive (Using OpenShift PersistentVolumes).

Demo Application Metrics Page

  • If you don't see similar metrics (pictured above) in your environment, try to make an order with the ecommerce application to generate a few metrics.

Creating Katacoda Scenarios

Thanks for creating Katacoda scenarios. This tab is designed to help you as an author have quick access the information you need when creating scenarios.

This tab will not be visible to users.

Here are some useful links to get you started.

Running Katacoda Workshops

If you are planning to use Katacoda for workshops, please contact [email protected] to arrange capacity.

Debugging Scenarios

Below is the response from any background scripts run or files uploaded. This stream can aid debugging scenarios.

If you still need assistance, please contact [email protected]