Learn Grafana 7.0
上QQ阅读APP看书,第一时间看更新

Preface

Grafana is an open source analytics platform used to analyze and monitor time-series data. This beginner's guide will help you get to grips with Grafana's new features for querying, visualizing, and exploring metrics and logs, regardless of where they are stored.

This book begins by showing you how to install and set up the Grafana server. You'll explore the workings of various components of the Grafana interface, along with its security features, and you will learn how to visualize and monitor data using InfluxDB, Prometheus, Logstash, and Elasticsearch. This Grafana book covers the advanced features of the Graph panel and shows you how Stat, Table, Bar, Gauge, and Text are used. You'll build dynamic dashboards to perform end-to-end analytics and label and organize dashboards into folders to make them easier to find. As you progress through it, this book delves into the administrative aspects of Grafana by creating alerts, setting permissions for teams, and implementing user authentication. Along with exploring Grafana's multi-cloud monitoring support, you'll also learn about Grafana's Loki system, which is a backend logger for users running Prometheus and Kubernetes.

By the end of this book, you'll have gained all the knowledge you need to start building interactive dashboards.

Who this book is for

This book is for business intelligence developers, business analysts, data analysts, and anyone interested in performing time-series data analysis and monitoring using Grafana. Those looking to create and share interactive dashboards or looking to get up to speed with the latest features of Grafana will also find this book useful. Although no prior knowledge of Grafana is required, basic knowledge of data visualization and some experience with Python programming will help you understand the concepts covered in this book.

What this book covers

Chapter 1, Introduction to Data Visualization with Grafana, provides a brief introduction to the use of data visualization in general and specifically in Grafana. We will then move on to installing a Grafana server onto your machine, using either a native installer or a Docker container. Launching the server and connecting to it with a web browser will also be covered.

Chapter 2, A Tour of the Grafana Interface, explores the workings of the major interface components once you have loaded the Grafana web app.

Chapter 3, An Introduction to the Graph Panel, dives into the Graph panel for a closer look at how to work with the major components of the panel after creating a test data source. We will also identify common panel elements in preparation for looking at other panels.

Chapter 4, Connecting Grafana to a Data Source, shows you how to install a supported data source (such as Prometheus, InfluxDB, OpenTSDB, or Elasticsearch) as a Docker container, load an actual time-series dataset, and visualize the data.

Chapter 5, Visualizing Data in the Graph Panel, is where we will show some of the more advanced features of the Graph panel.

Chapter 6, Visualization Panels in Grafana, takes a quick tour of the other major panels (Singlestat, Table, Heatmap, and Text) and how they're used. We will hold back on looking at the Dashboard and Alert List panels for later chapters.

Chapter 7, Creating Your First Dashboard, shows how to build a simple dashboard and some panels. We will explore the major components of a dashboard. Finally, we will become familiar with the dashboard interface by moving and resizing panels.

Chapter 8, Working with Advanced Dashboard Features, explores the powerful advanced features of the dashboard, including annotations, templating with variables, and dashboard linking, as well as techniques for sharing dashboards.

Chapter 9, Grafana Alerting, shows you how to create threshold alerts in the graph and connect them to notification channels.

Chapter 10, Exploring Logs with Grafana Loki, uses Loki and Explore to answer questions about a log dataset.

Chapter 11, Organizing Dashboards, shows you how to label dashboards and organize them into folders to make them easier to find.

Chapter 12, Managing Permissions for Users and Teams, shows you how to manage user permissions using teams.

Chapter 13, Authentication with External Services, shows you how managers can connect user authentication to a variety of external services.

Chapter 14, Cloud Monitoring, shows you how Grafana can provide monitoring support for cloud service infrastructure.

To get the most out of this book

In order to complete the majority of the exercises in this book, you will need to download and install Docker with Docker Compose. For the examples in the book, we will be downloading and installing other software and datasets, along with Grafana and Loki, so you will need an internet connection. You could download and install each software package independently, but besides Grafana itself, our tutorial instructions are designed to work with Docker. We do that so that all software dependencies and network management can be encapsulated within Docker Compose.

We will run a fair amount of software from the command line, so you should be comfortable with typing commands into a shell like Bash or Windows Command Prompt:

In order to follow along with the exercises in Chapter 13, Authentication with External Services, you will need accounts with GitHub, Google, and Okta. To follow the exercises in Chapter 14, Cloud Monitoring, you will need to create an account with Amazon Web Services, Google Cloud, and Microsoft Azure.

The examples and software in this book have not been validated for security. They require an external internet connection and leverage open source software under a variety of licenses, so if you intend to use any of this software within a security-conscious computing environment (such as in an education or corporate environment), it is highly recommended that you consult your local IT professionals in advance.

If you are using the digital version of this book, we advise you to type the code in yourself or access the code via the GitHub repository (link available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code. Each chapter folder includes dashboards, docker-compose.yml files, and a Makefile to help out when running some of the command-line tools.

Having an interest in science in general and data science, in particular, will go a long way toward making this book interesting and useful. It would also be helpful to have some programming experience with a scripting language such as Python, but since all the code is included, you can run it directly from a clone of the book's GitHub repository. Some familiarity with relational databases will help you understand some of the terminology and concepts behind time-series databases.

I hope to show, with the examples in this book, how easy it is to build simple data visualization pipelines with Grafana and today's open source tools. I also hope this book will inspire and empower you to seek out your own datasets to acquire, analyze, and visualize. Best of luck!

Download the example code files

You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packt.com.
  2. Select the Support tab.
  3. Click on Code Downloads.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Learn-Grafana-7.0. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available athttps://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here:https://static.packt-cdn.com/downloads/9781838826581_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText:Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles.Here is an example:"The first line of our main() function sets up the logging level."

A block of code is set as follows:

def main():
logging.basicConfig(level=logging.INFO)

Any command-line input or output is written as follows:

          % docker-compose down
        

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Click on Create | Dashboard; you should see a panel with three buttons."

Warnings or important notes appear like this.
Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book,mention the book title in the subject of your message and email us atcustomercare@packtpub.com.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visitwww.packtpub.com/support/errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us atcopyright@packt.comwith a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visitauthors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packt.com.