Can't open lib '/usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1 when create “Database Monitor” item in zabbix

点点圈 提交于 2020-01-30 02:56:51

问题


Before that, unixODBC was installed

  1. unixODBC.x86_64 2.2.14-14.el6
  2. unixODBC-devel.x86_64 2.2.14-14.el6

And Oracle ODBC driver installed is:

  1. oracle-instantclient11.2-basic-11.2.0.1.0-1.x86_64
  2. oracle-instantclient11.2-odbc-11.2.0.1.0-1.x86_64
  3. oracle-instantclient11.2-devel-11.2.0.1.0-1.x86_64

And odbcinst.ini:

[Oracle-11g]
Description=ODBC for Oracle
Driver=/usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1
UsageCount=1
FileUsage=1
Driver Logging = 7

odbc.ini:

[test]
Driver      = Oracle-11g
DSN = Oracle-11g
ServerName =  gzdb
UserID = xxx
Password = xxx

And ODBC connection is working successfully

shell> isql -v test
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+

To enable ODBC support, I recompiled zabbix3.0 with flag: --with-unixodbc

./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc

and replace the old zabbix_sever with new binary compiled.

However, When I create "Database Monitor" item in zabbix,there is still an error: enter image description here

So I run su - zabbix -c "ldd /usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1" it appears ok

 su - zabbix -c "ldd /usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1"
    linux-vdso.so.1 =>  (0x00007fffe21ee000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f1ad095e000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f1ad06d9000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f1ad04bc000)
    libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f1ad02a3000)
    libclntsh.so.11.1 => /usr/lib/oracle/11.2/client64/lib/libclntsh.so.11.1 (0x00007f1acdd72000)
    libodbcinst.so.1 => /usr/lib64/libodbcinst.so.1 (0x00007f1acdb61000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f1acd7cd000)
    /lib64/ld-linux-x86-64.so.2 (0x000000373c600000)
    libnnz11.so => /usr/lib/oracle/11.2/client64/lib/libnnz11.so (0x00007f1acd404000)
    libaio.so.1 => /lib64/libaio.so.1 (0x00007f1acd203000)
    libltdl.so.7 => /usr/lib64/libltdl.so.7 (0x00007f1accffa000)

I really do not know what the error means


回答1:


That because your zabbix server doesn't know where to look for the Oracle lib. Try to export environment variable LD_LIBRARY_PATH to the zabbix server

Don't know what OS you are using, I'm on CentOS 7

create /etc/sysconfig/zabbix-server file, and edit with

LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/oracle/12.1/client64/lib"
export LD_LIBRARY_PATH

then restart zabbix-server




回答2:


I was getting a very similar error connecting between my office and Amazon's EC2 instances, turned out the error was very misleading. Specifically my error was:

Connection Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib '/usr/lib/oracle/12.1/client64/lib/libsqora.so.12.1' : file not found (0) (SQLDriverConnect)")

Our firewall was the culprit. a more permissive setting allowed success without further problems.




回答3:


because mysqld daemon run user with mysql(not root),you can use command [ps] check

ps aux | grep -i mysqld

mysql     3129  0.6  5.0 1862256 94272 ?       Ssl  17:52   0:00 /usr/sbin/mysqld

1.add Environmental variables $LD_LIBRARY_PATH into /usr/lib/systemd/system/mariadb.service

echo "Environment=\"LD_LIBRARY_PATH=$LD_LIBRARY_PATH\"" >> /usr/lib/systemd/system/mariadb.service 

2.restart mariadb.service

systemctl stop mariadb.service
systemctl daemon-reload
systemctl start mariadb.service

good luck!



来源:https://stackoverflow.com/questions/39198122/cant-open-lib-usr-lib-oracle-11-2-client64-lib-libsqora-so-11-1-when-create

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!