14 ODBC monitoring

    Overview

    ODBC is a C programming language middle-ware API for accessing database management systems (DBMS). The ODBC concept was developed by Microsoft and later ported to other platforms.

    Zabbix may query any database, which is supported by ODBC. To do that, Zabbix does not directly connect to the databases, but uses the ODBC interface and drivers set up in ODBC. This function allows for more efficient monitoring of different databases for multiple purposes - for example, checking specific database queues, usage statistics and so on. Zabbix supports unixODBC, which is one of the most commonly used open source ODBC API implementations.

    See also the for ODBC checks.

    Installing unixODBC

    The suggested way of installing unixODBC is to use the Linux operating system default package repositories. In the most popular Linux distributions unixODBC is included in the package repository by default. If it’s not available, it can be obtained at the unixODBC homepage: .

    Installing unixODBC on RedHat/Fedora based systems using the dnf package manager:

    Installing unixODBC on SUSE based systems using the zypper package manager:

    The unixODBC-devel package is needed to compile Zabbix with unixODBC support.

    Installing unixODBC drivers

      Installing MySQL database driver on SUSE based systems using the zypper package manager:

      Configuring unixODBC

      ODBC configuration is done by editing the odbcinst.ini and odbc.ini files. To verify the configuration file location, type:

      1. shell> odbcinst -j

      odbcinst.ini is used to list the installed ODBC database drivers:

      1. [mysql]
      2. Description = ODBC for MySQL
      3. Driver = /usr/lib/libmyodbc5.so

      Parameter details:

      odbc.ini is used to define data sources:

      Parameter details:

      To verify if ODBC connection is working successfully, a connection to database should be tested. That can be done with the isql utility (included in the unixODBC package):

      1. shell> isql test
      2. +---------------------------------------+
      3. | Connected! |
      4. | |
      5. | quit |
      6. | |
      7. +---------------------------------------+
      8. SQL>

      Compiling Zabbix with ODBC support

      1. --with-unixodbc[=ARG] use odbc driver against unixODBC package

      See more about Zabbix installation from the .

      Item configuration in Zabbix frontend

      Configure a database monitoring .

      All mandatory input fields are marked with a red asterisk.

      Specifically for database monitoring items you must enter:

      Important notes

      • Database monitoring items will become unsupported if no odbc poller processes are started in the server or proxy configuration. To activate ODBC pollers, set StartODBCPollers parameter in Zabbix configuration file or, for checks performed by proxy, in Zabbix proxy configuration file.
      • Zabbix does not limit the query execution time. It is up to the user to choose queries that can be executed in a reasonable amount of time.
      • The parameter value from Zabbix server is used as the ODBC login timeout (note that depending on ODBC drivers the login timeout setting might be ignored).
      • The SQL command must return a result set like any query with select .... The query syntax will depend on the RDBMS which will process them. The syntax of request to a storage procedure must be started with call keyword.

      Error messages

      ODBC error messages are structured into fields to provide detailed information. For example:

      Note that the error message length is limited to 2048 bytes, so the message can be truncated. If there is more than one ODBC diagnostic record Zabbix tries to concatenate them (separated with |) as far as the length limit allows.