I am working on an alert script to track the number of connections with the host IPs to the Postgres cluster.
1. I need all the host IPs making a connection to Postgres Cluster (even for a fraction of second).
2. I would also want to track number of IDLE connections, IDLE IN TRANSACTION connections and length of the connections as well.
I would be making use of pg_stat_activity and also thought of enabling logging the host ips in the db server log files which seems to be expensive for me (in terms of IO and logfile size).
Please let me know you if there are any alternatives.
Thanks
Venkat