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):
11
11
"(pg_catalog.pg_current_wal_lsn(), '0/00000000');"
12
12
query_xlog_lsn_diff = "select pg_catalog.pg_xlog_location_diff " \
13
13
"(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"
14
16
key_wall = 'pgsql.wal.write{0}'
15
17
key_count_wall = "pgsql.wal.count{0}"
16
18
key_replication = "pgsql.replication_lag{0}"
@@ -97,7 +99,6 @@ def keys_and_queries(self, template_zabbix):
97
99
result .append (
98
100
'{0},$2 $1 -c "{1}"' .format (self .key_count_wall .format ('[*]' ), Pooler .SQL ['count_wal_files' ][0 ]))
99
101
result .append ('{0},$2 $1 -c "{1}"' .format (self .key_wall .format ('[*]' ), self .query_wal_lsn_diff ))
100
- # FIXME for lag
101
102
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 ))
103
104
return template_zabbix .key_and_query (result )
You can’t perform that action at this time.
0 commit comments