[ZBX-19672] PostgreSQL 13 - template zabbix abent 2. Created: 2021 Jul 12 Updated: 2021 Dec 21 Resolved: 2021 Dec 21 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Agent2 plugin (G), Templates (T) |
Affects Version/s: | 5.4.1, 5.4.2 |
Fix Version/s: | None |
Type: | Problem report | Priority: | Minor |
Reporter: | pavel | Assignee: | Vyacheslav Khaliev |
Resolution: | Fixed | Votes: | 2 |
Labels: | PostgreSQL, TimescaleDB | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Attachments: |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
||||||||
Issue Links: |
|
Description |
When using the template PostgreSQL by Zabbix agent 2. There is an error in the database(slave+master) log : ERROR: column "received_lsn" does not exist at character 36
|
Comments |
Comment by pavel [ 2021 Jul 12 ] |
I am use PostgreSQL 13 (open source) + timescaledb |
Comment by Aigars Kadikis [ 2021 Jul 13 ] |
Thank you for reaching out. I was not capable to find any error while using PostgreSQL 13.3 and TimescaleDB 2.3.1, Zabbix agent 2 and stock template which comes along with Zabbix 5.4. Would you mind reimport the most recent 5.4 template. The last modification has been made on 17 Jun 2021. If you still encounter an error, what is the item name having the error? Perhaps attaching a screenshot of the error message could help. |
Comment by pavel [ 2021 Jul 13 ] |
Comment by Aigars Kadikis [ 2021 Jul 13 ] |
Yeah, this is a cutting edge situation. Postgres 11 and 12 is having a column 'received_lsn': [root@c8 ~]# PGPORT=7412 psql psql (13.3, server 12.2) Type "help" for help. postgres=# \d pg_stat_wal_receiver View "pg_catalog.pg_stat_wal_receiver" Column | Type | Collation | Nullable | Default -----------------------+--------------------------+-----------+----------+--------- pid | integer | | | status | text | | | receive_start_lsn | pg_lsn | | | receive_start_tli | integer | | | received_lsn | pg_lsn | | | received_tli | integer | | | last_msg_send_time | timestamp with time zone | | | last_msg_receipt_time | timestamp with time zone | | | latest_end_lsn | pg_lsn | | | latest_end_time | timestamp with time zone | | | slot_name | text | | | sender_host | text | | | sender_port | integer | | | conninfo | text Postgres 13 is not having column 'received_lsn': [root@c8 ~]# PGPORT=7413 psql psql (13.3) Type "help" for help. postgres=# \d pg_stat_wal_receiver View "pg_catalog.pg_stat_wal_receiver" Column | Type | Collation | Nullable | Default -----------------------+--------------------------+-----------+----------+--------- pid | integer | | | status | text | | | receive_start_lsn | pg_lsn | | | receive_start_tli | integer | | | written_lsn | pg_lsn | | | flushed_lsn | pg_lsn | | | received_tli | integer | | | last_msg_send_time | timestamp with time zone | | | last_msg_receipt_time | timestamp with time zone | | | latest_end_lsn | pg_lsn | | | latest_end_time | timestamp with time zone | | | slot_name | text | | | sender_host | text | | | sender_port | integer | | | conninfo | text | | | |
Comment by Aigars Kadikis [ 2021 Jul 13 ] |
PostgreSQL 11 and 12 is having a column 'received_lsn' for the table 'pg_stat_wal_receiver', but on PostgreSQL 13 we do not have it. According to documentation the template was tested on PG 12. Need a fix for PG 13. |
Comment by Aleksey Volodin [ 2021 Jul 13 ] |
Also missing parameters in pgsql.cache.hit key: zabbix_agent2 -t pgsql.cache.hit["tcp://localhost:5432"] pgsql.cache.hit[tcp://localhost:5432] [m|ZBX_NOTSUPPORTED] [Connection failed: failed to connect to `host=localhost user=postgres database=postgres`: failed SASL auth (FATAL: password authentication failed for user "postgres" (SQLSTATE 28P01)).] Work fine if add username and password: zabbix_agent2 -t pgsql.cache.hit["tcp://localhost:5432","zbx_monitor","zabbix123"] pgsql.cache.hit[tcp://localhost:5432,zbx_monitor,zabbix123][s|99.540000] |
Comment by Pavel Kalian [ 2021 Sep 20 ] |
The problematic code is https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/src/go/plugins/postgres/handler_replication.go?at=refs%2Fheads%2Frelease%2F5.4#97-98 It seems to me the correct version of the query compatible with Postgres 10 and newer should probably be SELECT pg_catalog.pg_wal_lsn_diff (pg_last_wal_receive_lsn(), pg_last_wal_replay_lsn()); It maintains the same level of compatibility as the current implementation as the already used pg_last_wal_replay_lsn() function was also renamed in Postgres 10, but could be extended all the way to 9.0 by using pg_last_xlog_receive_location() / pg_last_xlog_replay_location() in the version of the query for 9.x References: |
Comment by pavel [ 2021 Oct 21 ] |
Maybe should use the view pg_stat_replication with pg_wal_lsn_diff scripts: SELECT https://pgpedia.info/p/pg_wal_lsn_diff.html |
Comment by Vyacheslav Khaliev [ 2021 Dec 02 ] |
Resolved in |