Re: solaris and ps

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: Leonardo Francalanci <lfrancalanci(at)simtel(dot)ie>, pgsql-general(at)postgresql(dot)org
Subject: Re: solaris and ps
Date: 2004-10-14 14:24:19
Message-ID: 20041014142419.GA95042@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Oct 14, 2004 at 11:14:10AM +0100, Richard Huxton wrote:
> Leonardo Francalanci wrote:
> >I read "Chapter 23. Monitoring Database Activity" to monitor postgresql,
> >but on Solaris it doesn't work. I tried "/usr/ucb/ps", but it doesn't
> >work either (I only see the postmaster startup parameters). Isn't there
> >any other solution to see what postgresql instances are doing?
>
> If the tips on solaris ps haven't helped, you can turn on statistics
> gathering and check pg_stat_activity.

pargs should work, but you'll probably have to run it as the postgres
user or as root or you'll get "cannot examine <pid>: permission denied".

pargs `/usr/bin/ps -opid -Upostgres | tail +2`

I just did some tests on Solaris 9 and, curiously, whether /usr/ucb/ps
shows the altered argument list or not appears to depend on the
lengths of the original and replacement arguments:

% ./foo x
PID TT S TIME COMMAND
28106 pts/2 S 0:00 baz qux

% ./foo xy
PID TT S TIME COMMAND
28109 pts/2 S 0:00 ./foo xy

As far as I can tell, for /usr/ucb/ps the show the replacement
arguments, the sum of the lengths of the replacement arguments
must be 2 or more greater than the sum of the lengths of the
original arguments. I'm guessing that if the postmaster used
a longer status message, then /usr/ucb/ps would show it. I'll
test that the next time I rebuild PostgreSQL.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2004-10-14 14:31:32 Re: solaris and ps
Previous Message Leonardo Francalanci 2004-10-14 13:33:14 sum 2 arrays of general int type