Re: solaris and ps - Mailing list pgsql-general

From Michael Fuhr
Subject Re: solaris and ps
Date
Msg-id 20041014142419.GA95042@winnie.fuhr.org
Whole thread Raw
In response to Re: solaris and ps  (Richard Huxton <dev@archonet.com>)
Responses Re: solaris and ps
List 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/

pgsql-general by date:

Previous
From: Leonardo Francalanci
Date:
Subject: sum 2 arrays of general int type
Next
From: Michael Fuhr
Date:
Subject: Re: solaris and ps