]> git.openstreetmap.org Git - chef.git/commitdiff
Fix tracking of postgres replication delay
authorTom Hughes <tom@compton.nu>
Tue, 13 Aug 2013 10:33:06 +0000 (11:33 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 13 Aug 2013 10:43:53 +0000 (11:43 +0100)
cookbooks/munin/files/default/plugins/postgres_replication

index a41af7d3b8c829cc62a8fd10f6519e76abcca8e0..4a04d0b0e9ecf2f4286e724e1f391b9acf2a471a 100755 (executable)
@@ -9,12 +9,7 @@ my $pg = Munin::Plugin::Pgsql->new(
     title     => 'PostgreSQL replication delay',
     info      => 'Replication delay',
     vlabel    => 'Seconds',
-    basequery =>
-        "SELECT
-           CASE
-             WHEN pg_last_xlog_receive_location() = pg_last_xlog_replay_location() THEN 0::int
-             ELSE (extract(epoch FROM now()) - extract(epoch FROM pg_last_xact_replay_timestamp()))::int
-           END AS delay",
+    basequery => "SELECT (extract(epoch FROM now()) - extract(epoch FROM pg_last_xact_replay_timestamp()))::int AS delay",
     pivotquery => 1,
     configquery =>
         "VALUES ('delay','Replication delay')"