Book Image

PostgreSQL 9 High Availability Cookbook

By : Shaun Thomas
Book Image

PostgreSQL 9 High Availability Cookbook

By: Shaun Thomas

Overview of this book

Table of Contents (17 chapters)
PostgreSQL 9 High Availability Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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:

  1. Add a PostgreSQL primitive to Pacemaker with crm:

    crm configure primitive pg_mail ocf:heartbeat:MailTo \
        params email="[email protected]" \
               subject="Pacemaker\ cluster\ status\ changed:\ "
    
  2. Clean up any errors that might have accumulated with crm:

    crm resource cleanup pg_mail
    
  3. Display the status of our new e-mail alert with crm:

    crm resource status
    

How it works...

To add an e-mail alert, we need to...