Reputation: 739
I install and configure Oracle instant client and unixODBC. When login with root
, can connect to db by sqlplus or isql.
root@zabbix:~# sqlplus ***/***@***
SQL*Plus: Release 12.1.0.2.0 Production on Tue Mar 7 13:56:42 2017
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Last Successful login time: Tue Mar 07 2017 13:19:45 +03:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>
root@zabbix:~# isql ***
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
But in Zabbix admin panel I got error Cannot connect to ODBC DSN:[SQL_ERROR]:[08004][12154][[unixODBC][Oracle][ODBC][Ora]ORA-12154: TNS:could not resolve the connect identifier specified]|
.
I think this is trouble with no exists env for zabbix user, because sudo -u zabbix env
output not contain ORACLE_HOME, TNS_ADMIN, NLS_LANG
etc.
Where I can set it or what a problem?
Upvotes: 0
Views: 3580
Reputation: 739
I solved my problem.
Create file /etc/default/zabbix-server
with necessary variables:
ORACLE_HOME=/usr/lib/oracle/12.1/client64
LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib
NLS_LANG=AMERICAN_CIS.CL8MSWIN1251
TNS_ADMIN=/usr/lib/oracle/12.1/client64/network/admin
Restart Zabbix server
Get main PID of Zabbix server process and check process env with strings -a /proc/18253/environ
(replace 18253 with your PID):
LANG=en_US.UTF-8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
CONFFILE=/etc/zabbix/zabbix_server.conf
ORACLE_HOME=/usr/lib/oracle/12.1/client64
LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib
NLS_LANG=AMERICAN_CIS.CL8MSWIN1251
TNS_ADMIN=/usr/lib/oracle/12.1/client64/network/admin
Upvotes: 1