Thread: pgmonitor on solaris

pgmonitor on solaris

From
Roberto João Lopes Garcia
Date:
Hi

Is there a pgmonitor version for Solaris?? It dies with:

Can't run 'ps': awk: syntax error near line 3
awk: illegal statement near line 3
awk: illegal statement near line 4
Please send in a patch.

I tried to fix it whith:

1 - correct the path to ps.
2 - convert Linux ps args to Solaris 2.5.1 ps args.

Step 2 did not work, I could not find equivalents to x,w args and I do not 
know if it is the only think that must be fixed.

Thank you



Re: pgmonitor on solaris

From
Peter Eisentraut
Date:
Roberto João Lopes Garcia writes:

> Is there a pgmonitor version for Solaris?? It dies with:
>
> Can't run 'ps': awk: syntax error near line 3
> awk: illegal statement near line 3
> awk: illegal statement near line 4
> Please send in a patch.
>
> I tried to fix it whith:
>
> 1 - correct the path to ps.
> 2 - convert Linux ps args to Solaris 2.5.1 ps args.
>
> Step 2 did not work, I could not find equivalents to x,w args and I do not
> know if it is the only think that must be fixed.

The x and w options for ps are BSD-style (not Linux).  On Solaris you'll
find a BSD-style ps under /usr/ucb/.  With the SysV-style ps at
/usr/bin/ps the -e option is the closest thing to it, but it probably
won't work with pgmonitor.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



Re: pgmonitor on solaris

From
Bruce Momjian
Date:
You don't mention the version of pgmonitor, but 0.27 is the most recent.
I just made a few awk fixes.  Maybe that will fix it.

Strange it is mentining an 'awk' error here.  My guess is that it
doesn't like some of the 'awk' commands I have used.  Does anyone see
some non-portable awk stuff in there?  Can you run the command manually
to find the part of the awk it is failing with?

The main web site for pgmonitor is:http://greatbridge.org/project/pgmonitor/projdisplay.php

You can download the most recent version fromftp://ftp.greatbridge.org/pub/pgmonitor

Bruce Momjian <pgman@candle.pha.pa.us>
[ Charset ISO-8859-1 unsupported, converting... ]
> Roberto Jo?o Lopes Garcia writes:
> 
> > Is there a pgmonitor version for Solaris?? It dies with:
> >
> > Can't run 'ps': awk: syntax error near line 3
> > awk: illegal statement near line 3
> > awk: illegal statement near line 4
> > Please send in a patch.
> >
> > I tried to fix it whith:
> >
> > 1 - correct the path to ps.
> > 2 - convert Linux ps args to Solaris 2.5.1 ps args.
> >
> > Step 2 did not work, I could not find equivalents to x,w args and I do not
> > know if it is the only think that must be fixed.
> 
> The x and w options for ps are BSD-style (not Linux).  On Solaris you'll
> find a BSD-style ps under /usr/ucb/.  With the SysV-style ps at
> /usr/bin/ps the -e option is the closest thing to it, but it probably
> won't work with pgmonitor.
> 
> -- 
> Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> 


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


Re: pgmonitor on solaris

From
Bruce Momjian
Date:
> Hi
> 
> Is there a pgmonitor version for Solaris?? It dies with:
> 
> Can't run 'ps': awk: syntax error near line 3
> awk: illegal statement near line 3
> awk: illegal statement near line 4
> Please send in a patch.
> 
> I tried to fix it whith:
> 
> 1 - correct the path to ps.
> 2 - convert Linux ps args to Solaris 2.5.1 ps args.
> 
> Step 2 did not work, I could not find equivalents to x,w args and I do not 
> know if it is the only think that must be fixed.

See previous email.  Seems it is my awk code that is the problem.

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


Re: pgmonitor on solaris

From
Tom Lane
Date:
> Roberto Jo�o Lopes Garcia writes:
>> Is there a pgmonitor version for Solaris?? It dies with:
>>
>> Can't run 'ps': awk: syntax error near line 3
>> awk: illegal statement near line 3
>> awk: illegal statement near line 4
>> Please send in a patch.

Looks like your problem is not with ps, but with awk.  pgmonitor uses
a rather complicated awk program that is probably not too portable.
I hadn't complained about it before because I checked that it worked
with the vendor awk in HPUX, which I figured ought to be sufficiently
behind the times ;-).  Looks like I was mistaken.  Bruce, can you
simplify that awk program?
        regards, tom lane


Re: pgmonitor on solaris

From
Bruce Momjian
Date:
> > Roberto Jo�o Lopes Garcia writes:
> >> Is there a pgmonitor version for Solaris?? It dies with:
> >>
> >> Can't run 'ps': awk: syntax error near line 3
> >> awk: illegal statement near line 3
> >> awk: illegal statement near line 4
> >> Please send in a patch.
> 
> Looks like your problem is not with ps, but with awk.  pgmonitor uses
> a rather complicated awk program that is probably not too portable.
> I hadn't complained about it before because I checked that it worked
> with the vendor awk in HPUX, which I figured ought to be sufficiently
> behind the times ;-).  Looks like I was mistaken.  Bruce, can you
> simplify that awk program?

I can't figure out how to simplify it, but I did find the use of \{
instead of { in the code and released a new version, 0.27.  Hopefully
that will take care of it.  If not, I can start stripping lines out of
the awk program until we fine the problem.

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


RE: pgmonitor on solaris

From
Jeff Eckermann
Date:
The problem is that Solaris uses the "original" version of Awk by default
(apparently nobody knows why).
This version lacks many features which have been available in later versions
for approximately forever (in computing chronology :-)).
Two other versions exist on Solaris:
*    "nawk" ("new awk", i.e. the updated "old awk")
*    /usr/xpg4/bin/awk (another, posix-compliant awk).
Solaris seems to be weird this way.  Other platforms don't seem to have this
problem.  Linux and FreeBSD, for example, use GNU awk, which would have all
of the required functionality and more.

> -----Original Message-----
> From:    Bruce Momjian [SMTP:pgman@candle.pha.pa.us]
> Sent:    Sunday, March 25, 2001 3:46 PM
> To:    Tom Lane
> Cc:    Roberto João Lopes Garcia; pgsql-interfaces@postgresql.org
> Subject:    Re: [INTERFACES] pgmonitor on solaris
> 
> This message uses a character set that is not supported by the Internet
> Service.  To view the original message content,  open the attached
> message. If the text doesn't display correctly, save the attachment to
> disk, and then open it using a viewer that can display the original
> character set. << File: message.txt >> 


Re: pgmonitor on solaris

From
Bruce Momjian
Date:
Can someone suggest what it is failing on in Solaris?  Can you put #
before each line starting from the top until the error goes away so I
can know the cause.  Comment out one line, try it, then remove the
comment and try the next line until it doesn't fail.

[ Charset ISO-8859-1 unsupported, converting... ]
> The problem is that Solaris uses the "original" version of Awk by default
> (apparently nobody knows why).
> This version lacks many features which have been available in later versions
> for approximately forever (in computing chronology :-)).
> Two other versions exist on Solaris:
> *    "nawk" ("new awk", i.e. the updated "old awk")
> *    /usr/xpg4/bin/awk (another, posix-compliant awk).
> Solaris seems to be weird this way.  Other platforms don't seem to have this
> problem.  Linux and FreeBSD, for example, use GNU awk, which would have all
> of the required functionality and more.
> 
> > -----Original Message-----
> > From:    Bruce Momjian [SMTP:pgman@candle.pha.pa.us]
> > Sent:    Sunday, March 25, 2001 3:46 PM
> > To:    Tom Lane
> > Cc:    Roberto Jo?o Lopes Garcia; pgsql-interfaces@postgresql.org
> > Subject:    Re: [INTERFACES] pgmonitor on solaris
> > 
> > This message uses a character set that is not supported by the Internet
> > Service.  To view the original message content,  open the attached
> > message. If the text doesn't display correctly, save the attachment to
> > disk, and then open it using a viewer that can display the original
> > character set. << File: message.txt >> 
> 


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


Re: pgmonitor on solaris

From
Bruce Momjian
Date:
OK, my guess is that it is failing on these two lines:
    gsub(\"\\\\(\[\^\\\\)\]*\\\\)\",\"\",cmd); # remove entries around parens, (), *BSD
gsub(\"\^\[\^:\]*:\",\"\",cmd);       # remove command with colon, cmd:, Linux
 

Can you confirm that adding a # to the front of each lines prevents the
error.  If so, can you find out from the manual pages if your awk
version supports gsub, and if it doesn't, can you send me a copy of the
manual page so I can find a work around.  gsub in gawk says:
      gsub(r, s [, t])        for  each  substring  matching the                              regular expression r in
thestring                              t,  substitute  the  string s, and                              return  the
number of  substitu-                              tions.   If t is not supplied, use                              $0.
An& in the replacement  text                              is replaced with the text that was
 actually matched.  Use \& to get a                              literal  &.  See AWK Language Pro-
        gramming for a  fuller  discussion                              of  the  rules  for  &'s and back-
               slashes in the replacement text of                              sub(), gsub(), and gensub().
 


[ Charset ISO-8859-1 unsupported, converting... ]
> Thank You
> I?m using old solaris 2.5.1
> I download pgmonitor 0.27 tryed again, and:
> 
> $ ./pgmonitor
> Can't run 'ps': awk: syntax error near line 3
> awk: illegal statement near line 3
> awk: illegal statement near line 4
> Please send in a patch.
> $
> 
> As sugested by Peter Eisentraut I changed all /bin/ps to /usr/ucb/ps and 
> the error is now:
> 
> $ ./pgm-ucb
> Can't run 'ps': child process exited abnormally
> Please send in a patch.
> $
> 
> I tryed /usr/ucb/ps with the following args:
> 
> /usr/ucb/ps auww - OK -also show PID?s
> /usr/ucb/ps p - There is no p args
> /usr/ucb/ps U postgres- The U arg does not accept the name of user, looks 
> like it is not for display postgres (user) process.
> 
> Synce I will move the PostgreSQL to a dual PIII linux server and, I think, 
> pgmonitor will work OK on linux, it is not an emergency, but I would like 
> to see pgmonitor working in my old Solaris.
> 
> Do you think it will work in newer Solaris versions?
> 
> Thank you
> 
> ROberto
> 
> 
> At 18:36 25/03/01, you wrote:
> >You don't mention the version of pgmonitor, but 0.27 is the most recent.
> >I just made a few awk fixes.  Maybe that will fix it.
> >
> >Strange it is mentining an 'awk' error here.  My guess is that it
> >doesn't like some of the 'awk' commands I have used.  Does anyone see
> >some non-portable awk stuff in there?  Can you run the command manually
> >to find the part of the awk it is failing with?
> >
> >The main web site for pgmonitor is:
> >         http://greatbridge.org/project/pgmonitor/projdisplay.php
> >
> >You can download the most recent version from
> >         ftp://ftp.greatbridge.org/pub/pgmonitor
> >
> >Bruce Momjian <pgman@candle.pha.pa.us>
> >[ Charset ISO-8859-1 unsupported, converting... ]
> > > Roberto Jo?o Lopes Garcia writes:
> > >
> > > > Is there a pgmonitor version for Solaris?? It dies with:
> > > >
> > > > Can't run 'ps': awk: syntax error near line 3
> > > > awk: illegal statement near line 3
> > > > awk: illegal statement near line 4
> > > > Please send in a patch.
> > > >
> > > > I tried to fix it whith:
> > > >
> > > > 1 - correct the path to ps.
> > > > 2 - convert Linux ps args to Solaris 2.5.1 ps args.
> > > >
> > > > Step 2 did not work, I could not find equivalents to x,w args and I 
> > do not
> > > > know if it is the only think that must be fixed.
> > >
> > > The x and w options for ps are BSD-style (not Linux).  On Solaris you'll
> > > find a BSD-style ps under /usr/ucb/.  With the SysV-style ps at
> > > /usr/bin/ps the -e option is the closest thing to it, but it probably
> > > won't work with pgmonitor.
> > >
> > > --
> > > Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/
> > >
> > >
> > > ---------------------------(end of broadcast)---------------------------
> > > TIP 2: you can get off all lists at once with the unregister command
> > >     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> > >
> >
> >
> >--
> >   Bruce Momjian                        |  http://candle.pha.pa.us
> >   pgman@candle.pha.pa.us               |  (610) 853-3000
> >   +  If your life is a hard drive,     |  830 Blythe Avenue
> >   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
> 
> 


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


Re: pgmonitor on solaris

From
Bruce Momjian
Date:
[ Charset ISO-8859-1 unsupported, converting... ]
> The problem is that Solaris uses the "original" version of Awk by default
> (apparently nobody knows why).
> This version lacks many features which have been available in later versions
> for approximately forever (in computing chronology :-)).
> Two other versions exist on Solaris:
> *    "nawk" ("new awk", i.e. the updated "old awk")
> *    /usr/xpg4/bin/awk (another, posix-compliant awk).
> Solaris seems to be weird this way.  Other platforms don't seem to have this
> problem.  Linux and FreeBSD, for example, use GNU awk, which would have all
> of the required functionality and more.

OK, I have confirmed you are correct.  I find at:
http://www.oase-shareware.org/shell/articles/awkcompat.html

a chart comparing awk versions on different OS's and it shows gsub() not
supported on Solaris, Solaris 2.5,2.6,5.7,5.8 (sparc), /usr/5bin/awk. 
nawk does have it.

I have put a 0.28 version of pgmonitor on my web site that tests for
awk/nawk/gawk and gsub(), and uses the one that works.  Can someone test
this on Solaris and let me know if it is OK?

pgmonitor README attached:

---------------------------------------------------------------------------
                             P G   M O N I T O R

pgmonitor, version 0.28

The main web site for pgmonitor is:http://greatbridge.org/project/pgmonitor/projdisplay.php

You can download the most recent version fromftp://ftp.greatbridge.org/pub/pgmonitor

This tool allows monitoring of PostgreSQL activity.  It requires Tcl/Tk
8.0 or later.  It may require modification of the 'ps' flags for certain
platforms.  It is known to run on *BSD, Linux, and HPUX.

Pgmonitor only works when run on the database server machine.  To use it
remotely, log into the remote machine, set the DISPLAY variable to point
to your local X server, and start pgmonitor.  Pgmonitor will then run on
the remote machine, but will display on your local machine.

Pgmonitor uses 'ps' to display backend process activity.  It uses 'gdb'
to display running queries, and 'kill' to cancel queries and terminate
database connections.

Pgmonitor stores your most recent refresh and sort settings in the file
~/.pgmonitor.  This file is used to reload your defaults every time
pgmonitor is started.

If you are running PostgreSQL 7.1.0 or earlier, the 'query' button will
not work unless you compile PostgreSQL with debug symbols (-g), or apply
the supplied patch 'query_display.diff' and recompile PostgreSQL.  The
later method is recommended.

Bruce Momjian <pgman@candle.pha.pa.us>

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


Re: pgmonitor on solaris

From
Peter Eisentraut
Date:
Bruce Momjian writes:

> See previous email.  Seems it is my awk code that is the problem.

It seems odd that a Tcl program would have to use awk.  Awk is one of the
more unportable tools in existance.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



Re: pgmonitor on solaris

From
Bruce Momjian
Date:
> Bruce Momjian writes:
> 
> > See previous email.  Seems it is my awk code that is the problem.
> 
> It seems odd that a Tcl program would have to use awk.  Awk is one of the
> more unportable tools in existance.
> 

I guess if I was better with TCL, I could avoid awk.  Patch anyone?  :-)

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


Re: pgmonitor on solaris

From
Bruce Momjian
Date:
> Ok +/-
> On Solaris 2.5.1 - Pgmonitor 0.28
> 
> No message errors, the pgmonitor window comes up but does not show any 
> proccess. I started psql and make a query that runs a litle long (select 
> nm_arq from cd_arqs order by nm_arq), select refresh on pgmonitor and show 
> nothing.

It should show idle connections even if no query is being run.

Looks like nawk is failing for some reason, and it also sounds like ucb
ps also has problems.  Can anyone give me telnet/ssh access to a Solaris
machine?

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


Re: pgmonitor on solaris

From
Bruce Momjian
Date:
>  From the man /usr/ucb/ps there is no argument to display proccess for a 
> expecific user U or u so I think can't be used.
>  From the man /bin/ps: -f long format,
>                        -U user name list,
>                        -u user ID list,
>                        -e all proccess,
>                        -p proc list
> 
> I changed same pgmonitor ps_???_args but I could not fix it. Still not 
> showing proccess.

OK, let's stay away from ucb ps because with no user restriction, the ps
command will take too long to be run repeatedly.  Do you have gawk?  Can
you edit the script and replace the mention of nawk with gawk:
if { ... nawk ...} {    set awk "gawk"  <--------------}

and let me know how it works.

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


Re: pgmonitor on solaris

From
Bruce Momjian
Date:
> At 16:53 26/03/01, Bruce Momjian wrote:
> 
> >OK, let's stay away from ucb ps because with no user restriction, the ps
> >command will take too long to be run repeatedly.  Do you have gawk?  Can
> >you edit the script and replace the mention of nawk with gawk:
> >
> >         if { ... nawk ...} {
> >                 set awk "gawk"  <--------------
> >         }
> >
> >and let me know how it works.
> 
> Sorry, do not work!
> 
> Get gawk 3.0.6, compile and test OK! From command line gawk OK! change set 
> awk  "gawk" in all ifs to be sure it will use gawk - don't show! change 
> again to include path to gawk: set awk "/usr/gnu/bin/gawk" - don't show!
> 
> I know litle awk and tcl but, to me, it is ps not returning any postgres 
> proccess. Is there an away to see the ps result, like set an enviroment 
> variable (PS_RESULT1, PS_RESULT2, PS_RESULT2)
> 
> Sorry I can not setup an SSH account for you in this machine! It is an 
> internal server.
> 

OK, seems it is not only awk that is the problem.  Can you start
removing the sort and cut sections. In fact, remove both of them and see
if you get any output.  You can add:puts stdout $var

to print the value of $var in the TCL code.  This may help you manually
find the cause.


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


Re: pgmonitor on solaris

From
"Brett W. McCoy"
Date:
On Mon, 26 Mar 2001, Peter Eisentraut wrote:

> > See previous email.  Seems it is my awk code that is the problem.
>
> It seems odd that a Tcl program would have to use awk.  Awk is one of the
> more unportable tools in existance.

Actually, Perl/Tk may have been a better language to code this in -- you
essentially get all the features of awk (and sed and everything else you
get with Perl) with the portability of Perl and the GUI of Tcl/Tk...

-- Brett               http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
Eureka!    -- Archimedes



Re: pgmonitor on solaris

From
Roberto João Lopes Garcia
Date:
Thank You
I´m using old solaris 2.5.1
I download pgmonitor 0.27 tryed again, and:

$ ./pgmonitor
Can't run 'ps': awk: syntax error near line 3
awk: illegal statement near line 3
awk: illegal statement near line 4
Please send in a patch.
$

As sugested by Peter Eisentraut I changed all /bin/ps to /usr/ucb/ps and 
the error is now:

$ ./pgm-ucb
Can't run 'ps': child process exited abnormally
Please send in a patch.
$

I tryed /usr/ucb/ps with the following args:

/usr/ucb/ps auww - OK -also show PID´s
/usr/ucb/ps p - There is no p args
/usr/ucb/ps U postgres- The U arg does not accept the name of user, looks 
like it is not for display postgres (user) process.

Synce I will move the PostgreSQL to a dual PIII linux server and, I think, 
pgmonitor will work OK on linux, it is not an emergency, but I would like 
to see pgmonitor working in my old Solaris.

Do you think it will work in newer Solaris versions?

Thank you

ROberto


At 18:36 25/03/01, you wrote:
>You don't mention the version of pgmonitor, but 0.27 is the most recent.
>I just made a few awk fixes.  Maybe that will fix it.
>
>Strange it is mentining an 'awk' error here.  My guess is that it
>doesn't like some of the 'awk' commands I have used.  Does anyone see
>some non-portable awk stuff in there?  Can you run the command manually
>to find the part of the awk it is failing with?
>
>The main web site for pgmonitor is:
>         http://greatbridge.org/project/pgmonitor/projdisplay.php
>
>You can download the most recent version from
>         ftp://ftp.greatbridge.org/pub/pgmonitor
>
>Bruce Momjian <pgman@candle.pha.pa.us>
>[ Charset ISO-8859-1 unsupported, converting... ]
> > Roberto Jo?o Lopes Garcia writes:
> >
> > > Is there a pgmonitor version for Solaris?? It dies with:
> > >
> > > Can't run 'ps': awk: syntax error near line 3
> > > awk: illegal statement near line 3
> > > awk: illegal statement near line 4
> > > Please send in a patch.
> > >
> > > I tried to fix it whith:
> > >
> > > 1 - correct the path to ps.
> > > 2 - convert Linux ps args to Solaris 2.5.1 ps args.
> > >
> > > Step 2 did not work, I could not find equivalents to x,w args and I 
> do not
> > > know if it is the only think that must be fixed.
> >
> > The x and w options for ps are BSD-style (not Linux).  On Solaris you'll
> > find a BSD-style ps under /usr/ucb/.  With the SysV-style ps at
> > /usr/bin/ps the -e option is the closest thing to it, but it probably
> > won't work with pgmonitor.
> >
> > --
> > Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> >     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> >
>
>
>--
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 853-3000
>   +  If your life is a hard drive,     |  830 Blythe Avenue
>   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



Re: pgmonitor on solaris

From
Roberto João Lopes Garcia
Date:
I don't have gawk.

I just get it. Will compile test and  send results back to you.

Roberto

At 16:53 26/03/01, Bruce Momjian wrote:
> >  From the man /usr/ucb/ps there is no argument to display proccess for a
> > expecific user U or u so I think can't be used.
> >  From the man /bin/ps: -f long format,
> >                        -U user name list,
> >                        -u user ID list,
> >                        -e all proccess,
> >                        -p proc list
> >
> > I changed same pgmonitor ps_???_args but I could not fix it. Still not
> > showing proccess.
>
>OK, let's stay away from ucb ps because with no user restriction, the ps
>command will take too long to be run repeatedly.  Do you have gawk?  Can
>you edit the script and replace the mention of nawk with gawk:
>
>         if { ... nawk ...} {
>                 set awk "gawk"  <--------------
>         }
>
>and let me know how it works.
>
>--
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 853-3000
>   +  If your life is a hard drive,     |  830 Blythe Avenue
>   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



Re: pgmonitor on solaris

From
Roberto João Lopes Garcia
Date:
Ok +/-
On Solaris 2.5.1 - Pgmonitor 0.28

No message errors, the pgmonitor window comes up but does not show any
proccess. I started psql and make a query that runs a litle long (select
nm_arq from cd_arqs order by nm_arq), select refresh on pgmonitor and show
nothing.

Again, I changed the path to ps from /bin/ps to /usr/ucb/ps and it print
the following errors:

#   ./pgmonitor
Error in startup script: Can't run 'ps'
Please send in a patch.
     while executing
"error "Can't run 'ps'\nPlease send in a patch.""
     (procedure "widget_init" line 62)
     invoked from within
"widget_init $argc $argv .top"
     (procedure "main" line 2)
     invoked from within
"main $argc $argv"
     (file "./pgmonitor" line 833)
#

 From the man /usr/ucb/ps there is no argument to display proccess for a
expecific user U or u so I think can't be used.
 From the man /bin/ps: -f long format,
                       -U user name list,
                       -u user ID list,
                       -e all proccess,
                       -p proc list

I changed same pgmonitor ps_???_args but I could not fix it. Still not
showing proccess.

Please see the atached man pages

Thank You

Roberto

The problem know, I think is the ps command
At 14:09 26/03/01, Bruce Momjian wrote:
>[ Charset ISO-8859-1 unsupported, converting... ]
> > The problem is that Solaris uses the "original" version of Awk by default
> > (apparently nobody knows why).
> > This version lacks many features which have been available in later
> versions
> > for approximately forever (in computing chronology :-)).
> > Two other versions exist on Solaris:
> > *     "nawk" ("new awk", i.e. the updated "old awk")
> > *     /usr/xpg4/bin/awk (another, posix-compliant awk).
> > Solaris seems to be weird this way.  Other platforms don't seem to have
> this
> > problem.  Linux and FreeBSD, for example, use GNU awk, which would have all
> > of the required functionality and more.
>
>OK, I have confirmed you are correct.  I find at:
>
>         http://www.oase-shareware.org/shell/articles/awkcompat.html
>
>a chart comparing awk versions on different OS's and it shows gsub() not
>supported on Solaris, Solaris 2.5,2.6,5.7,5.8 (sparc), /usr/5bin/awk.
>nawk does have it.
>
>I have put a 0.28 version of pgmonitor on my web site that tests for
>awk/nawk/gawk and gsub(), and uses the one that works.  Can someone test
>this on Solaris and let me know if it is OK?
>
>pgmonitor README attached:
>
>---------------------------------------------------------------------------
>
>                               P G   M O N I T O R
>
>pgmonitor, version 0.28
>
>The main web site for pgmonitor is:
>         http://greatbridge.org/project/pgmonitor/projdisplay.php
>
>You can download the most recent version from
>         ftp://ftp.greatbridge.org/pub/pgmonitor
>
>This tool allows monitoring of PostgreSQL activity.  It requires Tcl/Tk
>8.0 or later.  It may require modification of the 'ps' flags for certain
>platforms.  It is known to run on *BSD, Linux, and HPUX.
>
>Pgmonitor only works when run on the database server machine.  To use it
>remotely, log into the remote machine, set the DISPLAY variable to point
>to your local X server, and start pgmonitor.  Pgmonitor will then run on
>the remote machine, but will display on your local machine.
>
>Pgmonitor uses 'ps' to display backend process activity.  It uses 'gdb'
>to display running queries, and 'kill' to cancel queries and terminate
>database connections.
>
>Pgmonitor stores your most recent refresh and sort settings in the file
>~/.pgmonitor.  This file is used to reload your defaults every time
>pgmonitor is started.
>
>If you are running PostgreSQL 7.1.0 or earlier, the 'query' button will
>not work unless you compile PostgreSQL with debug symbols (-g), or apply
>the supplied patch 'query_display.diff' and recompile PostgreSQL.  The
>later method is recommended.
>
>Bruce Momjian <pgman@candle.pha.pa.us>
>
>--
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 853-3000
>   +  If your life is a hard drive,     |  830 Blythe Avenue
>   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Attachment

Re: pgmonitor on solaris

From
Roberto João Lopes Garcia
Date:
At 16:53 26/03/01, Bruce Momjian wrote:

>OK, let's stay away from ucb ps because with no user restriction, the ps
>command will take too long to be run repeatedly.  Do you have gawk?  Can
>you edit the script and replace the mention of nawk with gawk:
>
>         if { ... nawk ...} {
>                 set awk "gawk"  <--------------
>         }
>
>and let me know how it works.

Sorry, do not work!

Get gawk 3.0.6, compile and test OK! From command line gawk OK! change set 
awk  "gawk" in all ifs to be sure it will use gawk - don't show! change 
again to include path to gawk: set awk "/usr/gnu/bin/gawk" - don't show!

I know litle awk and tcl but, to me, it is ps not returning any postgres 
proccess. Is there an away to see the ps result, like set an enviroment 
variable (PS_RESULT1, PS_RESULT2, PS_RESULT2)

Sorry I can not setup an SSH account for you in this machine! It is an 
internal server.

Roberto


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



Re: Re: pgmonitor on solaris

From
Bruce Momjian
Date:
> On Mon, 26 Mar 2001, Peter Eisentraut wrote:
> 
> > > See previous email.  Seems it is my awk code that is the problem.
> >
> > It seems odd that a Tcl program would have to use awk.  Awk is one of the
> > more unportable tools in existance.
> 
> Actually, Perl/Tk may have been a better language to code this in -- you
> essentially get all the features of awk (and sed and everything else you
> get with Perl) with the portability of Perl and the GUI of Tcl/Tk...

Yes, agreed, but I need easy to install stuff, and pgaccess already uses
tcl/tk.  I have the nawk/gsub thing fixed.  I just need to find the
other messed up part.

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