[ZBX-23029] Problem with PostgreSQL by Zabbix agent 2 template items and discovery rules Created: 2023 Jun 26  Updated: 2023 Jun 27  Resolved: 2023 Jun 27

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G), Agent2 plugin (G), Templates (T)
Affects Version/s: 6.4.3
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: Ignacio Facundo Aguirre Assignee: Zabbix Support Team
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

GNU/Linux Debian 11
Zabbix server 6.4.3
Zabbix agent2 6.4.3
PostgreSQL 13


Issue Links:
Duplicate
duplicates ZBX-22868 zabbix-agent2 upgrade breaks postgres... Closed

 Description   

Steps to reproduce:

Result:

  • All Zabbix agent items and discovery rules are unsupported.
  • This errors appears in the Zabbix agent2 log:
zabbix_agent2[1397423]: [PostgreSQL] Connection failed: failed to connect to `host=/run/postgresql user=zabbix database=user=zbx_monitor`: server error (ERROR: no such database: user=zbx_monitor (SQLSTATE 08P01)).

Is trying to use the user as database name.

Expected:

Get info from database.

How to fix:

Define database name in Zabbix agent items and discovery rules key as the last parameter:

Zabbix agent items:

pgsql.archive["\{$PG.URI}","\{$PG.USER}","\{$PG.PASSWORD}","\{$PG.DATABASE}"]
pgsql.bgwriter["\{$PG.URI}","\{$PG.USER}","\{$PG.PASSWORD}","\{$PG.DATABASE}"]
pgsql.connections["\{$PG.URI}","\{$PG.USER}","\{$PG.PASSWORD}","\{$PG.DATABASE}"]
pgsql.dbstat.sum["\{$PG.URI}","\{$PG.USER}","\{$PG.PASSWORD}","\{$PG.DATABASE}"]
pgsql.dbstat["\{$PG.URI}","\{$PG.USER}","\{$PG.PASSWORD}","\{$PG.DATABASE}"]
{{pgsql.locks["\{$PG.URI}","\{$PG.USER}","\{$PG.PASSWORD}","\{$PG.DATABASE}"]
pgsql.oldest.xid["\{$PG.URI}","\{$PG.USER}","\{$PG.PASSWORD}","\{$PG.DATABASE}"]
pgsql.replication.process["\{$PG.URI}","\{$PG.USER}","\{$PG.PASSWORD}","\{$PG.DATABASE}"]
pgsql.uptime["\{$PG.URI}","\{$PG.USER}","\{$PG.PASSWORD}","\{$PG.DATABASE}"]
pgsql.wal.stat["\{$PG.URI}","\{$PG.USER}","\{$PG.PASSWORD}","\{$PG.DATABASE}"]
pgsql.ping["\{$PG.URI}","\{$PG.USER}","\{$PG.PASSWORD}","\{$PG.DATABASE}"]

Discovery rules:

pgsql.replication.process.discovery["\{$PG.URI}","\{$PG.USER}","\{$PG.PASSWORD}","\{$PG.DATABASE}"]
pgsql.db.discovery["\{$PG.URI}","\{$PG.USER}","\{$PG.PASSWORD}","\{$PG.DATABASE}"]


 Comments   
Comment by Elina Kuzyutkina (Inactive) [ 2023 Jun 27 ]

Hi,
Please share {$PG.DATABASE}, {$PG.USER} and {$PG.PASSWORD} you have configured and Zabbix agent configuration file (with all included) that is used to monitor target postgress DB

Regards, Elina

Generated at Tue Jun 17 08:15:11 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.