Thread: HELP !!!! Deleted the content of bin directory

HELP !!!! Deleted the content of bin directory

From
"Alain Lavigne"
Date:
I inadvertly deleted the content of the /usr/local/pgsql/bin directory.  How
do I get back the files ???



Re: HELP !!!! Deleted the content of bin directory

From
Bruce Momjian
Date:
Alain Lavigne wrote:
> I inadvertly deleted the content of the /usr/local/pgsql/bin directory.  How
> do I get back the files ???

Just reinstall the software.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: HELP !!!! Deleted the content of bin directory

From
Oliver Elphick
Date:
On Wed, 2002-09-04 at 15:02, Alain Lavigne wrote:
> I inadvertly deleted the content of the /usr/local/pgsql/bin directory.  How
> do I get back the files ???

Since you are using /usr/local, I assume you built PostgreSQL from
source.

So run `make install' again.

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "He hath not dealt with us after our sins; nor rewarded
      us according to our iniquities. For as the heaven is
      high above the earth, so great is his mercy toward
      them that fear him. As far as the east is from the
      west, so far hath he removed our transgressions from
      us."     Psalms 103:10-12


Remote monitoring

From
"Marc Mitchell"
Date:
I have a requirement to be able to remotely monitor and diagnose a
production Postgres installation running on a machine with limited firewall
access.  When local to the box, I use pgmonitor and find it completely
indispensable.  But, from my remote location, I can only slogin to the box
and get terminal access and thus have a problem with the Xwindows display.
Admittedly, I'm not very well versed in Xwindows.  Is there any way to
achieve similar functionality but in a completely server based way?  I know
pgmonitor is basically based on a series of ps and awk commands.  Is there
a way this could be wrapped in a script to provide straight text based
information along the same lines as "top" or "sar"?

Thank you for any insight you can provide.

Marc Mitchell - Senior Application Architect
Enterprise Information Solutions, Inc.
4910 Main Street
Downers Grove, IL 60515
marcm@eisolution.com


Re: Remote monitoring

From
Bruce Momjian
Date:
Marc Mitchell wrote:
> I have a requirement to be able to remotely monitor and diagnose a
> production Postgres installation running on a machine with limited firewall
> access.  When local to the box, I use pgmonitor and find it completely
> indispensable.  But, from my remote location, I can only slogin to the box
> and get terminal access and thus have a problem with the Xwindows display.
> Admittedly, I'm not very well versed in Xwindows.  Is there any way to
> achieve similar functionality but in a completely server based way?  I know
> pgmonitor is basically based on a series of ps and awk commands.  Is there
> a way this could be wrapped in a script to provide straight text based
> information along the same lines as "top" or "sar"?

Well, if you enable  stats_command_string in postgresql.conf you will
see the queries being run in pg_stat_activity.

Another option is to ssh into the machine, set your $DISPLAY back to
your local machine, and then run pgmonitor.  ssh does secure remote X
display.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Remote monitoring

From
"Marc Mitchell"
Date:
----- Original Message -----
From: "Bruce Momjian" <pgman@candle.pha.pa.us>
To: "Marc Mitchell" <marcm@eisolution.com>
Cc: <pgsql-admin@postgresql.org>
Sent: Thursday, September 05, 2002 11:25 PM
Subject: Re: [ADMIN] Remote monitoring


> Marc Mitchell wrote:
> > I have a requirement to be able to remotely monitor and diagnose a
> > production Postgres installation running on a machine with limited
firewall
> > access.  When local to the box, I use pgmonitor and find it completely
> > indispensable.  But, from my remote location, I can only slogin to the
box
> > and get terminal access and thus have a problem with the Xwindows
display.
> > Admittedly, I'm not very well versed in Xwindows.  Is there any way to
> > achieve similar functionality but in a completely server based way?  I
know
> > pgmonitor is basically based on a series of ps and awk commands.  Is
there
> > a way this could be wrapped in a script to provide straight text based
> > information along the same lines as "top" or "sar"?
>
> Well, if you enable  stats_command_string in postgresql.conf you will
> see the queries being run in pg_stat_activity.

Would this have a performance cost?  Where does the X-based pgmonitor get
its query string data?

>
> Another option is to ssh into the machine, set your $DISPLAY back to
> your local machine, and then run pgmonitor.  ssh does secure remote X
> display.

When remote, the link between my workstation to the box being monitored is
via the net where my machine gains access via a NAT router and does not
have its own publicly routable IP.  So making the connection back from
server to workstation is problematic at best.

Would it be possible to get the code for the current X-based stuff in order
to convert it to a straight text based display in either ksh script or
perhaps C?  I wouldn't try to implement some of the more UI related stuff
like the ability to specify sort order or shutdown the server.  But having
a basic refreshing display of active sessions and the ability to get query
details on an one would same a do-able thing in C.

Marc Mitchell
Enterprise Information Solutions, Inc.
Downers Grove, IL 60515
marcm@eisolution.com

>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 359-1001
>   +  If your life is a hard drive,     |  13 Roberts Road
>   +  Christ can be your backup.        |  Newtown Square, Pennsylvania
19073
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org


Re: Remote monitoring

From
Bruce Momjian
Date:
Marc Mitchell wrote:
> > Well, if you enable  stats_command_string in postgresql.conf you will
> > see the queries being run in pg_stat_activity.
>
> Would this have a performance cost?  Where does the X-based pgmonitor get

Less that 1% performance load.

> its query string data?

The X-based solution gets its query string from the local machine, it
just pipes the X display back to your local machine.

> > Another option is to ssh into the machine, set your $DISPLAY back to
> > your local machine, and then run pgmonitor.  ssh does secure remote X
> > display.
>
> When remote, the link between my workstation to the box being monitored is
> via the net where my machine gains access via a NAT router and does not
> have its own publicly routable IP.  So making the connection back from
> server to workstation is problematic at best.
>
> Would it be possible to get the code for the current X-based stuff in order
> to convert it to a straight text based display in either ksh script or
> perhaps C?  I wouldn't try to implement some of the more UI related stuff
> like the ability to specify sort order or shutdown the server.  But having
> a basic refreshing display of active sessions and the ability to get query
> details on an one would same a do-able thing in C.

Actually, there is a text-based TCL/Tk library.  I think it was done by
SCO initially for their install stuff.  Anyway, I am sure it exists
somewhere, and if you can get it, the script should just run with no
changes to pgaccess.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Remote monitoring

From
"Ross J. Reedstrom"
Date:
On Fri, Sep 06, 2002 at 08:42:15AM -0500, Marc Mitchell wrote:
> ----- Original Message -----
> From: "Bruce Momjian" <pgman@candle.pha.pa.us>
> To: "Marc Mitchell" <marcm@eisolution.com>
> Cc: <pgsql-admin@postgresql.org>
> Sent: Thursday, September 05, 2002 11:25 PM
> Subject: Re: [ADMIN] Remote monitoring
>
>
> > Marc Mitchell wrote:
>
> >
> > Another option is to ssh into the machine, set your $DISPLAY back to
> > your local machine, and then run pgmonitor.  ssh does secure remote X
> > display.
>
> When remote, the link between my workstation to the box being monitored is
> via the net where my machine gains access via a NAT router and does not
> have its own publicly routable IP.  So making the connection back from
> server to workstation is problematic at best.

I think you and Bruce are talking past each other, here. You mention
slogin, Bruce mentions SSH. Clearly, the server can get packets to your
workstation, and vice versa, since you can get a terminal session. SSH
has the capability to piggy-back an encrypted X session on top of that
connection: I don't think slogin does. To use it, you need to enable
the option, or use the command line switch (unfortunately, the switch
has varied from version to version of SSH, so I can't tell you which
one it is, either -x or -X)

If you've got sshd running on the server, you're golden - I do this all
the time, with our wireless net here, BTW.

Ross

Curses-based Tk toolkit (was Re: Remote monitoring)

From
"David F. Skoll"
Date:
On Fri, 6 Sep 2002, Bruce Momjian wrote:

> Actually, there is a text-based TCL/Tk library.

There is one, and it's excellent: http://www.ch-werner.de/ck/  This
is not the SCO one that Bruce mentioned; I haven't heard of that.

It's mostly compatible with Tk, but most scripts need a few changes
to work with it.  pgaccess, for example, will not run unmodified.

Regards,

David.


Re: Curses-based Tk toolkit (was Re: Remote monitoring)

From
Larry Rosenman
Date:
On Fri, 2002-09-06 at 09:59, David F. Skoll wrote:
> On Fri, 6 Sep 2002, Bruce Momjian wrote:
>
> > Actually, there is a text-based TCL/Tk library.
>
> There is one, and it's excellent: http://www.ch-werner.de/ck/  This
> is not the SCO one that Bruce mentioned; I haven't heard of that.
>
> It's mostly compatible with Tk, but most scripts need a few changes
> to work with it.  pgaccess, for example, will not run unmodified.
the SCO one is Visual TCL.


>
> Regards,
>
> David.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
--
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


Re: Remote monitoring

From
Andrew Sullivan
Date:
On Fri, Sep 06, 2002 at 08:42:15AM -0500, Marc Mitchell wrote:
>
> Would it be possible to get the code for the current X-based stuff in order
> to convert it to a straight text based display in either ksh script or
> perhaps C?  I wouldn't try to implement some of the more UI related stuff
> like the ability to specify sort order or shutdown the server.  But having
> a basic refreshing display of active sessions and the ability to get query
> details on an one would same a do-able thing in C.

My colleague, Sorin Iszlai (siszlai@libertyrms.info), has already
done this.  He has asked me for some more time to clean up the code
and make it commented and such, but we intend to release it.  I just
don't have a date yet.

Bruce Momjian told me, however, that the pgmonitor stuff was being
merged with another project.  I'm not sure how that will affect the
utility of Sorin's code.

A

--
----
Andrew Sullivan                         204-4141 Yonge Street
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M2P 2A8
                                         +1 416 646 3304 x110


Re: Curses-based Tk toolkit (was Re: Remote monitoring)

From
Bruce Momjian
Date:
Larry Rosenman wrote:
> On Fri, 2002-09-06 at 09:59, David F. Skoll wrote:
> > On Fri, 6 Sep 2002, Bruce Momjian wrote:
> >
> > > Actually, there is a text-based TCL/Tk library.
> >
> > There is one, and it's excellent: http://www.ch-werner.de/ck/  This
> > is not the SCO one that Bruce mentioned; I haven't heard of that.
> >
> > It's mostly compatible with Tk, but most scripts need a few changes
> > to work with it.  pgaccess, for example, will not run unmodified.

> the SCO one is Visual TCL.

You mean vtcl?  That is an application builder for TCL that is used for
pgaccess and my pgmonitor.

    http://vtcl.sourceforge.net/

I don't see it as an ASCII version of tcl/tk.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Curses-based Tk toolkit (was Re: Remote monitoring)

From
Larry Rosenman
Date:
On Fri, 2002-09-06 at 12:23, Bruce Momjian wrote:
> Larry Rosenman wrote:
> > On Fri, 2002-09-06 at 09:59, David F. Skoll wrote:
> > > On Fri, 6 Sep 2002, Bruce Momjian wrote:
> > >
> > > > Actually, there is a text-based TCL/Tk library.
> > >
> > > There is one, and it's excellent: http://www.ch-werner.de/ck/  This
> > > is not the SCO one that Bruce mentioned; I haven't heard of that.
> > >
> > > It's mostly compatible with Tk, but most scripts need a few changes
> > > to work with it.  pgaccess, for example, will not run unmodified.
>
> > the SCO one is Visual TCL.
>
> You mean vtcl?  That is an application builder for TCL that is used for
> pgaccess and my pgmonitor.
>
>     http://vtcl.sourceforge.net/
>
> I don't see it as an ASCII version of tcl/tk.
the VTCL stuff in OpenUNIX does CHARM stuff, which is a Curses based
TCL/TK interface, used for SCOadmin (the admin scripts).

If you want an account on my box to look, you are welcome to one.

LER
>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 359-1001
>   +  If your life is a hard drive,     |  13 Roberts Road
>   +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
--
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749


Re: Curses-based Tk toolkit (was Re: Remote monitoring)

From
Bruce Momjian
Date:
Larry Rosenman wrote:
> > > the SCO one is Visual TCL.
> >
> > You mean vtcl?  That is an application builder for TCL that is used for
> > pgaccess and my pgmonitor.
> >
> >     http://vtcl.sourceforge.net/
> >
> > I don't see it as an ASCII version of tcl/tk.
> the VTCL stuff in OpenUNIX does CHARM stuff, which is a Curses based
> TCL/TK interface, used for SCOadmin (the admin scripts).
>
> If you want an account on my box to look, you are welcome to one.

Yep, I found it.  Seems there are two "Visual TCL"'s:

    http://docsrv.caldera.com/SDK_vtcl/vtclgN.overview.html

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Remote monitoring

From
Bruce Momjian
Date:
Andrew Sullivan wrote:
> On Fri, Sep 06, 2002 at 08:42:15AM -0500, Marc Mitchell wrote:
> >
> > Would it be possible to get the code for the current X-based stuff in order
> > to convert it to a straight text based display in either ksh script or
> > perhaps C?  I wouldn't try to implement some of the more UI related stuff
> > like the ability to specify sort order or shutdown the server.  But having
> > a basic refreshing display of active sessions and the ability to get query
> > details on an one would same a do-able thing in C.
>
> My colleague, Sorin Iszlai (siszlai@libertyrms.info), has already
> done this.  He has asked me for some more time to clean up the code
> and make it commented and such, but we intend to release it.  I just
> don't have a date yet.
>
> Bruce Momjian told me, however, that the pgmonitor stuff was being
> merged with another project.  I'm not sure how that will affect the
> utility of Sorin's code.

pgmonitor was merged into pgaccess and is now part of the current
release:

    http://www.pgaccess.org/

There is actually a pgmonitor menu option.  I assume all future
pgmonitor work will be done as part of pgaccess.  I will add something
to the pgmonitor page stating this when pgaccess release is finalized.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Remote monitoring

From
"Marc Mitchell"
Date:
Ross,

You rock!  This works perfectly!  Thank you very much!

Marc

----- Original Message -----
From: "Ross J. Reedstrom" <reedstrm@rice.edu>
To: "Marc Mitchell" <marcm@eisolution.com>
Cc: "Bruce Momjian" <pgman@candle.pha.pa.us>; <pgsql-admin@postgresql.org>
Sent: Friday, September 06, 2002 9:57 AM
Subject: Re: [ADMIN] Remote monitoring


> On Fri, Sep 06, 2002 at 08:42:15AM -0500, Marc Mitchell wrote:
> > ----- Original Message -----
> > From: "Bruce Momjian" <pgman@candle.pha.pa.us>
> > To: "Marc Mitchell" <marcm@eisolution.com>
> > Cc: <pgsql-admin@postgresql.org>
> > Sent: Thursday, September 05, 2002 11:25 PM
> > Subject: Re: [ADMIN] Remote monitoring
> >
> >
> > > Marc Mitchell wrote:
> >
> > >
> > > Another option is to ssh into the machine, set your $DISPLAY back to
> > > your local machine, and then run pgmonitor.  ssh does secure remote X
> > > display.
> >
> > When remote, the link between my workstation to the box being monitored
is
> > via the net where my machine gains access via a NAT router and does not
> > have its own publicly routable IP.  So making the connection back from
> > server to workstation is problematic at best.
>
> I think you and Bruce are talking past each other, here. You mention
> slogin, Bruce mentions SSH. Clearly, the server can get packets to your
> workstation, and vice versa, since you can get a terminal session. SSH
> has the capability to piggy-back an encrypted X session on top of that
> connection: I don't think slogin does. To use it, you need to enable
> the option, or use the command line switch (unfortunately, the switch
> has varied from version to version of SSH, so I can't tell you which
> one it is, either -x or -X)
>
> If you've got sshd running on the server, you're golden - I do this all
> the time, with our wireless net here, BTW.
>
> Ross


Re: Remote monitoring

From
Bruce Momjian
Date:
Marc Mitchell wrote:
> Ross,
>
> You rock!  This works perfectly!  Thank you very much!

The pgmonitor README does have this paragraph:

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.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Remote monitoring

From
"Marc Mitchell"
Date:
Setting the DISPLAY on the remote machine works fine if the remote machine
can directly access the local/client machine.  It cannot in our case due to
firewall and NAT issues.

In this case we (thanks to Ross) use ssh (instead of the simpler slogin)
from client to remote server.  However, you set DISPLAY on the local
machine, not the remote machine.  The server side of ssh (sshd) sets up all
the required settings to send the X11 traffic back over the established
link.  In fact, the ssh man page on our box explicitly states: "The user
should not manually set DISPLAY." meaning on the remote side.

One thing that was hampering this, at least within our install, was that
the postgres home directory on the remote server was owned by root and not
postgres.  When ssh'ing into the box with the X11 forwarding enabled, the
daemon wants to create a file (".Xauthority") in the home directory of the
user on the remote machine.  When this directory isn't writeable by the
user, the creation of this file fails and the X11 forwarding doesn't work
(and in fact screws up a lot of basic UI-rich apps like vi).  Our solution
was to make that directory writeable by everyone.  We tried pre-creating
just the file and chmod'ing but that didn't work apparently indicating the
process wants to re-create the file as opposed to appending to it.

Also, wasn't able to make this work in the situation where to ssh as user
"X" and then on the remote machine su to user "postgres".  But I didn't try
very hard to figure it out once I got it working under the "postgres"
account.  I suspect it would be do-able.  This might be important if ssh
logins are restricted to certain accounts and those accounts don't include
"postgres" which would be needed to enable the query view functionality as
well as others.

Marc

----- Original Message -----
From: "Bruce Momjian" <pgman@candle.pha.pa.us>
To: "Marc Mitchell" <marcm@eisolution.com>
Cc: "Ross J. Reedstrom" <reedstrm@rice.edu>; <pgsql-admin@postgresql.org>
Sent: Friday, September 06, 2002 1:23 PM
Subject: Re: [ADMIN] Remote monitoring


> Marc Mitchell wrote:
> > Ross,
> >
> > You rock!  This works perfectly!  Thank you very much!
>
> The pgmonitor README does have this paragraph:
>
> 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.
>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 359-1001
>   +  If your life is a hard drive,     |  13 Roberts Road
>   +  Christ can be your backup.        |  Newtown Square, Pennsylvania
19073