[ZBX-22973] Agent2 PostgreSQL plugin fails to authenticate on DB since 6.4 Created: 2023 Jun 15 Updated: 2023 Jun 19 Resolved: 2023 Jun 19 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Agent2 plugin (G) |
Affects Version/s: | 6.4.3 |
Fix Version/s: | None |
Type: | Incident report | Priority: | Trivial |
Reporter: | Robin Roevens | Assignee: | Zabbix Support Team |
Resolution: | Duplicate | Votes: | 0 |
Labels: | Agent2, PostgreSQL, error, item, key, plugin | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
SUSE Linux Enterprise Server 15 SP4 - kernel 5.14.21-150400.24.63-default |
Issue Links: |
|
Description |
I'm monitoring a few PostgreSQL servers user Agent2 plugin and Zabbix official template for it. This worked correctly in Zabbix 6.2. Steps to reproduce:
Result:
[PostgreSQL] Connection failed: failed to connect to `host=localhost user=zabbix database=user=zbx_monitor`: server error (FATAL: password authentication failed for user "zabbix" (SQLSTATE 28P01)). Documentation states that except for the URI, all other parameters are optional, but leaving the database out as currently the case in the official template, and not providing a Default database in the agent2 plugin config seems to confuse Agent2 6.4.3. In the error message, I see the parameter "user=" twice, once with "zabbix" as value. I have no idea where this comes from, as the PG.USER passed to the key is "zbx_monitor". Also the "database=" parameter is set but empty. Expected: Successful connection to database postgres (as that is the default and inherited template macro value for $PG.DATABASE and there is no notice in the documentation that it is mandatory to be defined elsewhere) and have a correct item value returned by Agent2.
Workaround: Set in Agent2 plugin config postgresql.conf: Plugins.PostgreSQL.Default.Database=postgres This "Default" config item is new in agent2 6.4 plugin. or change the above mentioned item's into:
as currently the database is not provided to the agent except for custom queries item and items created by database discovery LLD rule. |
Comments |
Comment by Robin Roevens [ 2023 Jun 15 ] |
This may be a duplicate of: |
Comment by Robin Roevens [ 2023 Jun 15 ] |
I found out that even when setting Plugins.PostgreSQL.Default.User, this default is never applied when the item key does not contain a username:
pgsql.archive["tcp://localhost:5432"]
with Plugins.PostgreSQL.Default.Database, Plugins.PostgreSQL.Default.User and Plugins.PostgreSQL.Default.Password set in the Agent2 plugin config, this fails with: [PostgreSQL] Connection failed: failed to connect to `host=localhost user= database=postgres`: server error (FATAL: no PostgreSQL user name specified in startup packet (SQLSTATE 28000)) So, the set Default.User is not applied in the connection parameters Agent2 uses. Not sure if this is related, and if this is fixed with the fix for
The agent returns: ZBX_NOTSUPPORTED: host is required for pgsql.archive[] or pgsql.archive. |