Recording rules tests

The promtool tool included in the Prometheus binary distribution allows us to define test cases to validate that the rules we write behave as expected. The test environment for this chapter also comes with a suite of pre-built tests for the rules we've explored so far. You can have a look at the configuration here:

vagrant@prometheus:~$ cat /etc/prometheus/tests.yml

This file has tests for all recording and alerting rules presented in this chapter. Although you don't need to define every test in a single file (it is, in fact, tidier to do a test file per rule group to keep things organized), this was done in this case for simplicity. For now, let's analyze only the recording rules, as they are simpler to grasp. The top-level ...

Get Hands-On Infrastructure Monitoring with Prometheus now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.