Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-9960

ODBC error: file not found

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 2.4.6
    • Server (S)
    • None

      I've setup a database monitor item to make a simple query in a MySQL database through ODBC. This is my Item configuration. I'll show only the parameters that I have changed:

      Name: Ticket count
      Type: Database monitor
      Key: db.odbc.select[otrs.count.ticket,mysql56_otrs]
      SQL query: select count(id) as total from ticket
      Type of information: Numeric
      Data type Decimal
      History Storage Period: 7
      Applications: OTRS

      The above item was created in a template called "Template OTRS Stats" and it was associated to the mysql host.

      My Zabbix server is compiled with ODBC support as showed in "Environment" section. The latest mysql odbc driver (mysql-connector-odbc-5.2.7-linux-glibc2.5-x86-64bit) downloaded from https://dev.mysql.com/downloads/connector/odbc/5.1.html was installed under /etc/zabbix/ and the owner of the files is the zabbix user:

      root@zabbix:~# ls -lh /etc/zabbix/libmyodbc5*
      -rwxr-xr-x 1 zabbix zabbix 8,9M Out 15 12:45 /etc/zabbix/libmyodbc5a.so
      -rwxr-xr-x 1 zabbix zabbix 8,9M Out 15 12:45 /etc/zabbix/libmyodbc5w.so
      

      There's no immutable flag set on those libraries:

      root@zabbix:~# lsattr /etc/zabbix/libmyodbc5*
      -------------e-- /etc/zabbix/libmyodbc5a.so
      -------------e-- /etc/zabbix/libmyodbc5w.so
      

      The unixODBC package is installed as showed in "Environment" section too. Here are the config files:

      root@zabbix:~# cat /etc/odbcinst.ini 
      [mysql_unicode]
      Driver=/etc/zabbix/libmyodbc5w.so
      
      [mysql_ansi]
      Driver=/etc/zabbix/libmyodbc5a.so
      
      root@zabbix:~# cat /etc/odbc.ini 
      [mysql56_otrs]
      Driver=mysql_unicode
      Server=mysqlserver.domain
      Database=otrs
      Port=3306
      Option=3
      User=*****
      Password=******
      

      I can connect to mysql server from zabbix server using isql:

      root@zabbix:~# isql mysql56_otrs
      +---------------------------------------+
      | Connected!                            |
      |                                       |
      | sql-statement                         |
      | help [tablename]                      |
      | quit                                  |
      |                                       |
      +---------------------------------------+
      SQL> select count(id) as total from ticket
      +---------------------+
      | total               |
      +---------------------+
      | 70465               |
      +---------------------+
      SQLRowCount returns 1
      1 rows fetched
      SQL> quit
      

      The item was not in unsupported state. But no data is registered under last data. So, I've turned zabbix into debug mode (debuglevel=4) and finally I've see an error message:

       13849:20151015:122800.165 In substitute_key_macros() data:'db.odbc.select[otrs.count.ticket,mysql56_otrs]'
       13849:20151015:122800.167 End of substitute_key_macros():SUCCEED data:'db.odbc.select[otrs.count.ticket,mysql56_otrs]'
       13849:20151015:122800.173 In get_value() key:'db.odbc.select[otrs.count.ticket,mysql56_otrs]'
       13849:20151015:122800.175 In get_value_db() key_orig:'db.odbc.select[otrs.count.ticket,mysql56_otrs]'
       13849:20151015:122800.177 In odbc_DBconnect() db_dsn:'mysql56_otrs' user:''
       13849:20151015:122800.182 odbc_Diag(): rc_msg:'SQL_ERROR' rec_nr:1 sql_state:'01000' native_err_code:0 err_msg:'[unixODBC][Driver Manager]Can't open lib '/etc/zabbix/libmyodbc5w.so' : file not found'
       13849:20151015:122800.184 End of odbc_DBconnect():FAIL
      

      Why zabbix can't open lib '/etc/zabbix/libmyodbc5w.so' ???
      Why zabbix doesn't put item into Unsupported state?

            Unassigned Unassigned
            bruno.galindro Bruno Galindro da Costa
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: