Press "Enter" to skip to content

利用Orabbix监控Oracle数据库

安装环境:Redhat 6,Zabbix 3.2.1(LNMP环境)
前提条件:安装orabbix主机已安装java/zabbix agent.orabbix不一定要装在oracle数据库主机上面,但是oracle主机要装zabbix agent而且和zabbix server互通.

安装步骤:
cd /home/app
wget --no-check-certificate https://nchc.dl.sourceforge.net/project/orabbix/orabbix-1.2.3.zip
unzip Orabbix-1.2.3.zip
mv orabbix-1.2.3 /opt/orabbix
目录结构如下:
调整配置文件:
cd /opt/orabbix
cp init.d/orabbix /etc/init.d/
chmod 755 /etc/init.d/orabbix
chmod 755 /opt/orabbix/run.sh
数据库新建zabbix用户:
CREATE USER ZABBIX IDENTIFIED BY 123456 DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP;
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;
Oracle 11需要执行以下语句:
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;
配置config.props:
cd /opt/orabbix/conf
cp config.props.sample config.props
[root@test conf]# more config.props|grep -v '#'|grep -v '^$'
ZabbixServerList=ZabbixServer  //zabbix_server主机名
ZabbixServer.Address=1.2.3.4 //zabbix_server地址
ZabbixServer.Port=10051 //zabbix_agent端口
OrabbixDaemon.PidFile=./logs/orabbix.pid
OrabbixDaemon.Sleep=300 //每隔多长时间刷新item,单位秒
OrabbixDaemon.MaxThreadNumber=100 //MaxThreadNumber should be >= than the number of your databases
DatabaseList=test01,test02 //数据库主机名称,多个数据库用逗号分隔,名称与该主机在zabbix中监控的主机名称保持一致
DatabaseList.MaxActive=10 //Maximum number of active connection inside pool
DatabaseList.MaxWait=100 //The maximum number of milliseconds that the pool will wait(when there are no available connections) for a connection to be returned
DatabaseList.MaxIdle=1
test01.Url=jdbc:oracle:thin:@1.2.3.5:1521:racdb1 //test01与上面的DatabaseList名字一致,test01和test02为rac
test01.User=zabbix
test01.Password=123456
test01.MaxActive=10
test01.MaxWait=100
test01.MaxIdle=1
test01.QueryListFile=./conf/query.props
test02.Url=jdbc:oracle:thin:@1.2.3.5:1521:racdb2 //test02与上面的DatabaseList名字一致
test02.User=zabbix
test02.Password=123456
test02.MaxActive=10
test02.MaxWait=100
test02.MaxIdle=1
test02.QueryListFile=./conf/query.props
启动Orabbix服务:
service orabbix start或者sh /opt/orabbix/run.sh
导入模板:
Configuration-->Templates-->Import,选择Orabbix_export_full.xml(路径:/opt/orabbix/template/rabbix_export_full.xml)
最后关联相关主机,验证有无数据即可.
部分效果图如下:

Be First to Comment

发表评论

电子邮件地址不会被公开。 必填项已用*标注