Monitoring open connections
От | Simon Brooke |
---|---|
Тема | Monitoring open connections |
Дата | |
Msg-id | 39645901.AD57A9EB@weft.co.uk обсуждение исходный текст |
Ответы |
SQL DOMAINS in PostgreSQL
|
Список | pgsql-general |
Herewith a little script to monitor open connections to Postgres databases on Linux platforms; I wrote it while desperately debugging some connection pooling code which was (but hopefully is not still) breaking horribly. If it's useful to you, feel free to use or adapt. -------------------------------- cut here -------------------------------- #! /bin/bash # Monitor number of open Postgres connections by user and database # Simon Brooke <simon@jasmine.org.uk>, 6th July 2000 # Copyleft - no warranty, use it if you like it. tmp=/tmp/wpg$$ bak=/tmp/wpg$$.bak cat /dev/null > $tmp cat /dev/null > $bak while [ 1 -eq 1 ]; do ps auxww |\ awk '$11 ~ "postgres" {printf( "User: %-8s; Database: %-8s\n", $13, $14)}' > $tmp cmp -s $tmp $bak if [ $? -ne 0 ] # there's been a change then echo "" # new line date; # report it sort $tmp |\ uniq -c; else echo -n "." # I'm still alive fi mv $tmp $bak sleep 10; done -------------------------------- cut here -------------------------------- -- Simon Brooke, Technical Director, Weft Technology Ltd -- http://www.weft.co.uk/ the weft is not just what binds the web: it is what makes it a web
В списке pgsql-general по дате отправления: