libzbxpgsql icon indicating copy to clipboard operation
libzbxpgsql copied to clipboard

Monitor streaming replication

Open cavaliercoder opened this issue 9 years ago • 10 comments

Implement monitoring of streaming replication as per https://wiki.postgresql.org/wiki/Streaming_Replication

cavaliercoder avatar Mar 30 '16 07:03 cavaliercoder

Hello! Just interesting what is the status of this issue?

Sungurik avatar Jul 13 '16 13:07 Sungurik

Work hasn't started on this feature yet though I have done some research into how it should be measured. Scheduling is uncertain I'm afraid.

Code contributions are welcomed.

cavaliercoder avatar Jul 13 '16 13:07 cavaliercoder

Unfortunately I'm not a C programmer, but isn't it hard to add one key with one query "SELECT pg_is_in_recovery()"? Also useful to know replication time lag in seconds: SELECT extract(epoch from now() - pg_last_xact_replay_timestamp())

Sungurik avatar Jul 14 '16 06:07 Sungurik

That should be fairly simple, yes. If it would be valuable I can look to add it soon. Testing my memory, but I was looking at ways to query the transaction log position on all cluster members to determine their progress.

In the mean time, you can use the Query item keys to execute customer queries according to your needs.

cavaliercoder avatar Jul 14 '16 07:07 cavaliercoder

Thanks! Kindly in PostgreSQL I prefer to not use word "cluster" because it is just master-slave replication.

Sungurik avatar Jul 14 '16 08:07 Sungurik

I've heard it said before from other PostgreSQL users that clustering is not the right term. So I'll gladly reconsider. I grew up on Windows Failover Cluster Services which only supports active-passive but still counts itself as a cluster... I guess today it means something more impressive.

cavaliercoder avatar Jul 14 '16 08:07 cavaliercoder

I've implemented a decent method of monitoring streaming on 9.2+, but it requires the config file mods from libzbxpgsql 1.1.

I'll put together a sample in the next few days and share it here.

--Rob

robbrucks avatar Feb 23 '17 17:02 robbrucks

OK - I've put something in Github for you guys to try out. Let me know if it works for you. libzbxpgsql-streaming

robbrucks avatar Mar 04 '17 03:03 robbrucks

Any news on testing/implementing @robbrucks suggestion?

Marx1st avatar Aug 24 '17 14:08 Marx1st

It's a great suggestion and I'd love to implement it, but unfortunately my develop efforts are heavily steered by whatever projects I have going on at work. In the meantime, I'd gladly work with anyone on a pull request or recommend that you check out Rob's template: https://github.com/robbrucks/libzbxpgsql-streaming

cavaliercoder avatar Aug 25 '17 16:08 cavaliercoder