pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Async replication: how to get an alert on failure
6+ messages / 5 participants
[nested] [flat]

* Async replication: how to get an alert on failure
@ 2012-08-01 22:29  Edson Richter <richter@simkorp.com.br>
  0 siblings, 2 replies; 6+ messages in thread

From: Edson Richter @ 2012-08-01 22:29 UTC (permalink / raw)
  To: pgsql-general

I have few PostgreSQL servers established with replication.
Now, is there any way to receive an e-mail in case of error during 
synchronization?
I mean, is there an script I can run (maybe every 5 minutes) that will 
check if replication is stolen, and send an e-mail in case of failure?

Thanks,
-- 

*Edson Carlos Ericksson Richter*
/SimKorp Informática Ltda/
Fone: 	(51) 3366-7964
Celular: 	(51)9318-9766/(51) 8585-0796
Embedded Image

Attachments:

cfgfcdef.png (image/png, 3.9K) download view image
^ permalink raw reply [nested|flat] 6+ messages in thread

* Async replication: how to get an alert on failure
@ 2012-08-02 00:04  Edson Richter <edsonrichter@hotmail.com>
  parent: Edson Richter <richter@simkorp.com.br>
  1 sibling, 1 reply; 6+ messages in thread

From: Edson Richter @ 2012-08-02 00:04 UTC (permalink / raw)
  To: pgsql-general

I have few PostgreSQL servers established with replication.
Now, is there any way to receive an e-mail in case of error during 
synchronization?
I mean, is there an script (cron?) I can run (maybe every 5 minutes) 
that will check if replication is stolen, and send an e-mail in case of 
failure?

Thanks,

Edson Richter




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Async replication: how to get an alert on failure
@ 2012-08-02 02:50  Toby Corkindale <toby.corkindale@strategicdata.com.au>
  parent: Edson Richter <edsonrichter@hotmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Toby Corkindale @ 2012-08-02 02:50 UTC (permalink / raw)
  To: pgsql-general

On 02/08/12 10:04, Edson Richter wrote:
> I have few PostgreSQL servers established with replication.
> Now, is there any way to receive an e-mail in case of error during
> synchronization?
> I mean, is there an script (cron?) I can run (maybe every 5 minutes)
> that will check if replication is stolen, and send an e-mail in case of
> failure?

I created a little Perl script that just connects to the master and 
queries the pg_stat_replication statistics.

It notes if (a) the client has disconnected entirely, or (b) if the 
client's replay position has still not reached the position that the 
master was in last time we checked. (So if you run the check every five 
minutes, you'll get a warning if the client is more than five minutes 
lagged behind the master)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Async replication: how to get an alert on failure
@ 2012-08-02 03:22  Karl Denninger <karl@denninger.net>
  parent: Edson Richter <richter@simkorp.com.br>
  1 sibling, 2 replies; 6+ messages in thread

From: Karl Denninger @ 2012-08-02 03:22 UTC (permalink / raw)
  To: richter@simkorp.com.br; +Cc: pgsql-general

On 8/1/2012 5:29 PM, Edson Richter wrote:
> I have few PostgreSQL servers established with replication.
> Now, is there any way to receive an e-mail in case of error during
> synchronization?
> I mean, is there an script I can run (maybe every 5 minutes) that will
> check if replication is stolen, and send an e-mail in case of failure?
>
> Thanks,
> -- 

I wrote a small program that goes to each of the servers in the
replication group and checks its status on the log, computes the
difference, and if off by more than "X" bytes prints a notification.

If this is run from the cron it will remain silent unless the offset is
breached at which point it will emit an email to the submitting owner of
the job.

-- 
-- Karl Denninger
/The Market Ticker ®/ <http://market-ticker.org;
Cuda Systems LLC

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Async replication: how to get an alert on failure
@ 2012-08-03 11:12  Edson Richter <edsonrichter@hotmail.com>
  parent: Karl Denninger <karl@denninger.net>
  1 sibling, 0 replies; 6+ messages in thread

From: Edson Richter @ 2012-08-03 11:12 UTC (permalink / raw)
  To: Karl Denninger <karl@denninger.net>; +Cc: pgsql-general

Em 02/08/2012 00:22, Karl Denninger escreveu:
> On 8/1/2012 5:29 PM, Edson Richter wrote:
>> I have few PostgreSQL servers established with replication.
>> Now, is there any way to receive an e-mail in case of error during 
>> synchronization?
>> I mean, is there an script I can run (maybe every 5 minutes) that 
>> will check if replication is stolen, and send an e-mail in case of 
>> failure?
>>
>> Thanks,
>> -- 
>
> I wrote a small program that goes to each of the servers in the 
> replication group and checks its status on the log, computes the 
> difference, and if off by more than "X" bytes prints a notification.
>
> If this is run from the cron it will remain silent unless the offset 
> is breached at which point it will emit an email to the submitting 
> owner of the job.
>
> -- 
> -- Karl Denninger
> /The Market Ticker ®/ <http://market-ticker.org;
> Cuda Systems LLC

Can you please share the query are you using so I can have a start point?

Thanks,

Edson

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Async replication: how to get an alert on failure
@ 2018-09-06 06:17  pavan95 <pavan.postgresdba@gmail.com>
  parent: Karl Denninger <karl@denninger.net>
  1 sibling, 0 replies; 6+ messages in thread

From: pavan95 @ 2018-09-06 06:17 UTC (permalink / raw)
  To: pgsql-general

Hi Karl,

Hope my mail finds you in good time. 


>I wrote a small program that goes to each of the servers in the replication
group and checks its status on the log, computes the difference, and if off
by more than "X" bytes prints a notification.

Did you configure ssh ??

>If this is run from the cron it will remain silent unless the offset is
breached at which point it will emit an email to the submitting owner of the
job. 

Could you please share your views on how to achieve it?  Thanks in Advance.


Regards,
Pavan



--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html




^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2018-09-06 06:17 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-08-01 22:29 Async replication: how to get an alert on failure Edson Richter <richter@simkorp.com.br>
2012-08-02 00:04 ` Edson Richter <edsonrichter@hotmail.com>
2012-08-02 02:50   ` Toby Corkindale <toby.corkindale@strategicdata.com.au>
2012-08-02 03:22 ` Karl Denninger <karl@denninger.net>
2012-08-03 11:12   ` Edson Richter <edsonrichter@hotmail.com>
2018-09-06 06:17   ` pavan95 <pavan.postgresdba@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox