Monitoring pgBackRest with tail_n_mail

Reading time ~1 minute

After a lively discussion at work today about monitoring tools and uses cases, I decided to see if I could use tail_n_mail, which I already use to monitor my PostgreSQL logs, to monitor my pgBackRest logs. It turns out that it can, and can do so fairly trivially.

For reference, our .tail_n_mail.conf looks like this:

## Config file for the tail_n_mail program
## This file is automatically updated
LOG_LINE_PREFIX: %t P%p
EMAIL: you@gme.com
MAILSUBJECT: HOST pgBackRest errors NUMBER

INCLUDE: WARN:
INCLUDE: ERROR:
INCLUDE: FATAL:
INCLUDE: PANIC:


FILE1: /var/log/pgbackrest/pgbackrest.log

You would need to change the EMAIL and FILE1 and the rest should just work.

To actually invoke the monitoring, simply add a cron entry that looks like:

* * * * * /path/to/tail_n_mail ~/.tailnmail.conf --pgmode=0

(Obviously, you should adjust the periodicity. I highly doubt you need to check every minute.)

Once you’ve saved the crontab, you should be all good. If you doubt the setup, you can add --mailzero to the invocation to get an email even if everything is OK.

See? Easy.

pgBouncer and auth pass-thru

I’ve noticed several individuals inquiring lately about pgBouncer and how they can avoid putting all users and their passwords in it’s au...… Continue reading

Locking it down

Published on June 18, 2018

Mom cuts the cord

Published on May 31, 2018