Yes, it is possible since version 5.0 of Zabbix: https://www.zabbix.com/documentation/5.0/en/manual/introduction/whatsnew500#odbc-monitoring-without-dsn
An example of what a connection string would look like in the item key in Zabbix (always try to use user macros to configure values such as the database name, MySQL server address, username and password):
db.odbc.get[your_sql_query,,"Driver=/usr/local/lib/libmyodbc8w.so;Database={$MYSQL.DATABASE};Server={$MYSQL.SERVER};Port={$MYSQL.PORT}"]
It seems that the official Zabbix documentation doesn t provide a very clear example of how to do this, but if you search on this page for "db.odbc.get" you will find an example.
MySQL documentation on how to install the ODBC connector.
Below is an example of how the ODBC driver can be installed in the official zabbix-server Docker image (in this example, Zabbix was running on an Ubuntu 22.04 64-bit ARM architecture):
- Download the ODBC driver: https://dev.mysql.com/downloads/connector/odbc/
- Extract the archive:
tar zxvf mysql-connector-odbc-8.1.0-linux-glibc2.28-aarch64.tar.gz
- The extra directory contains two subdirectories, lib and bin. Copy their contents to the proper locations on your system:
cp bin/* /usr/local/bin
cp lib/* /usr/local/lib
- Register the driver:
myodbc-installer -a -d -n "MySQL ODBC 8.1 Unicode Driver" -t "Driver=/usr/local/lib/libmyodbc8w.so"
- Verify that the driver is installed and registered using the ODBC manager, or the myodbc-installer utility:
myodbc-installer -d -l
And of course, don t forget that when configuring your Zabbix Server (or Zabbix Proxy) you need to have at least 1 instance of the ODBC poller (StartODBCPollers parameter)