十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
zabbix利用orabbix监控oracle
成都创新互联公司于2013年开始,先为襄城等服务建站,襄城等地企业,进行企业商务咨询服务。为襄城企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。
Orabbix 是一个用来监控 Oracle 数据库实例的 Zabbix 插件。下载地址:
http://www.smartmarmot.com/product/orabbix/download/
Orabbix插件的安装与配置
确保安装jdk环境,java version查看,没有则通过yum来安装JAVA:yum install java
1.在/opt目录下新建一个orabbix目录:
[root@oracle orabbix]#mkdir -p /opt/orabbix
(建议在此目录下,如果放置其他目录稍后需要更改orabbix的启动文件orabbix,启动文件默认写在opt/orabbix目录下 )
2. 解压安装文件
cd /opt/orabbix unzip orabbix-1.2.3.zip
3.赋予权限
chmod -R a+x /opt/orabbix/
4 通过/opt/orabbix/conf/config.props.sample文件创建一个config.props文件:
cp /opt/orabbix/conf/config.props.sample /opt/orabbix/conf/config.props
5. 编辑orabbix配置文件,具体如下
[root@oracle orabbix]#vi conf/config.props
ZabbixServerList=ZabbixServer1
ZabbixServer1.Address=10.0.0.10
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=rac1,rac2
#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
rac1.Url=jdbc:oracle:thin:@10.0.0.3:1521:racdb1
rac1.User=zabbix
rac1.Password=zabbix
#Those values are optionals if not specified Orabbix is going to use the general values
rac1.MaxActive=10
rac1.MaxWait=100
rac1.MaxIdle=1
rac1.QueryListFile=./conf/query.props
rac2.Url=jdbc:oracle:thin:@10.0.0.4:1521:racdb2
rac2.User=zabbix
rac2.Password=zabbix
#Those values are optionals if not specified Orabbix is going to use the general values
rac2.MaxActive=10
rac2.MaxWait=100
rac2.MaxIdle=1
rac2.QueryListFile=./conf/query.props
#rac2.Url=jdbc:oracle:thin:@server2.domain.example.com:
#rac2.User=zabbix
#rac2.Password=zabbix_password
#rac2.QueryListFile=./conf/query.props
#DB3.Url=jdbc:oracle:thin:@server3.domain.example.com:
#DB3.User=zabbix
#DB3.Password=zabbix_password
#DB3.QueryListFile=./conf/query.props
在数据库服务器上(注意,是数据库服务器)创建zabbix用户如下步骤:
CREATE USER zabbix IDENTIFIED BY zabbix DEFAULT TABLESPACE users TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK; 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;
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;
6. 创建执行文件(直接cp即可)
cp /opt/orabbix/init.d/orabbix /etc/init.d/orabbix
7.保存退出,启动orabbix服务(确保有执行权限)
/etc/init.d/orabbix start
Orabbix服务加入随系统启动:
chkconfig --add orabbix chkconfig --level 345 orabbix on
常见问题:
若config.props文件未配置,或是配置了错误,无法通过配置的信息正确连进Oracle数据库的,会出现以下错误信息
[root@zabbix orabbix]# /etc/init.d/orabbix start
Starting Orabbix service:
[root@zabbix orabbix]# Stopping
java.lang.Exception: ERROR on main - Connections is empty
atcom.smartmarmot.orabbix.Orabbixmon.run(Orabbixmon.java:101)
atcom.smartmarmot.orabbix.bootstrap.main(bootstrap.java:50)
可查看log信息判断解决
[root@oracle orabbix]# tail -f /opt/orabbix/logs/orabbix.log
到此,安装配置完成,则通过web页面访问直接导入模块即可,模板文件:
Orabbix_export_full.xml
导入后生成template模板名为:Template_Oracle
将oracle主机host与导入的模板Template_Oracle关联;
注意:zabbix页面中配置oracle主机host名称必须和上面DatabaseList=rac1,rac2中的rac1、rac2一致,并且大小写敏感!!!!