Puppet Reporting and Monitoring
()
About this ebook
Michael Duffy
Michael Duffy is Time’s executive editor and Washington bureau chief and directs coverage of presidents, politics, and national affairs for the magazine.
Read more from Michael Duffy
Learning DevOps: Continuously Deliver Better Software Rating: 5 out of 5 stars5/5World War Noir: Sydney's unpatriotic war Rating: 0 out of 5 stars0 ratingsSydney Noir: The Golden Years Rating: 0 out of 5 stars0 ratingsFrom Chicago to Vietnam: A Memoir of War Rating: 0 out of 5 stars0 ratingsBlackberries and Their Hybrids Rating: 0 out of 5 stars0 ratings
Related to Puppet Reporting and Monitoring
Related ebooks
Drush for Developers - Second Edition Rating: 0 out of 5 stars0 ratingsApache Mahout Clustering Designs Rating: 0 out of 5 stars0 ratingsInstant Hands-on Testing with PHPUnit How-to Rating: 0 out of 5 stars0 ratingsPython Data Persistence Rating: 0 out of 5 stars0 ratingsDevOps Tools Standard Requirements Rating: 0 out of 5 stars0 ratingsDevOps Implementation Roadmap Third Edition Rating: 0 out of 5 stars0 ratingsChaos Engineering A Clear and Concise Reference Rating: 0 out of 5 stars0 ratingsAzure AD Join A Complete Guide Rating: 0 out of 5 stars0 ratingsHybrid Cloud Architecture A Complete Guide - 2021 Edition Rating: 0 out of 5 stars0 ratingsOpenProject The Ultimate Step-By-Step Guide Rating: 0 out of 5 stars0 ratingsInfrastructure As A Code A Complete Guide - 2021 Edition Rating: 0 out of 5 stars0 ratingsSoftware Documentation Strategy A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsAzure Monitor A Clear and Concise Reference Rating: 0 out of 5 stars0 ratingsADFS A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsCitrix XenApp A Complete Guide - 2021 Edition Rating: 0 out of 5 stars0 ratingsActive Directory Migrations The Ultimate Step-By-Step Guide Rating: 0 out of 5 stars0 ratingsAgile DevOps A Complete Guide - 2021 Edition Rating: 0 out of 5 stars0 ratingsRed Hat Ansible Third Edition Rating: 0 out of 5 stars0 ratingsAzure Iot A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsNosql A Complete Guide - 2019 Edition Rating: 0 out of 5 stars0 ratingsIoT Architecture A Complete Guide - 2019 Edition Rating: 0 out of 5 stars0 ratingsThe DevOps Mokitas: Avoid the Elephants in Your DevOps Adoption: A Handbook of Devops Mistakes to Avoid Rating: 0 out of 5 stars0 ratingsKubernetes Secrets Management Rating: 0 out of 5 stars0 ratingsuser stories A Complete Guide - 2019 Edition Rating: 0 out of 5 stars0 ratingsSCCM A Complete Guide - 2019 Edition Rating: 0 out of 5 stars0 ratingsPerformance Testing Strategy A Complete Guide Rating: 0 out of 5 stars0 ratingsDocker Swarm Mode A Clear and Concise Reference Rating: 0 out of 5 stars0 ratingsKubernetes A Complete Guide - 2019 Edition Rating: 0 out of 5 stars0 ratingsOn Premises Virtual Machines A Complete Guide - 2021 Edition Rating: 0 out of 5 stars0 ratingsEnterprise End-to-End Testing Second Edition Rating: 0 out of 5 stars0 ratings
Operating Systems For You
Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Learn Windows PowerShell in a Month of Lunches Rating: 0 out of 5 stars0 ratingsWindows 11 All-in-One For Dummies Rating: 5 out of 5 stars5/5Hacking Essentials - The Beginner's Guide To Ethical Hacking And Penetration Testing Rating: 3 out of 5 stars3/5Windows 11 For Dummies Rating: 0 out of 5 stars0 ratingsLinux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Linux Bible Rating: 0 out of 5 stars0 ratingsBash Command Line Pro Tips Rating: 5 out of 5 stars5/5Linux Command-Line Tips & Tricks Rating: 0 out of 5 stars0 ratingsHacking : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Ethical Hacking Rating: 5 out of 5 stars5/5Raspberry Pi for Secret Agents - Second Edition Rating: 3 out of 5 stars3/5AppleScript Rating: 5 out of 5 stars5/5The Linux Command Line Beginner's Guide Rating: 4 out of 5 stars4/5iPhone Unlocked Rating: 0 out of 5 stars0 ratingsMastering Windows PowerShell Scripting Rating: 4 out of 5 stars4/5Make Your PC Stable and Fast: What Microsoft Forgot to Tell You Rating: 4 out of 5 stars4/5Linux Command Line and Shell Scripting Bible Rating: 3 out of 5 stars3/5Apple Card and Apple Pay: A Ridiculously Simple Guide to Mobile Payments Rating: 0 out of 5 stars0 ratingsExploring Windows 11: The Illustrated, Practical Guide to Using Microsoft Windows Rating: 0 out of 5 stars0 ratingsWindows Registry Forensics: Advanced Digital Forensic Analysis of the Windows Registry Rating: 4 out of 5 stars4/5Hacking for Beginners: Mastery Guide to Learn and Practice the Basics of Computer and Cyber Security Rating: 0 out of 5 stars0 ratingsOneNote: The Ultimate Guide on How to Use Microsoft OneNote for Getting Things Done Rating: 1 out of 5 stars1/5The Mac Terminal Reference and Scripting Primer Rating: 4 out of 5 stars4/5Raspberry Pi Cookbook for Python Programmers Rating: 0 out of 5 stars0 ratingsCompTIA Linux+ Study Guide: Exam XK0-004 Rating: 0 out of 5 stars0 ratingsMacs All-in-One For Dummies Rating: 0 out of 5 stars0 ratings
Reviews for Puppet Reporting and Monitoring
0 ratings0 reviews
Book preview
Puppet Reporting and Monitoring - Michael Duffy
Table of Contents
Puppet Reporting and Monitoring
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Setting Up Puppet for Reporting
Learning the basics of Puppet reporting
Exploring the Puppet configuration file
Setting up the server
Setting up the Puppet agent
Summary
2. Viewing Data in Dashboards
Why use a dashboard?
The Puppet Dashboard feature list
Understanding Puppet Dashboard
Exploring Puppet Enterprise Console
Event Inspector
Puppet Live Management
Using The Foreman
Reporting with The Foreman
Looking at trends in The Foreman
Discovering PuppetBoard
Summary
3. Introducing Report Processors
Understanding a report processor
Utilizing the built-in report processors
Storing reports with the store report processor
Adding to logfiles with the log report processor
Graphing with the rrdgraph processor
The tagmail report processor
Sending reports with the HTTP report processor
The PuppetDB report processor
Exploring the power of third-party plugins
Getting social with Twitter
Staying on top of alerts with PagerDuty
Summary
4. Creating Your Own Report Processor
The anatomy of a report processor
Creating a basic report processor
Registering your report processor
Describing your report processor
Processing your report
Values of the self.status object
Alerting with e-mail and Puppet
Managing your report processor configuration with Puppet
Monitoring changes and alerting with Puppet
Logging with MySQL
Adding metrics and events to MySQL
Raising issues with JIRA
A final note on third-party applications
Summary
5. Exploring PuppetDB
A brief history of PuppetDB
Setting up the PuppetDB server
Installing PuppetDB
Installing PuppetDB from packages
Increasing the JVM heap space
Installing PostgreSQL
Installing the packages
Creating your database user
Creating the PostgreSQL database
Summary
6. Retrieving Data with the PuppetDB API
Exploring the PuppetDB query API
Understanding the command interface
Understanding the query API interface
A primer on the PuppetDB query language
Exploring endpoints
Using the facts endpoint
Using the resources endpoint
Retrieving details about nodes
Getting the run details with the catalogs endpoint
Understanding the fact-names endpoint
Knowing the status of PuppetDB with the metrics endpoint
Using the reports endpoint
Working with the events endpoint
Using the event-counts endpoint
Applying the aggregate-event-counts endpoint
Using the server-time endpoint
The version endpoint
Summary
7. Writing Custom Reports with PuppetDB
Creating a basic query application
Setting up the basic application
Connecting to PuppetDB
Outputting results
Creating a menu-driven PuppetDB application
Setting up the UI
Querying PuppetDB's facts endpoint
Outputting the hardware report
Querying PuppetDB for report information
Creating the PuppetDB query method
Fetching the event counts
Presenting the events data
Testing our application
Summary
8. Creating Your Own Custom Dashboard
Exploring Dashing
Setting up Dashing
Exploring the default puppetdash directory layout
Running Dashing
Creating our dashboard
Creating our dashboard layout
Feeding data into Dashing
Creating new jobs in Dashing
Adding trends
Adding meters
Summary
9. Looking Back and Looking Forward
Looking back at what we've learned
Rediscovering dashboards
Producing alerts
Using Nagios
Discovering Icinga and Shinken
Compliance monitoring with Puppet
Analyzing metrics with StatsD, Graphite, and Etsy Skyline
Tracking changes with Puppet and Graphite
Using Etsy Skyline to find your normal
Using Puppet to drive orchestration
Summary
Index
Puppet Reporting and Monitoring
Puppet Reporting and Monitoring
Copyright © 2014 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 author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be 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.
First published: June 2014
Production Reference: 1100614
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78398-142-7
www.packtpub.com
Cover Image by Gareth Howard Jones (<garth123@hotmail.co.uk>)
Credits
Author
Michael Duffy
Reviewers
Ugo Bellavance
Johan De Wit
James Fryman
Jason Slagle
Eric Stonfer
Commissioning Editor
Edward Gordon
Acquisition Editor
Llewellyn Rozario
Content Development Editor
Sankalp Pawar
Technical Editors
Taabish Khan
Aparna Kumar
Copy Editors
Insiya Morbiwala
Aditya Nair
Stuti Srivastava
Project Coordinator
Puja Shukla
Proofreaders
Maria Gould
Paul Hindle
Indexer
Mariammal Chettiyar
Production Coordinator
Sushma Redkar
Cover Work
Sushma Redkar
About the Author
Michael Duffy has been working in systems administration and automation for more years than he cares to remember, and is the founder of Stunt Hamster Ltd.; a small but perfectly formed consultancy that helps companies, both small and large, deliver fully automated and scalable infrastructure. He has consulted for companies such as O2 and BSkyB, delivering design, automation, and monitoring of infrastructure for products that serve millions of users.
Michael is a keen advocate of DevOps methodologies and is especially interested in using automation to not only deliver scalable and reliable systems, but also to make sure that people can see what is actually going on under the hood when using reporting tools. If given the chance, he will happily spend hours telling you how fantastic it is that people from the development and operations fields can finally talk and go to the pub together.
I would like to thank my absolutely incredible wife, Beth, and my fantastic daughter, Megan, for enduring more than their fair share of enthused lectures about Puppet reporting and for ensuring that I was fed, watered, and occasionally moved out into sunlight when I became a little too focused on writing. Without your love and support, this book wouldn't have been possible.
I would also like to thank the editors and staff at Packt Publishing; without them, this book would be several hundred pages of extreme gibberish without a gerund verb in sight.
About the Reviewers
Ugo Bellavance has done most of his studies in e-commerce. He started using Linux from RedHat 5.2, got Linux training from Savoir-faire Linux at age 20, and got his RHCE on RHEL 6 in 2011. He's been a consultant in the past, but he's now an employee for a provincial government agency for which he manages the IT infrastructure (servers, workstations, network, security, virtualization, SAN/NAS, and PBX). He's a big fan of open source software and its underlying philosophy. He has worked with Debian, Ubuntu, and SUSE, but what he knows best is RHEL-based distributions. He's known for his contributions to the MailScanner project (he has been a technical reviewer for MailScanner User Guide and Training Manual, Julian Field published by the University of Southampton, Department of Civil & Environmental Engineering), but he has also given time to different open source projects such as Mondo Rescue, OTRS, SpamAssassin, pfSense, and a few others. He's been a technical reviewer for Centos 6 Linux Server Cookbook, Jonathan Hobson, Packt Publishing and Puppet 3 Beginner's Guide, John Arundel, Packt Publishing.
I thank my lover, Lysanne, who accepted to allow me some free time slots for this review even with two dynamic children to take care of. The presence of these three human beings in my life is simply invaluable.
I must also thank my friend, Sébastien, whose generosity is only matched by his knowledge and kindness. I would never have reached this high in my career if it wasn't for him.
Johan De Wit was an early Linux user, and he still remembers those days when he built a 0.9x Linux kernel on his brand new 486 computer, which took a whole night. His love for Unix operating systems already existed before Linux was announced. It is not surprising that he started his career as a Unix system administrator.
Johan doesn't remember precisely when he started working with open source software, but since 2009, he has been working as an open source consultant at Open-Future, where he got the opportunity to work with Puppet. Puppet has now become his biggest interest, and he loves to teach Puppet as one of the few official Puppet trainers in Belgium.
Johan started the Belgian Puppet user group a year ago, where he tries to bring some Puppet users together by hosting great and interesting meet-ups. When he takes the time to write Puppet-related blogs, he does so mostly on http://puppet-be.github.io/, the BPUG website. From time to time, he tries to spread some hopefully wise Puppet words while presenting a talk at a Puppet camp somewhere in Europe.
Besides having fun at work, he spends a lot of his free time with his two lovely kids and his two Belgian draft horses, and if time and the weather permits, he likes to rebuild and drive his old-school chopper.
James Fryman is a technologist who has been working on spreading the good word of technology via the greatest mechanism known to man: the beer-fueled rant. He has been working to automate software and infrastructure for the last 10 years and has learned quite a bit about security, architecture, scaling, and development as a result. He currently works for GitHub as an Operations Hacker.
Jason Slagle is a 17-year veteran of systems and network administration. Having worked on everything from Linux systems to Cisco networks and SAN Storage, he is always looking for ways to make his work repeatable and automated. When he is not hacking a computer for work or pleasure, he enjoys running, cycling, and occasionally, geocaching.
Jason is currently employed by CNWR Inc., an IT and infrastructure consulting company in his home town of Toledo, Ohio. There, he supports several large customers in their quest to automate and improve their infrastructure and development operations.
Jason has also served as a technical reviewer for Puppet 3 Beginner's Guide, John Arundel, Packt Publishing.
I'd like to thank my wife, Heather, and my son, Jacob, for putting up with me while I worked on this and other projects. They make even days with critical systems outages better!
Eric Stonfer has spent the last 12 years working as a systems administrator with an emphasis on systems automation and configuration management.
www.PacktPub.com
Support files, eBooks, discount offers, and more
You might want to visit www.PacktPub.com for support files and downloads related to your book.
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.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.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.
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print and bookmark content
On demand and accessible via web browser
Free access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
Preface
Puppet is possibly the fastest growing configuration management tool on the planet, and this is in no small part due to its combination of power and accessibility. From small five-node installations through to hugely complex cloud infrastructures that number thousands of nodes, Puppet has proven its ability to deliver on the promise of infrastructure as code. There have been a number of titles that cover its ability to create idempotent resources, manage services, and ensure that systems are configured correctly and maintained with little or no effort. Yet, none of these titles spend more than a chapter discussing its reporting features.
This is a shame; Puppet's reporting capability is one of its most overlooked yet powerful features. If used correctly, its built-in reporting abilities can give you stunning levels of detail about your infrastructure, from the amount of hardware used and networking details to details about how and when resources were changed. However, this is just the beginning. In this book, we are going to cover techniques that are simple to learn and that will allow you to use Puppet as a key part of your alerting systems, letting it bring your attention to important changes and even forming a simple-to-implement tripwire system. We're going to explore PuppetDB and learn why this is a fantastic source of information that you can use to not only explore the changes being applied to your systems, but also create an end-to-end repository of knowledge about your infrastructure. We're going to build custom dashboards to make this data accessible, and finally, we will look at the ways by which you can make Puppet not only report the changes, but also drive them.
What this book covers
Chapter 1, Setting Up Puppet for Reporting, will guide you through the simple steps to take your existing Puppet installation and make it report.
Chapter 2, Viewing Data in Dashboards, takes a look at the existing dashboards available for Puppet and how you can use them to report on your data.
Chapter 3, Introducing Report Processors, acquaints you with the engine that drives much of the Puppet reporting process—the report processor.
Chapter 4, Creating Your Own Report Processor, deals with creating your own report processor with custom e-mail alerts, MySQL storage, and integration with third-party products.
Chapter 5, Exploring PuppetDB, introduces PuppetDB, a fantastic and powerful system for report storage and analysis. In this chapter, we look at what PuppetDB is, how it's configured, and finally, how you can set it up in your own infrastructure.
Chapter 6, Retrieving Data with the PuppetDB API, explores the fantastically powerful API of PuppetDB; the API allows you to query your reports in a number of different ways. We're going to explore this API for functions that range from basic queries to advanced data integration.
Chapter 7, Writing Custom Reports with PuppetDB, deals with creating easy-to-use custom report applications.
Chapter 8, Creating Your Own Custom Dashboard, deals with creating an attractive and detailed custom dashboard using Dashing and PuppetDB.
Chapter 9, Looking Back and Looking Forward, takes a look at some of the more advanced ways in which you can use Puppet reporting to do everything from alerting to the orchestration of your infrastructure.
What you need for this book
The code and examples in this book have been designed for use with the following software:
Puppet 3.0 and higher versions
Ruby 1.9 and higher versions
Who this book is for
This book is designed for anyone who wants to learn more about the fundamental components of Puppet reporting. To get the most out of this book, you should already be familiar with Puppet and be comfortable with its major components such as the Puppet master and Puppet agent. You should also be comfortable with reading code, and in particular, you should be at least passingly familiar with Ruby. Finally, you should be happy working on the command line in the Linux/Unix flavor of your choice.
Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles