Adding an e-mail alert
The last thing we are going to add should be considered a requirement when building a high-availability PostgreSQL cluster. Any time the status of Pacemaker changes, we can have it transmit an e-mail alerting us to the activity. Not only is this possible with Pacemaker, it's relatively easy to set up.
This recipe will outline the steps necessary to add an e-mail alert to Pacemaker.
Getting ready
As we're continuing to configure Pacemaker, make sure you've followed all the previous recipes.
How to do it...
Perform these steps on any Pacemaker node as the root
user:
- Add a PostgreSQL
primitive
to Pacemaker withcrm
:crm configure primitive pg_mail ocf:heartbeat:MailTo \ params email="dbas@mycompany.com" \ subject="Pacemaker\ cluster\ status\ changed:\ "
- Clean up any errors that might have accumulated with
crm
:crm resource cleanup pg_mail
- Display the status of our new e-mail alert with
crm
:crm resource status
How it works...
To...