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.

pgBackRest 2.08 and macOS Mojave

UPDATE: My reasoning was incorrect below. It wasn't the moving of some of the lock code to C that caused the issue. It was moving `-D_POS...… Continue reading

pgBackRest 2.07 and macOS Mojave

Published on November 16, 2018

pgBouncer and auth pass-thru

Published on August 07, 2018