File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ class Xlog(Plugin):
1111 "(pg_catalog.pg_current_wal_lsn(), '0/00000000');"
1212 query_xlog_lsn_diff = "select pg_catalog.pg_xlog_location_diff " \
1313 "(pg_catalog.pg_current_xlog_location(), '0/00000000');"
14+ query_agent_replication_lag = "SELECT CASE WHEN extract(epoch from now()-pg_last_xact_replay_timestamp()) " \
15+ "IS NULL THEN 0 ELSE extract(epoch from now()-pg_last_xact_replay_timestamp()) END"
1416 key_wall = 'pgsql.wal.write{0}'
1517 key_count_wall = "pgsql.wal.count{0}"
1618 key_replication = "pgsql.replication_lag{0}"
@@ -97,7 +99,6 @@ def keys_and_queries(self, template_zabbix):
9799 result .append (
98100 '{0},$2 $1 -c "{1}"' .format (self .key_count_wall .format ('[*]' ), Pooler .SQL ['count_wal_files' ][0 ]))
99101 result .append ('{0},$2 $1 -c "{1}"' .format (self .key_wall .format ('[*]' ), self .query_wal_lsn_diff ))
100- # FIXME for lag
101102 result .append (
102- '{0},$2 $1 -c "{1}"' .format ("pgsql.replication_lag.sec[*]" , Pooler . SQL [ 'replication_lag_slave_query' ][ 0 ] ))
103+ '{0},$2 $1 -c "{1}"' .format ("pgsql.replication_lag.sec[*]" , self . query_agent_replication_lag ))
103104 return template_zabbix .key_and_query (result )
You can’t perform that action at this time.
0 commit comments