监控Oracle数据库我们需要安装第三方提供的Zabbix插件,我们先测试比较有名的Orabbix,http://www.smartmarmot.com/product/orabbix/
从部署架构图上可以看出,orabbix是通过JDBC去连接被监控数据库的,其实不是必须在数据库主机上安装Agent,而运行orabbix的主机,可以是Zabbix Server,也可以是数据库主机和zabbix server之外的任意一台主机,为了测试方便,我们将orabbix安装在Zabbix Server上。
下载软件及安装服务Ø 下载 Orabbix ,上传到你的 Zabbix Server
Ø unzip 软件到这个目录: /opt/orabbix
Ø 安装服务:
Ø 复制启动脚本
#cp /opt/orabbix/init.d/orabbix /etc/init.d/orabbix
Ø 运行权限:
#chmod +x /etc/init.d/orabbix
#chmod +x /opt/orabbix/run.sh
Ø #chkconfig --add orabbix
建立监控用户及授权CREATE USER ZABBIX
IDENTIFIED BY welcome1
DEFAULT TABLESPACE SYSTEM
TEMPORARY TABLESPACE TEMP
PROFILE DEFAULT
ACCOUNT UNLOCK;
REM 2 Roles for ZABBIX
GRANT CONNECT TO ZABBIX;
GRANT RESOURCE TO ZABBIX;
ALTER USER ZABBIX DEFAULT ROLE ALL;
REM 5 System Privileges for ZABBIX
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;
修改orabbix配置文件#cd /opt/orabbix/conf
#cp config.props.sample config.props
根据实际的部署情况修改文件,比如:
#comma separed list of Zabbix servers
ZabbixServerList=ZabbixServer1
ZabbixServer1.Address=192.168.0.41 ##Zabbix服务器地址
ZabbixServer1.Port=10051 ##Zabbix服务器端口
#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=DB1,DB2,DB3 ##数据库列表,名称随便起
#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