How it works...

This recipe is almost entirely based on the PostgreSQL collectd plugin. The large block of code that we inserted into the local.conf file will configure that module with a single query that it will execute and transmit to the monitor server. The monitor system will automatically accept these results and integrate them into any data that it's already storing.

The <Query> block deserves some explanation. Every custom query that we define must have a name. In this case, TPS stands for Transactions Per Second, and it is a common database metric. The first thing we add is the statement being executed. The statement we included gathers basic data from the pg_stat_database table for every database in this particular PostgreSQL instance. ...

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.