Loading ...
Sorry, an error occurred while loading the content.

Re: [Control-X] How to check the status of a PostgreSQL database

Expand Messages
  • Tim Marshall
    Hello, I think someone already indicated that the best approach would be to just run the following command to verify if the db is up or not. psql -v I would
    Message 1 of 5 , Oct 1, 2012
    • 0 Attachment
      Hello,

      I think someone already indicated that the best approach would be to just
      run the following command to verify if the db is up or not.

      psql -v

      I would put this in a Control-M job and if you the Control-M job doesn't
      get to the DB it will come back with a return code 1 turning the job red
      and you getting an alert.

      This would need to be tested, to confirm the return code, as some
      commandline jobs in Control-M are always successful even thought they don't
      do what you expect.

      Thanks,

      Timothy Marshall



      From: "cookb4ueat" <bcook@...>
      To: Control-X@yahoogroups.com,
      Date: 28/09/2012 04:50 PM
      Subject: [Control-X] How to check the status of a PostgreSQL database
      Sent by: Control-X@yahoogroups.com






      Does anyone know of a way to check the status of the Enterprise Manager
      PostgreSQL dedicated database server on Linux? I thought that I could just
      pipe the output of running psql and grep for "Connection refused", but this
      does not seem to work as nothing is sent to pipe.

      Here is the command that I am trying:

      psql -c "\q" | grep "Connection refused".

      The results are still displayed on the screen and not sent to the pipe. I
      have also tried a re-direct to capture this in a file and have the same
      results. The file is empty, but the Connection refused message still
      displays on the screen.

      Looking for any ideas and apprecieate any feedback.

      Brian Cook
    • cookb4ueat
      Thank you to everyone that replied. I have tried to redirection of the output from stderr to stdout that this solution is exactly what I needed. I really
      Message 2 of 5 , Oct 1, 2012
      • 0 Attachment
        Thank you to everyone that replied. I have tried to redirection of the output from stderr to stdout that this solution is exactly what I needed. I really appreciate all of the other solutions provided as well.

        Brian Cook

        --- In Control-X@yahoogroups.com, Tim Marshall <tim.marshall@...> wrote:
        >
        > Hello,
        >
        > I think someone already indicated that the best approach would be to just
        > run the following command to verify if the db is up or not.
        >
        > psql -v
        >
        > I would put this in a Control-M job and if you the Control-M job doesn't
        > get to the DB it will come back with a return code 1 turning the job red
        > and you getting an alert.
        >
        > This would need to be tested, to confirm the return code, as some
        > commandline jobs in Control-M are always successful even thought they don't
        > do what you expect.
        >
        > Thanks,
        >
        > Timothy Marshall
        >
        >
        >
        > From: "cookb4ueat" <bcook@...>
        > To: Control-X@yahoogroups.com,
        > Date: 28/09/2012 04:50 PM
        > Subject: [Control-X] How to check the status of a PostgreSQL database
        > Sent by: Control-X@yahoogroups.com
        >
        >
        >
        >
        >
        >
        > Does anyone know of a way to check the status of the Enterprise Manager
        > PostgreSQL dedicated database server on Linux? I thought that I could just
        > pipe the output of running psql and grep for "Connection refused", but this
        > does not seem to work as nothing is sent to pipe.
        >
        > Here is the command that I am trying:
        >
        > psql -c "\q" | grep "Connection refused".
        >
        > The results are still displayed on the screen and not sent to the pipe. I
        > have also tried a re-direct to capture this in a file and have the same
        > results. The file is empty, but the Connection refused message still
        > displays on the screen.
        >
        > Looking for any ideas and apprecieate any feedback.
        >
        > Brian Cook
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.