[ZBX-24257] db.odbc - Access denied for user when using Macros Created: 2024 Mar 22  Updated: 2025 Apr 25

Status: Open
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F), Proxy (P), Server (S)
Affects Version/s: 6.4.11
Fix Version/s: None

Type: Incident report Priority: Trivial
Reporter: Matheus Nunes Assignee: Zabbix Support Team
Resolution: Unresolved Votes: 0
Labels: macros, mysql, odbc
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

RHEL 8


Attachments: PNG File image-2024-03-22-11-39-59-683.png     PNG File image-2024-03-22-11-41-24-583.png     PNG File image-2024-03-22-11-44-53-888.png     PNG File image-2024-03-22-11-48-03-113.png     PNG File image-2024-03-22-11-53-06-369.png     PNG File image-2024-03-22-11-54-03-440.png     PNG File image-2024-03-22-11-54-57-781.png     PNG File image-2024-03-22-11-55-05-824.png     PNG File image-2024-03-22-11-55-12-683.png     PNG File image-2025-04-25-10-58-25-939.png     PNG File image-2025-04-25-10-59-06-031.png     PNG File image-2025-04-25-11-02-21-542.png    

 Description   

Steps to reproduce:

  1. Create an item with this a macro in Key, like this:
db.odbc.select[get_status_variables2,,"Driver=MySQL;Database=zabbix;Server=teste.local;UID=svc_zabbix;PWD=\{$MYSQL.PASSWORD}"]

Error:
Cannot connect to ODBC DSN: [SQL_ERROR]:[HY000][1045][[MySQL][ODBC 8.0(w) Driver]Access denied for user 'svc_zabbix'@'teste.local' (using password: YES)]

  1. I tried to use 'User name' and 'Password', but happened other error
    db.odbc.select[get_status_variables2,,"Driver=MySQL;Database=zabbix;Server=teste.local;"]

          **          Error:

          Cannot connect to ODBC DSN: [SQL_ERROR]:[HY000][1045][[MySQL][ODBC 8.0(w) Driver]Access denied for user 'svc_zabbix'@'teste.local' (using password: NO)]

Expected:
db.odbc.select[get_status_variables2,,"Driver=MySQL;Database=zabbix;Server=test.local;UID=svc_zabbix;PWD=password"]

With Oracle I didn't have this problem and I use the same user and password

db.odbc.select[ora_ses_act,,"Driver=Oracle;DBQ=//\{HOST.CONN}:1521/\{$ORACLE_ODBC_DSN};"]



 Comments   
Comment by Matheus Nunes [ 2024 Mar 22 ]

In time, when I use TEST works in all situations:
db.odbc.select[get_status_variables2,,"Driver=MySQL;Database=zabbix;Server=teste.local;"]

db.odbc.select[get_status_variables2,,"Driver=MySQL;Database=zabbix;Server=teste.local;UID=svc_zabbix;PWD=\{$MYSQL.PASSWORD}"]

db.odbc.select[get_status_variables2,,"Driver=MySQL;Database=zabbix;Server=teste.local;"]

Comment by Jan Prusinowski [ 2025 Apr 25 ]

Hello Matheus,

 

Have you tried:

db.odbc.select[get_status_variables2,,"Driver=MySQL;Database=zabbix;Server=teste.local;UID=svc_zabbix;PWD={$MYSQL.PASSWORD}"]

I believe the extra '/' before your macro is causing your issues.

Let me know if it has fixed your issue.

 

Regards,

Jan

Comment by Matheus Nunes [ 2025 Apr 25 ]

Hello Jan,

Same error.

But when I use "Test", it works.

Generated at Wed Apr 30 06:56:16 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.