Hands-On Infrastructure Monitoring with Prometheus
Implement and scale queries, dashboards, and alerting across machines and containers
Joel Bastos
Pedro Arajo
BIRMINGHAM - MUMBAI
Hands-On Infrastructure Monitoring with Prometheus
Copyright 2019 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Pavan Ramchandani
Acquisition Editor: Rohit Rajkumar
Content Development Editor: Nithin George Varghese
Technical Editor: Rutuja Patade
Copy Editor: Safis Editing
Project Coordinator: Jagdish Prabhu
Proofreader: Safis Editing
Indexer: Pratik Shirodkar
Graphics: Jayalaxmi Raja
Production Coordinator: Jisha Chirayil
First published: May 2019
Production reference: 1310519
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78961-234-9
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Packt.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at customercare@packtpub.com for more details.
At www.packt.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the authors
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 blog at blog.kintoandar.com and on Twitter with the handle @kintoandar.
I would like to thank the Prometheus maintainers and community, without whom you wouldn't be reading this book, and specifically Brian Brazil for taking the time to help this project become a reality.
On a more personal note, I would like to thank my soulmate, Ana Sofia, for giving meaning to my life and keeping me sane (ish), and my family and friends for all the unconditional support.
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.
My thanks to Brian Brazil for his insightful observations and valuable feedback, to the creators and maintainers of Prometheus for their truly amazing work, and to everyone at Packt for making this book come true.
Lastly, I would like to thank my wife Ins and my children Gui and Mia for their patience, love, and support, as well as my family and friends for their encouragement.
About the reviewer
Brian Brazil is a Prometheus developer and the founder of Robust Perception. He works across the Prometheus ecosystem, and is involved in areas such as best practices, exporters, PromQL semantics, and client libraries. He is the main writer of the Reliable Insights blog, which regularly covers Prometheus topics, and is the author of the book Prometheus: Up and Running.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
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.
Next page