-
Incident report
-
Resolution: Cannot Reproduce
-
Trivial
-
None
-
6.2.7
-
None
Problems with zabbix-agent2 and postgresql monitoring. Several checks are not working.
Host is configured in zabbix server, "Template DB PostgreSQL Agent 2" is added to host and essential macros are configured like this:
{$PG.PASSWORD} ... {$PG.URI} tcp://localhost:5432 {$PG.USER} zabbixagent
Now zabbix-agent2 (6.2) is installed to monitored server.
Postgresql user "zabbixagent" is also configured with password. Also required grants are added to this user.
So this works:
PostgreSQL: Uptime 36s 8M 28d 20h +59s 409.55ms App: PostgreSQL
This does not work and error message is displayed:
PostgreSQL: Get WAL App: Zabbix raw items "Cannot fetch data: ERROR: permission denied for function pg_ls_waldir (SQLSTATE 42501)."
This is verified: pg "zabbixagent" user CAN execute "pg_ls_waldir".
What we found is that this check "Get WAL" tries to connect over socket instead of tcp network (tcp://localhost:5432)
Our pg_hba.conf is configured as:
# TYPE DATABASE USER ADDRESS METHOD host all zabbixagent 127.0.0.1/32 md5 host all zabbixagent ::1/128 md5 # "local" is for Unix domain socket connections only local all all peer # IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5
[2023-02-27 09:33:29.776 EET]:[local]:[unknown]:[unknown]: LOG: connection received: host=[local] [2023-02-27 09:33:29.777 EET]:[local]:zabbixagent:zabbixagent: LOG: connection authenticated: identity="zabbix" method=peer (/pgdata/pgdata/pg_hba.conf:94) [2023-02-27 09:33:29.777 EET]:[local]:zabbixagent:zabbixagent: LOG: provided user name (zabbixagent) and authenticated user name (zabbix) do not match [2023-02-27 09:33:29.777 EET]:[local]:zabbixagent:zabbixagent: FATAL: Peer authentication failed for user "zabbixagent" [2023-02-27 09:33:29.777 EET]:[local]:zabbixagent:zabbixagent: DETAIL: Connection matched pg_hba.conf line 94: "local all all peer"