Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] Re: pgmonitor and Solaris

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Mathijs Brands <mathijs(at)ilse(dot)nl>
Cc: PostgreSQL-ports <pgsql-ports(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] Re: pgmonitor and Solaris
Date: 2001-03-29 01:59:18
Message-ID: 200103290159.UAA13045@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-ports
Thanks, I think this summarizes Solaris ps display.  We will try to get
7.1 ps display working for Solaris.


> On Wed, Mar 28, 2001 at 07:18:24PM -0500, Bruce Momjian allegedly wrote:
> > > > > Note the last line...
> > > > 
> > > > OK, I need someone on Solaris to test ps and /ucb/ps with regard to user
> > > > restriction inside ps, and display of PostgreSQL status display.
> > > > 
> > > > I have uploaded a new pgmonitor 0.33 version that has a show_all
> > > > configuration parameter.  This will show all PostgreSQL-owned processes
> > > > for use on operating systems that don't have PostgreSQL status display.
> > > 
> > > We don't have Tcl/Tk installed on any of our servers, so I can't test
> > > this. If you want me to test something else, please let me know.
> > 
> > I don't need tcl/tk, just someone to run ps and ucb/ps with running
> > backends and tell me if the backend status display is working, and which
> > ps has user-selection capability.
> 
> Here goes:
> 
> template1=# \set
> VERSION = 'PostgreSQL 7.0.3 on sparc-sun-solaris2.7, compiled by gcc 2.95.2'
> DBNAME = 'template1'
> USER = 'mathijs'
> PORT = '5432'
> ENCODING = 'SQL_ASCII'
> PROMPT1 = '%/%R%# '
> PROMPT2 = '%/%R%# '
> PROMPT3 = '>> '
> HISTSIZE = '500'
> template1=#
> [1]+  Stopped                 psql template1
> jumpstart.l3.ilse.nl:/export/home/mathijs >which ps
> /usr/bin/ps
> jumpstart.l3.ilse.nl:/export/home/mathijs >ps -elf|grep post
>  8 S  mathijs 25810 25808  0  51 20 7156ca68    717 71c789d2 20:44:34 pts/1    0:00 /opt/pgsql/bin/./postmaster
>  8 O  mathijs  1576  1543  0  51 20 71733548    118          02:26:23 pts/3    0:00 grep post
>  8 S  mathijs  1555 25810  0  51 20 71e48760    765 716fdc86 02:26:00 pts/1    0:00 /opt/pgsql/bin/./postmaster
> jumpstart.l3.ilse.nl:/export/home/mathijs >ps -o args,comm|grep post
> grep post                                                                        grep
> jumpstart.l3.ilse.nl:/export/home/mathijs >ps -ef -o args,comm|grep post
> /opt/pgsql/bin/./postmaster                                                      /opt/pgsql/bin/./postmaster
> grep post                                                                        grep
> /opt/pgsql/bin/./postmaster                                                      /opt/pgsql/bin/./postmaster
> jumpstart.l3.ilse.nl:/export/home/mathijs >ps -ef -o user,pid,args,comm|grep post
>  mathijs 25810 /opt/pgsql/bin/./postmaster                                                      /opt/pgsql/bin/./postmaster
>  mathijs  1555 /opt/pgsql/bin/./postmaster                                                      /opt/pgsql/bin/./postmaster
>  mathijs  1604 grep post                                                                        grep
> jumpstart.l3.ilse.nl:/export/home/mathijs >/usr/ucb/ps auxww|grep post
> mathijs   1619  0.1  0.1  944  696 pts/3    S 02:27:16  0:00 grep post
> mathijs   1555  0.0  0.2 6120 3352 pts/1    S 02:26:00  0:00 /opt/pgsql/bin/./postgres mathijs localhost template1 idle
> mathijs  25810  0.0  0.1 5736 2160 pts/1    S 20:44:34  0:00 /opt/pgsql/bin/./postmaster   
> 
> jumpstart.l3.ilse.nl:/export/home/mathijs >/usr/ucb/ps -h
> /usr/ucb/ps: illegal option -- h
> usage: ps [ -aceglnrSuUvwx ] [ -t term ] [ num ]
> jumpstart.l3.ilse.nl:/export/home/mathijs >id
> uid=106(mathijs) gid=110(ilse)
> jumpstart.l3.ilse.nl:/export/home/mathijs >/usr/ucb/ps -U 106
> ps: rename("/tmp/ps.NHayod","/tmp/ups_data") failed, Permission denied
> ps: Please notify your System Administrator
> jumpstart.l3.ilse.nl:/export/home/mathijs >ps -fU mathijs
>      UID   PID  PPID  C    STIME TTY      TIME CMD
>  mathijs   429   408  0 16:58:40 pts/1    0:01 -bash
>  mathijs 17121 17095  0 20:01:11 pts/0    0:01 -bash
>  mathijs  1543  1520  0 02:25:48 pts/3    0:00 -bash
>  mathijs 25810 25808  0 20:44:34 pts/1    0:00 /opt/pgsql/bin/./postmaster
>  mathijs 19058 18962  0 21:53:38 ?        0:00 ../bin/httpd -
>     root  1773  1543  0 02:30:18 pts/3    0:00 ps -fU mathijs
>  mathijs  1554  1543  0 02:25:58 pts/3    0:00 psql template1
>  mathijs 19057 18962  0 21:53:38 ?        0:00 ../bin/httpd -
>  mathijs  1555 25810  0 02:26:00 pts/1    0:00 /opt/pgsql/bin/./postmaster
>  mathijs 19056 18962  0 21:53:38 ?        0:00 ../bin/httpd -
>  mathijs 25808     1  0 20:44:34 pts/1    0:00 /bin/sh ./pg_ctl -D /opt/pgsql/data start
>  mathijs 19059 18962  0 21:53:38 ?        0:00 ../bin/httpd -
>  mathijs 19060 18962  0 21:53:38 ?        0:00 ../bin/httpd -
>  mathijs 18962     1  0 21:51:55 ?        0:00 ../bin/httpd -
> 
> Btw. I don't know what 'ps -U' does, but it sure isn't what you'd
> expect. What it appears to be doing is caching some data in /tmp,
> probably to speed up future lookups (most likely kernel symbols
> (WCHAN) and tty names). ps -U seems to update this file.
> 
> I did some more checking. /usr/ucb/ps actually acquires read access
> to the memory space of running programs and seems to get the program
> title from it, while the regular sysv ps command only accesses the
> normal process information (containing the real cmdline arguments).
> You either need root access to read from a program's memory space
> (using the /proc/<pid>/as pseudo file), or you need to be the owner.
> 
> jumpstart.l3.ilse.nl:/export/home/mathijs >ls -l /proc/1555/as /proc/1555/psinfo
> -rw-------   1 mathijs  ilse     6266880 Mar 29 02:26 /proc/1555/as
> -r--r--r--   1 mathijs  ilse         336 Mar 29 02:26 /proc/1555/psinfo
> 
> /usr/ucb/ps reads both as and psinfo, while the regular ps only reads
> psinfo...
> 
> I think grepping the /usr/ucb/ps output is pretty much the only option
> left, since it doesn't allow you to limit on user name/id.
> 
> Regards,
> 
> Mathijs
> -- 
> ilse Technology B.V. - Postbus 542 5600 AM Eindhoven
> Telefoon: 040 750 31 00 - Fax: 040 750 31 99        
> Web: http://www.ilse.nl/ - E-mail: technology(at)ilse(dot)nl
> 


-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-ports by date

Next:From: Maurizio OrtolanDate: 2001-03-29 04:50:56
Subject: Error in the date field (with NULL value...).Thanks!
Previous:From: Mathijs BrandsDate: 2001-03-29 00:24:39
Subject: Re: [HACKERS] Re: [PORTS] pgmonitor and Solaris

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group