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配置的名称一致