1. 前提条件
l Zabbix 1.8 以上版本
l Jdk 1.6 以上版本
l Oracle 10g 以上版本
l Linux5 以上版本
2. 安装
l 安装jdk 1.6以上版本
yum install java |
l 创建orabbix目录
mkdir –p /opt/orabbix cd /opt/orabbix |
l 下载软件包
wget http://www.smartmarmot.com/downloads/orabbix-1.2.3.zip |
l 解压安装包
unzip orabbix-1.2.3.zip |
l 授予执行权限
chmod u+x run.sh |
3. 配置orazabbix
l 创建配置文件
cd conf cp config.props.sample config.props |
l 在需监控的数据库中创建用户
su – oracle sqlplus “/ as sysdba” create user zabbix identified by zabbix654321; grant connect,resource to zabbix; |
l 如何是11G版本还需以下操作
begin DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(acl => 'Resolve_Access.xml', description => 'Resolve Access', principal => 'ZABBIX', is_grant => true, privilege => 'connect'); end; / begin DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(acl => 'Resolve_Access.xml', principal => 'ZABBIX', is_grant => true, privilege => 'resolve'); end; / begin DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(acl => 'Resolve_Access.xml', host => '*'); end; / commit; |
l 修改配置vi config.props
#comma separed list of Zabbix servers
ZabbixServerList=ZabbixServer ZabbixServer.Address=192.168.1.143 ZabbixServer.Port=10051
#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=MCP #zabbix 里的主机名要和这个保持一致,否则无数据
#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 MCP.Url=jdbc:oracle:thin:@192.168.1.216:1522:MCP MCP.User=zabbix MCP.Password=zabbix654321 #Those values are optionals if not specified Orabbix is going to use the general values MCP.MaxActive=10 MCP.MaxWait=100 MCP.MaxIdle=1 MCP.QueryListFile=./conf/query.props |
l 启动
/opt/orabbix/run.sh |
4. 配置zabbix
l 导入模版
模版/opt/orabbix/template/Orabbix_export_full.xml拷贝本地导入
主机模版中应用导入的oracle模版
可以看到生成的图表就成功了
5. 定制
l 对于不同的数据库可以配置不同的查询文件
<DB_NAME>.ExtraQueryListFile ==./confQueryTest_2.props
l 可以在query.props中自定义指标
QueryList=queryName1,queryName2,queryName3
customQueryItemName.Query=yourQueryHere
customQueryItemName.NoDataFound=none
l 自定义指标的刷新间隔
customQueryItemName.Period=<Express a period inminute>