Orabbix 是一個用來監控 Oracle 數據庫實例的 Zabbix 插件, Orabbix通過JDBC的方式將多個數據庫連接到一個Orabbix Server端Orabbix的角色類似Zabbix Agent,如果有100個Oracle數據庫需要監控,可以部署兩個Orabbix,每個Orabbix負責50個庫。
測試一下安裝過程,本次測試是將Orabbix安裝在Zabbix主機上面。
此機器必須安裝Zabbix客戶端,安裝方法同之前一樣。
1.下載Orabbix:
http://www.smartmarmot.com/product/orabbix/download/
2.在需要被監控的oracle客戶端建立zabbix用戶:
建立監控用戶及授權
CREATE USER ZABBIX
IDENTIFIED BY ZABBIX;
GRANT CONNECT TO ZABBIX;
GRANT RESOURCE TO ZABBIX;
ALTER USER ZABBIX DEFAULT ROLE ALL;
GRANT SELECT ANY TABLE TO ZABBIX;
GRANT CREATE SESSION TO ZABBIX;
GRANT SELECT ANY DICTIONARY TO ZABBIX;
GRANT UNLIMITED TABLESPACE TO ZABBIX;
GRANT SELECT ANY DICTIONARY TO ZABBIX;
如果是11g以上數據庫,執行下列語句:
exec dbms_network_acl_admin.create_acl(acl => 'resolve.xml',description => 'resolve acl', principal =>'ZABBIX', is_grant => true, privilege => 'resolve');
exec dbms_network_acl_admin.assign_acl(acl => 'resolve.xml', host =>'*');
commit;
3.通過yum安裝JAVA
[root@qht131 ~]# yum install java
4.將下載的文件傳到主機上面,解壓軟件包,創建Orabbix目錄,並賦予權限:
[root@qht131 ~]# mkdir /opt/orabbix
[root@qht131 ~]# mv /u01/orabbix-1.2.3.zip /opt/orabbix/
[root@qht131 ~]# cd /opt/orabbix/
[root@qht131 orabbix]# unzip orabbix-1.2.3.zip
[root@qht131 orabbix]# chmod -R a+x .
5.通過/opt/orabbix/conf/config.props.sample文件創建一個config.props文件:
[root@qht131 orabbix]# cp /opt/orabbix/conf/config.props.sample /opt/orabbix/conf/config.props
修改後的文件如下:
[root@qht131 orabbix]# cat /opt/orabbix/conf/config.props
#comma separed list of Zabbix servers
ZabbixServerList=ZabbixServer1
ZabbixServer1.Address=172.17.61.131
ZabbixServer1.Port=10051
#ZabbixServer2.Address=IP_ADDRESS_OF_ZABBIX_SERVER
#ZabbixServer2.Port=PORT_OF_ZABBIX_SERVER
#pidFile
OrabbixDaemon.PidFile=./logs/orabbix.pid
#frequency of item's refresh
OrabbixDaemon.Sleep=300
#MaxThreadNumber should be >= than the number of your databases
OrabbixDaemon.MaxThreadNumber=100
#put here your databases in a comma separated list
DatabaseList=DB115
#Configuration of Connection pool
#if not specified Orabbis is going to use default values (hardcoded)
#Maximum number of active connection inside pool
DatabaseList.MaxActive=10
#The maximum number of milliseconds that the pool will wait
#(when there are no available connections) for a connection to be returned
#before throwing an exception, or <= 0 to wait indefinitely.
DatabaseList.MaxWait=100
DatabaseList.MaxIdle=1
#define here your connection string for each database
DB115.Url=jdbc:oracle:thin:@172.17.61.115:1521:orcl
DB115.User=zabbix
DB115.Password=zabbix
#Those values are optionals if not specified Orabbix is going to use the general values
DB115.MaxActive=10
DB115.MaxWait=100
DB115.MaxIdle=1
DB115.QueryListFile=./conf/query.props
#DB2.Url=jdbc:oracle:thin:@server2.domain.example.com:<LISTENER_PORT>:DB2
#DB2.User=zabbix
#DB2.Password=zabbix_password
#DB2.QueryListFile=./conf/query.props
#DB3.Url=jdbc:oracle:thin:@server3.domain.example.com:<LISTENER_PORT>:DB3
#DB3.User=zabbix
#DB3.Password=zabbix_password
#DB3.QueryListFile=./conf/query.props
6.將修改好的配置文件複製到系統目錄中:
[root@qht131 orabbix]# cp /opt/orabbix/init.d/orabbix /etc/init.d/orabbix
7.啓動orabbix服務:
[root@qht131 orabbix]# /etc/init.d/orabbix start
Reloading systemd: [ OK ]
Starting orabbix (via systemctl): [ OK ]
[root@qht131 orabbix]# chkconfig --add orabbix
[root@qht131 orabbix]# chkconfig --level 345 orabbix on
8.導入orabbix模板,需要在本地操作,否則找不到模板文件
配置--》模板--》導入
導入文件選擇Orabbix_export_full.xml
導入模板成功!
9.添加需要監控的主機:
配置--》主機--》添加
主機名稱要與config.props配置的名稱一致