Re: [PERFORM] How to track number of connections and hosts to Postgres cluster

2011-08-24 Thread Scott Marlowe
On Wed, Aug 24, 2011 at 5:21 AM, Venkat Balaji wrote: > But, the information vanishes if the application logs off. > I am looking for an alternative to track the total amount of the connections > with the host IPs through a Cron job. > What could be the frequency of cron ? > I know the best is usi

Re: [PERFORM] How to track number of connections and hosts to Postgres cluster

2011-08-24 Thread Maciek Sakrejda
> I suppose you could use tcpdump on a separate system with a mirrored switch > port and have it log TCP SYN and FIN packets on port 5432 to your database > server only. Keeps all I/O off your database server. > tcpdump -w port5423.log -n "tcp and port 5432 and tcp[tcpflags] & > (tcp-syn|tcp-f

Re: [PERFORM] How to track number of connections and hosts to Postgres cluster

2011-08-24 Thread Greg Spiegelberg
On Wed, Aug 24, 2011 at 9:33 AM, Greg Smith wrote: > On 08/24/2011 07:07 AM, Venkat Balaji wrote: > >> But, if put log_connections to on and log_disconnections to on wouldn't >> the Postgres be logging in lot of data ? >> Will this not be IO intensive ? I understand that this is the best way, >>

Re: [PERFORM] How to track number of connections and hosts to Postgres cluster

2011-08-24 Thread Greg Smith
On 08/24/2011 07:07 AM, Venkat Balaji wrote: But, if put log_connections to on and log_disconnections to on wouldn't the Postgres be logging in lot of data ? Will this not be IO intensive ? I understand that this is the best way, but, would want to know if there is an other way to reduce IO ( m

Re: [PERFORM] How to track number of connections and hosts to Postgres cluster

2011-08-24 Thread Guillaume Lelarge
On Wed, 2011-08-24 at 16:51 +0530, Venkat Balaji wrote: > But, the information vanishes if the application logs off. > That's why you need a tool to track this. > I am looking for an alternative to track the total amount of the connections > with the host IPs through a Cron job. > If you only

Re: [PERFORM] How to track number of connections and hosts to Postgres cluster

2011-08-24 Thread Venkat Balaji
But, the information vanishes if the application logs off. I am looking for an alternative to track the total amount of the connections with the host IPs through a Cron job. What could be the frequency of cron ? I know the best is using log_connections and log_disconnections parameters, but, inf

Re: [PERFORM] How to track number of connections and hosts to Postgres cluster

2011-08-24 Thread Adarsh Sharma
pg_stat_activity keeps track of all this information. select * from pg_stat_activity where datname='databasename'; Venkat Balaji wrote: Thanks Guillaume !! But, if put log_connections to on and log_disconnections to on wouldn't the Postgres be logging in lot of data ? Will this not be IO

Re: [PERFORM] How to track number of connections and hosts to Postgres cluster

2011-08-24 Thread Venkat Balaji
Thanks Guillaume !! But, if put log_connections to on and log_disconnections to on wouldn't the Postgres be logging in lot of data ? Will this not be IO intensive ? I understand that this is the best way, but, would want to know if there is an other way to reduce IO ( may be through queries to ca

Re: [PERFORM] How to track number of connections and hosts to Postgres cluster

2011-08-24 Thread Guillaume Lelarge
On Wed, 2011-08-24 at 13:05 +0530, Venkat Balaji wrote: > Hello Everyone, > > 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).

[PERFORM] How to track number of connections and hosts to Postgres cluster

2011-08-24 Thread Venkat Balaji
Hello Everyone, 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 TRANS