Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions mamonsu/plugins/pgsql/driver/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Pool(object):
"""
SELECT application_name,
{0}
coalesce((pg_{1}_{2}_diff(pg_current_{1}_{2}(), replay_{2}))::int, 0) AS total_lag
coalesce((pg_{1}_{2}_diff(pg_current_{1}_{2}(), replay_{2}))::bigint, 0) AS total_lag
FROM pg_stat_replication;
""",
"""
Expand All @@ -99,7 +99,7 @@ class Pool(object):
"wal_held_bytes_master": (
"""
SELECT slot_name,
coalesce((pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn))::int, 0) AS wal_held_bytes
coalesce((pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn))::bigint, 0) AS wal_held_bytes
FROM pg_replication_slots;
""",
"""
Expand All @@ -111,7 +111,7 @@ class Pool(object):
"wal_held_bytes_replica": (
"""
SELECT slot_name,
coalesce((pg_wal_lsn_diff(pg_last_wal_replay_lsn(), restart_lsn))::int, 0) AS wal_held_bytes
coalesce((pg_wal_lsn_diff(pg_last_wal_replay_lsn(), restart_lsn))::bigint, 0) AS wal_held_bytes
FROM pg_replication_slots;
""",
"""
Expand Down
10 changes: 5 additions & 5 deletions mamonsu/plugins/pgsql/replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ def run(self, zbx):
if Pooler.server_version_greater("10.0") and (Pooler.is_superuser() or Pooler.is_bootstraped()):
result_lags = Pooler.run_sql_type("wal_lag_lsn",
args=[
" coalesce((pg_wal_lsn_diff(pg_current_wal_lsn(), sent_lsn))::int, 0) AS send_lag, "
"coalesce((pg_wal_lsn_diff(sent_lsn, flush_lsn))::int, 0) AS receive_lag, "
"coalesce((pg_wal_lsn_diff(sent_lsn, write_lsn))::int, 0) AS write_lag, "
"coalesce((pg_wal_lsn_diff(write_lsn, flush_lsn))::int, 0) AS flush_lag, "
"coalesce((pg_wal_lsn_diff(flush_lsn, replay_lsn))::int, 0) AS replay_lag, " if not Pooler.is_bootstraped() else
" coalesce((pg_wal_lsn_diff(pg_current_wal_lsn(), sent_lsn))::bigint, 0) AS send_lag, "
"coalesce((pg_wal_lsn_diff(sent_lsn, flush_lsn))::bigint, 0) AS receive_lag, "
"coalesce((pg_wal_lsn_diff(sent_lsn, write_lsn))::bigint, 0) AS write_lag, "
"coalesce((pg_wal_lsn_diff(write_lsn, flush_lsn))::bigint, 0) AS flush_lag, "
"coalesce((pg_wal_lsn_diff(flush_lsn, replay_lsn))::bigint, 0) AS replay_lag, " if not Pooler.is_bootstraped() else
" send_lag, receive_lag, write_lag, flush_lag, replay_lag, ",
"wal", "lsn"])
if result_lags:
Expand Down