]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/munin/files/default/plugins/postgres_replication
Add warning thresholds for postgres replication delay
[chef.git] / cookbooks / munin / files / default / plugins / postgres_replication
index a41af7d3b8c829cc62a8fd10f6519e76abcca8e0..a0dd61d191d7ec89cbacad694efbadbf8207469b 100755 (executable)
@@ -9,15 +9,10 @@ my $pg = Munin::Plugin::Pgsql->new(
     title     => 'PostgreSQL replication delay',
     info      => 'Replication delay',
     vlabel    => 'Seconds',
     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,
     pivotquery => 1,
-    configquery =>
-        "VALUES ('delay','Replication delay')"
+    configquery => "VALUES ('delay','Replication delay')",
+    extraconfig => "delay.warning 60\ndelay.critical 300"
 );
 
 $pg->Process();
 );
 
 $pg->Process();