Reader small image

You're reading from  Learn Grafana 10.x - Second Edition

Product typeBook
Published inDec 2023
PublisherPackt
ISBN-139781803231082
Edition2nd Edition
Right arrow
Author (1)
Eric Salituro
Eric Salituro
author image
Eric Salituro

Eric Salituro is currently a Software Engineering Manger with the Enterprise Data and Analytics Platform team at Zendesk. He has an IT career spanning over 30 years, over 20 of which were in the motion picture industry working as a pipeline technical director and software developer for innovative and creative studios like DreamWorks, Digital Domain, and Pixar. Before moving to Zendesk, he worked at Pixar helping to manage and maintain their production render farm as a Senior Software Developer. Among his accomplishments there was the development of a Python API toolkit for Grafana aimed at streamlining the creation of rendering metrics dashboards
Read more about Eric Salituro

Right arrow

Diving into Grafana's Time Series Visualization

We’ve now come to the chapter you’ve hopefully been waiting for – using Grafana to actually graph something. In this chapter, we will examine a basic object to query and visualize data – the panel. Within a single panel, you will find the ability to visualize data in a myriad of ways.

While there are a number of different panel visualizations to choose from, the most common one used to produce beautifully styled metrics is the time series (formerly graph) visualization. It is one of the most versatile panel visualizations, and on first viewing, it seems to have an intimidating set of features. Due to this, we will take a broad overview approach to the panel before diving into the details in later chapters.

Much like we did in Chapter 2, Touring the Grafana Interface in this chapter, we will break down the major UI elements that comprise a panel.

In this chapter, we’ll cover the following...

Touring the Grafana panel UI

Here is a typical Grafana panel in edit mode:

Figure 3.1 – The edit panel UI

Figure 3.1 – The edit panel UI

The panel’s UI can be broken down into roughly three main functional areas as demarcated in the preceding screenshot:

  1. Panel display: A preview display and a time picker
  2. Options settings: The panel visualization type, styles, and links
  3. Panel tabs: Data query, data transformation, and alerting

Throughout this chapter, we will delve into each of these areas. First, we will look at the Query tab in the context of how to use it to produce graphed data. Then, we will explore how the various panel settings shape the look of the graph and how to set typical panel display features, such as a title. Finally, we will see how the Alert tab can establish monitoring rules for thresholds that, when exceeded, can trigger alerts. Of course, all of this is dependent on what we’ll create first – a simple data source...

Generating data series in the Query tab

Let’s take a closer look at the Query tab, also called the Query Editor. To open a panel editor, click on the panel title and select Edit from the pulldown menu. If it isn’t already selected, click on the Query tab to select it. The Query tab is where we assign a data source to the panel’s queries. We’ll take a closer look at the Query tab shortly.

With TestData set as the default data source, Grafana also sets up Random Walk to be the default query scenario, so we are now ready to go with both a data source and a scenario that produces the displayed dataset series.

Before we delve further into the Query tab, we should probably talk a bit about its purpose. Unlike some visualization tools that are designed to connect to a single data source, Grafana is data source-agnostic. The Grafana data source plugins are not only responsible for presenting the Grafana user with a simplified query interface but also for structuring...

Editing the panel settings

On the right-hand side of the graph display, you’ll find the panel settings area, where you’ll find a boatload of features to tailor the look of your panel, including changing the visualization entirely.

Figure 3.6 – Panel settings

Figure 3.6 – Panel settings

The panel’s myriad of options is available from one easily accessed column, with each one featuring a disclosure control so that you only need to see the options relevant to the task at hand.

Selecting panel visualizations

The data frame architecture of Grafana allows for many graphs to be made from the same query datasets. The selection of a visualization serves as a quick mechanism to switch out the current panel visualization for a different one. Clicking on the Visualization tab reveals a list of possible visualizations installed in Grafana. Use the Search box to help filter down by name the number of panels in the listing.

There are so many Grafana visualizations...

Monitoring with the Alert tab

In this section, we will take a peek at the Alert tab. We will take a much more in-depth look at alerting in Chapter 12, Monitoring Data Streams with Grafana Alerts, so at this point, I just want to show how alert creation, which we saw briefly in the last chapter, is tied to the panel visualization. Clicking on Create an alert rule from this panel will bring up an interface that can also be displayed by selecting Alerting | Alert rules | Create alert rule from the side menu.

Figure 3.15 – Alert rule creation

Figure 3.15 – Alert rule creation

The interface will automatically select queries from the panel. It is from those queries that you select the one that will serve as the alert monitor. While we don’t have the necessary knowledge to do so yet, ultimately you be looking to create a query or expression that will answer the question, “During the evaluation time period, is there a condition that requires the triggering of an alert?”...

Further exploration

I invite you to play around with the various settings, especially those in the Visualization panel. Here are some simple exercises for you to try out:

  1. Create multiple data series in the Query tab. Try out the different scenarios to see how they create different kinds of data. Rearrange the order to see what effect it has on the graph.
  2. Play with different combinations of drawing objects in the Display section. Change the fill or size of points, lines, and bars.
  3. Turn on the legend and test out its many options. Try clicking on various elements in the legend itself – you might find some surprises!

It’s always a good idea to try things out, break them, and then figure out how to fix them. That’s how we learn – not just by following instructions in a book (although you wouldn’t be here if wasn’t also a good way to learn!)

Summary

This chapter completes Part 1, Getting Started with Grafana. In this part, we installed the Grafana server, checked out the Grafana application interface, set up some simple dashboards, and graphed test data sources. In the next part, Part 2, Real-World Grafana, we’ll start looking more deeply at these same features and learn how to use them in more realistic scenarios.

We’ll start Chapter 4, Connecting Grafana to a Prometheus Data Source, by building a simple data pipeline with a Prometheus data source, which we’ll query in Grafana Explore. The patterns established in the chapter will be the foundation for building even more complex pipelines in later chapters.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Learn Grafana 10.x - Second Edition
Published in: Dec 2023Publisher: PacktISBN-13: 9781803231082
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Eric Salituro

Eric Salituro is currently a Software Engineering Manger with the Enterprise Data and Analytics Platform team at Zendesk. He has an IT career spanning over 30 years, over 20 of which were in the motion picture industry working as a pipeline technical director and software developer for innovative and creative studios like DreamWorks, Digital Domain, and Pixar. Before moving to Zendesk, he worked at Pixar helping to manage and maintain their production render farm as a Senior Software Developer. Among his accomplishments there was the development of a Python API toolkit for Grafana aimed at streamlining the creation of rendering metrics dashboards
Read more about Eric Salituro