How it works...

To add an e-mail alert, we need to configure another primitive with crm. We name this resource pg_mail so that it fits in with the other services that we've configured so far. As always, we need a resource agent for Pacemaker to invoke when necessary, and the ocf:heartbeat:MailTo agent works well for our use case.

The MailTo agent is not a regular resource, as it does not represent any actual system service. It's more of a defined action that Pacemaker should invoke while managing other cluster resources. This means it's essentially useless until we associate it with another Pacemaker primitive.

The MailTo agent also has two parameters (params) we are interested in setting. We begin by setting email to an e-mail address for ...

Get PostgreSQL High Availability Cookbook - Second Edition 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.