The primary reason we chose to install Telegraf stems from its ability to monitor arbitrary data points. Due to the existence of a PostgreSQL plugin for Telegraf capable of handling arbitrary SQL, we can actually collect data from the database itself. Monitoring PostgreSQL becomes as easy as writing a query!
Even though the Installing and configuring Telegraf recipe already used the PostgreSQL plugin, that particular extension only offers basic metrics. This recipe is going to introduce and explore the extensible PostgreSQL plugin instead.
We will include a few sample queries we developed for monitoring PostgreSQL servers through this recipe. Feel free to develop your own as we explain how to further leverage the Telegraf PostgreSQL module.