Realtime monitoring of current PGbouncer pools stats

Hello, on some project i’m using PGbouncer for PostgreSQL connections pooling. So, that’s nice to have ability to get top style stats for connection in pool and real connection to server.

Here is small single line bash script for monitoring:

Example:

database | user | cl_active | cl_waiting | sv_active | sv_idle | sv_used | sv_tested | sv_login | maxwait
————-+———–+———–+————+———–+———+———+———–+———-+———
anna | postgres | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0
igor | postgres | 3 | 0 | 3 | 1 | 0 | 0 | 0 | 0
igor_test_2 | postgres | 2 | 0 | 2 | 1 | 0 | 0 | 0 | 0
pgbouncer | pgbouncer | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0

 

Author: GergunD

Leave a Reply