Reader small image

You're reading from  Hands-On Infrastructure Monitoring with Prometheus

Product typeBook
Published inMay 2019
PublisherPackt
ISBN-139781789612349
Edition1st Edition
Right arrow
Authors (2):
Joel Bastos
Joel Bastos
author image
Joel Bastos

Joel Bastos is an open source supporter and contributor, with a background in infrastructure security and automation. He is always striving for the standardization of processes, code maintainability, and code reusability. He has defined, led, and implemented critical, highly available, and fault-tolerant enterprise and web-scale infrastructures in several organizations, with Prometheus as the cornerstone. He has worked at two unicorn companies in Portugal and at one of the largest transaction-oriented gaming companies in the world. Previously, he has supported several governmental entities with projects such as the Public Key Infrastructure for the Portuguese citizen card. You can find his blogs at kintoandar and on Twitter with the handle @kintoandar.
Read more about Joel Bastos

Pedro Araújo
Pedro Araújo
author image
Pedro Araújo

Pedro Arajo is a site reliability and automation engineer and has defined and implemented several standards for monitoring at scale. His contributions have been fundamental in connecting development teams to infrastructure. He is highly knowledgeable about infrastructure, but his passion is in the automation and management of large-scale, highly-transactional systems. Pedro has contributed to several open source projects, such as Riemann, OpenTSDB, Sensu, Prometheus, and Thanos. You can find him on Twitter with the handle @phcrva.
Read more about Pedro Araújo

View More author details
Right arrow

Preface

Introduction to the book and the technology

This book about Prometheus, the second project to graduate within the Cloud Native Computing Foundation (CNCF), will help you to crystallize the core fundamentals of monitoring and the approaches available to ensure the required infrastructure visibility. It relies on practical examples, using test environments and diagrams, to communicate knowledge in an easy-to-digest manner.

The content was designed to ensure that all the important Prometheus stack concepts are tackled. Our main goal during the writing process was to aim the book at our past selves and ensure that they would have everything they needed to know about this technology in this book.

From running one Prometheus server, to what scaling options are available, from creating and testing alerting rules, to templating slack notifications; and from useful dashboards, to automating target discovery; many other topics will be explained to ensure a full knowledge base on infrastructure monitoring using Prometheus as its cornerstone.

Who this book is for

If you're a software developer, cloud specialist, site reliability engineer, DevOps enthusiast, or a system administrator looking to set up a reliable monitoring and alerting system to sustain infrastructure security and performance, this book is for you. Basic networking and infrastructure monitoring knowledge will help you understand the concepts covered in this book.

What this book covers

Chapter 1, Monitoring Fundamentals, lays the foundations of several key concepts that are used throughout the book. This chapter also explores the approach Prometheus takes to metric collection and why some controversial decisions are vital for the design and architecture of its stack.

Chapter 2, An Overview of the Prometheus Ecosystem, introduces a high-level overview of the entire Prometheus ecosystem, which components perform which jobs, and how everything interoperates logically.

Chapter 3, Setting Up a Test Environment, presents the fundamentals of how to use the test environments provided throughout the book, and how to tinker with them to validate different configurations.

Chapter 4, Prometheus Metrics Fundamentals, explores metrics, the core resource of Prometheus. Understanding them correctly is essential to fully utilize, manage, or even extend the Prometheus stack.

Chapter 5, Running a Prometheus Server, focuses on the Prometheus server, providing common patterns of usage and full setup process scenarios for virtual machines and containers.

Chapter 6, Exporters and Integrations, introduces some of the most useful exporters available, as well as providing examples on how to use them.

Chapter 7, Prometheus Query Language – PromQL, dives into the powerful and flexible Prometheus query language to leverage its multi-dimensional data model, which allows ad hoc aggregation and the combination of time series.

Chapter 8, Troubleshooting and Validation, provides useful guidelines on how to quickly detect and fix problems. It also presents useful endpoints that expose critical information and explores promtool, the Prometheus command-line interface and validation tool.

Chapter 9, Defining Alerting and Recording Rules, covers the usage and testing of recording and alerting rules, providing examples along the way.

Chapter 10, Discovering and Creating Grafana Dashboards, delves into the visualization components of the Prometheus stack, covering not only the built-in console functionality but also exploring Grafana and how to build, share, and reuse dashboards.

Chapter 11, Understanding and Extending Alertmanager, introduces the alerting component of the stack, showing how to integrate it with several different alerting providers, and how to correctly set up clustering to enable high-availability with the deduplication of alerts.

Chapter 12, Choosing the Right Service Discovery, explores multiple service discovery integrations, as well as providing you with the requirements and knowledge to build your own integration if required.

Chapter 13, Scaling and Federating Prometheus, tackles the scaling of a Prometheus stack and introduces concepts such as sharding and global views, while providing context and explaining them.

Chapter 14, Integrating Long-Term Storage with Prometheus, covers the concepts of the Prometheus read and write endpoints. Then, it deep-dives into considerations for external and long-term metric storage. Finally, it introduces an end-to-end example using Thanos.

To get the most out of this book

Basic knowledge of monitoring, networking, and containers is useful but is not mandatory.

All the test environments were validated using macOS and Linux, while enforcing specific software versions for added compatibility, so those are the best candidates to guarantee you won't run into issues. Chapter 3, Setting Up a Test Environment, provides all the technical information on this subject.

Decent internet connectivity is required to download the software dependencies, as is a modern browser to ensure access to all the web interfaces presented in the book.

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/Hands-On-Infrastructure-Monitoring-with-Prometheus. 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 at https://github.com/PacktPublishing/. Check them out!

Download the color images

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: "Now, you can run vagrant status."

A block of code is set as follows:

 annotations:
description: "Node exporter {{ .Labels.instance }} is down."
link: "https://example.com"

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

 annotations:
description: "Node exporter {{ .Labels.instance }} is down."
link: "https://example.com"

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

vagrant up

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: "You can find this page by going into Status | Rules on the top bar."

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 at customercare@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 visit www.packtpub.com/submit/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 at copyright@packt.com with 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 visit authors.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.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Hands-On Infrastructure Monitoring with Prometheus
Published in: May 2019Publisher: PacktISBN-13: 9781789612349
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

Authors (2)

author image
Joel Bastos

Joel Bastos is an open source supporter and contributor, with a background in infrastructure security and automation. He is always striving for the standardization of processes, code maintainability, and code reusability. He has defined, led, and implemented critical, highly available, and fault-tolerant enterprise and web-scale infrastructures in several organizations, with Prometheus as the cornerstone. He has worked at two unicorn companies in Portugal and at one of the largest transaction-oriented gaming companies in the world. Previously, he has supported several governmental entities with projects such as the Public Key Infrastructure for the Portuguese citizen card. You can find his blogs at kintoandar and on Twitter with the handle @kintoandar.
Read more about Joel Bastos

author image
Pedro Araújo

Pedro Arajo is a site reliability and automation engineer and has defined and implemented several standards for monitoring at scale. His contributions have been fundamental in connecting development teams to infrastructure. He is highly knowledgeable about infrastructure, but his passion is in the automation and management of large-scale, highly-transactional systems. Pedro has contributed to several open source projects, such as Riemann, OpenTSDB, Sensu, Prometheus, and Thanos. You can find him on Twitter with the handle @phcrva.
Read more about Pedro Araújo