]> git.openstreetmap.org Git - chef.git/blob - cookbooks/munin/files/default/plugins/postgres_replication
Fix tracking of postgres replication delay
[chef.git] / cookbooks / munin / files / default / plugins / postgres_replication
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Munin::Plugin::Pgsql;
7
8 my $pg = Munin::Plugin::Pgsql->new(
9     title     => 'PostgreSQL replication delay',
10     info      => 'Replication delay',
11     vlabel    => 'Seconds',
12     basequery => "SELECT (extract(epoch FROM now()) - extract(epoch FROM pg_last_xact_replay_timestamp()))::int AS delay",
13     pivotquery => 1,
14     configquery =>
15         "VALUES ('delay','Replication delay')"
16 );
17
18 $pg->Process();