Monitoring open connections

Поиск
Список
Период
Сортировка
Искать

Monitoring open connections

От:
Simon Brooke <simon@weft.co.uk>
Дата:
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 , 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

SQL DOMAINS in PostgreSQL

От:
Jesus Aneiros <aneiros@jagua.cfg.sld.cu>
Дата:
Hello,

I would like to know is there is anything like SQL DOMAINS in PostgreSQL?

TIA, Jesus.



FAQ