Use ODBC to monitor Oracle Database (11.2.0.3) and MySQL database under Zabbix
1. Monitor MySQL Database
1) Installing ODBC
Yum-y Install UnixODBC Unixodbc-devel
Yum Install Mysql-connector-odbc
2) odbcinst-j View configuration file
UnixODBC 2.2.14
DRIVERS ...:/etc/odbcinst.ini...
SYSTEM DATA SOURCES:/etc/odbc.ini
FILE DATA SOURCES:/etc/odbcdatasources
USER DATA SOURCES:/root/.odbc.ini
Sqlulen Size ...: 8
Sqllen Size ...: 8
Sqlsetposirow Size.: 8
3) Edit/etc/odbcinst.ini
[MySQL]
Description = ODBC for MySQL
Driver =/usr/lib/libmyodbc5.so
Setup =/usr/lib/libodbcmys.so
Driver64 =/usr/lib64/libmyodbc5.so
SETUP64 =/usr/lib64/libodbcmys.so
FileUsage = 1
4) Edit
Vi/etc/odbc.ini
[Test]
Description = MySQL Test Database
Driver = MySQL
Server = 127.0.0.1
User = root
Password = 123456
Port = 3306
Database = Zabbix
5) Testing
Shell> ISQL Test
+---------------------------------------+
| connected! |
| |
| sql-statement |
| Help [TableName] |
| Quit |
| |
+---------------------------------------+
Sql>
can be monitored normally
2, using ODBC to monitor Oracle database
1) Download Oracle Client
Http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm
oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm
oracle-instantclient11.2-odbc-11.2.0.3.0-1.x86_64.rpm
oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm
2) Installation
RPM-IVH oracle-instantclient11.2-*
3) Create local monitoring
The default locations for installation are in/usr/share/oracle/11.2/client64
/usr/include/oracle/11.2/client64
/usr/lib/oracle/11.2/client64
Before setting the environment variable, create the Network/admin folder under/usr/lib/oracle/11.2/client64.
Mkdir-p/usr/lib/oracle/11.2/client64/network/admin
Under this folder, create the Tnsnames.ora and its contents into the following:
571wb=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 10.23.153.9) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = SSS)
)
)
571ww=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 10.23.163.10) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = SSS)
)
)
Under/usr/lib/oracle/11.2/client64/network/admin file Create Sqlnet.ora, enter:
VI Sqlnet.ora
Name_directory_path= (Tnsnames,ezconnect)
4)
Export Oracle_home=/usr/lib/oracle/11.2/client64
Export ld_library_path= $ORACLE _home/lib:/usr/lib64: $LD _library_path
Export tns_admin= $ORACLE _home/network/admin
Export path= $PATH: $ORACLE _home/bin: $HOME/bin
5)And at once we do such check:
# ldd/usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1
With the big share probability, you receive libodbcinst.so.1 = not found, therefore it's necessary to make This-link:
# Ls-lah/lib64 | grep ODBC
cd/usr/lib64/
Ln-s libodbcinst.so.2.0.0 libodbcinst.so.1
Vi/etc/odbcinst.ini Creating drivers
[Oracle]
Description = Oracle ODBC driver for Oracle 11g
Driver =/usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1
Vi/etc/odbc.ini Creating a data source
[571WB]
Driver= Oracle
dsn= 571WB
Servername= 571WB
Userid= SSS
password= HANGZHOU571WB
Use ODBC to monitor Oracle Database (11.2.0.3) and MySQL database under Zabbix