Thread: pg_standby: How to check in which state the server is currently?

pg_standby: How to check in which state the server is currently?

From
Frank Lanitz
Date:
Hi list,

We had in past from time to time the issue, that the standby server is
stopping recovering, creating a new timeline and become up and running.
In parallel to check for the reasons of this behavior we are looking for
a clean way to check whether warm standby database is still in
recovering mode or has become ready. I did some search, but didn't found
any ready-2-use script for doing this on a stand alone basis (should
only be temp. solution that will be replaced by real monitoring later)
I looked for some solution checking ps for pg_standby and trying to
connect to database. But I'm not sure how 'secure' in terms of falls
positive and missed events this is.

Can anybody put me onto the right way here?

Cheers,
Frank

Re: pg_standby: How to check in which state the server is currently?

From
Ray Stell
Date:
On Mon, Dec 05, 2011 at 12:16:29PM +0100, Frank Lanitz wrote:
> Hi list,
>
> We had in past from time to time the issue, that the standby server is
> stopping recovering, creating a new timeline and become up and running.
> In parallel to check for the reasons of this behavior we are looking for
> a clean way to check whether warm standby database is still in
> recovering mode or has become ready.

pg_controldata

Re: pg_standby: How to check in which state the server is currently?

From
Cédric Villemain
Date:
Le 5 décembre 2011 12:16, Frank Lanitz <frank@frank.uvena.de> a écrit :
> Hi list,
>
> We had in past from time to time the issue, that the standby server is
> stopping recovering, creating a new timeline and become up and running.
> In parallel to check for the reasons of this behavior we are looking for
> a clean way to check whether warm standby database is still in
> recovering mode or has become ready. I did some search, but didn't found
> any ready-2-use script for doing this on a stand alone basis (should
> only be temp. solution that will be replaced by real monitoring later)

See check_postgres , I have added that recently for similar purpose.
You give it  one  of '--assume-standby-mode' or '--assume-prod' when
you check the last checkpoint.
If the server is not in the expected mode, emit CRITICAL (for nagios,
but check_postgres is a standlone script and can be used with other
supervision/monitoring software)
It is not yet release, see :
https://github.com/bucardo/check_postgres/commit/0ff408711dab18b05de26656a945fa37e363f6aa
(depends on other patches but you get the idea)
http://bucardo.org/wiki/Check_postgres


> I looked for some solution checking ps for pg_standby and trying to
> connect to database. But I'm not sure how 'secure' in terms of falls
> positive and missed events this is.
>
> Can anybody put me onto the right way here?
>
> Cheers,
> Frank
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general



--
Cédric Villemain +33 (0)6 20 30 22 52
http://2ndQuadrant.fr/
PostgreSQL: Support 24x7 - Développement, Expertise et Formation

Re: pg_standby: How to check in which state the server is currently?

From
Frank Lanitz
Date:
Am 05.12.2011 17:02, schrieb Cédric Villemain:
> Le 5 décembre 2011 12:16, Frank Lanitz <frank@frank.uvena.de> a écrit :
>> Hi list,
>>
>> We had in past from time to time the issue, that the standby server is
>> stopping recovering, creating a new timeline and become up and running.
>> In parallel to check for the reasons of this behavior we are looking for
>> a clean way to check whether warm standby database is still in
>> recovering mode or has become ready. I did some search, but didn't found
>> any ready-2-use script for doing this on a stand alone basis (should
>> only be temp. solution that will be replaced by real monitoring later)
>
> See check_postgres , I have added that recently for similar purpose.
> You give it  one  of '--assume-standby-mode' or '--assume-prod' when
> you check the last checkpoint.
> If the server is not in the expected mode, emit CRITICAL (for nagios,
> but check_postgres is a standlone script and can be used with other
> supervision/monitoring software)
> It is not yet release, see :
> https://github.com/bucardo/check_postgres/commit/0ff408711dab18b05de26656a945fa37e363f6aa
> (depends on other patches but you get the idea)
> http://bucardo.org/wiki/Check_postgres

A first view looks very promissing. Will have a deeper look ;)

Cheers,
Frank