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

Setting Up a Test Environment

The best way to learn is by doing. This chapter will help you quickly spin up an environment for testing so that you can safely experiment without worrying too much. It will provide several configuration examples and tips on how to get things running. This type of environment will also be used throughout this book in several different scenarios.

In brief, the following topics will be covered in this chapter:

  • Code organization
  • Machine requirements
  • Spinning up a new environment

Code organization

While the examples and code listings in this book can be used directly without any supporting material, a companion Git repository is also provided to help you with the setup process and the automation of test environments so that you can follow along easily.

In this section, we're going to explore how that repository is organized, explain some choices that are made in terms of the automation of the test environments, and give some pointers on how to customize them:

.
├── Makefile
├── README.md
├── cache/
├── chapter03/
├── ...
├── chapter14/
└── utils/

The root structure of the repository shown here should be fairly easy to understand:

  • One directory per chapter that needs its own test environment (aptly named chapter...

Machine requirements

The machine requirements for this setup can comfortably run on a modern laptop, as long it has CPU virtualization extensions enabled and its operating system is compatible with the software requirements. All the software requirements that are covered here were thought-out. We will be using free and open source software, so no extra cost should be necessary when you try out the test environments.

Hardware requirements

The minimal requirements for the host deploying the provided examples are as follows:

  • At least 2 CPU cores
  • At least 4 GB of memory
  • At least 20 GB of free disk space

With these specifications, you should be able to spin up the test environment without encountering any issues.

Regarding connectivity...

Spinning up a new environment

After you have ensured that all the required software is available on your host, you may proceed with one or both of the following walkthroughs.

Automated deployment walkthrough

This method will abstract all the deployment and configuration details, allowing you to have a fully running test environment with only a couple of commands. You'll still be able to connect to each of the guest instances and change configurations.

The steps to spin up the environment are as follows:

  1. Clone this book's repository:
git clone https://github.com/PacktPublishing/Hands-On-Infrastructure-Monitoring-with-Prometheus.git
  1. Step into the newly created directory and chapter number:
cd Hands-On-Infrastructure...

Summary

With a test environment at your disposal, you can now inspect, change, and validate configurations without worrying about breaking things. Throughout this book, this approach to testing will be used extensively, because nothing beats experimenting when learning new skills.

In the next chapter, we'll go over the fundamentals of Prometheus metrics. The test environment we just built will be helpful to demonstrate them.

Questions

  1. What are the recommended tools to set up a reproducible test environment?
  2. Where can you change the default versions of the Prometheus components for the test environment?
  3. What is the default subnet that's used on all examples?
  4. At a high level, what are the steps to get a Prometheus instance up and running?
  5. Node Exporter is installed on every guest instance. How can you quickly validate if all of them are exposing metrics correctly?
  6. In our test environment, where can you find the alert log?
  7. How can you create a clean test environment from scratch?
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