您的位置:首页 > 其它

Orabbix插件的安装与配置

2012-04-17 14:31 357 查看

1. Orabbix插件的安装与配置

1.1 Orabbix介绍

Orabbix 是一个用来监控 Oracle 数据库实例的 Zabbix 插件。

1.2 Orabbix插件的下载

http://www.smartmarmot.com/product/orabbix/download/

1.3 Orabbix插件的安装与配置

1) 先通过yum来安装JAVA:yum
install java;
2) 在/opt目录下新建一个orabbix目录:/opt/orabbix
3) 将下载好的Orabbix插件解压后上传至Zabbix
Server的/opt/orabbix目录:
4) 上传完成后,给orabbix目录中的所有文件设定权限:[root@zabbix
opt]# chmod -R a+x orabbix/
5) 通过/opt/orabbix/conf/config.props.sample文件创建一个config.props文件:
[root@zabbix opt]#cp/opt/orabbix/conf/config.props.sample /opt/orabbix/conf/config.props
6) 编辑刚刚生成的config.props文件:
ZabbixServerList=zabbix
ZabbixServer1.Address=192.168.1.50
ZabbixServer1.Port=10051
7) 将orabbix中的执行文件Copy到系统服务目录中:
[root@zabbix ~]#
cp /opt/orabbix/init.d/orabbix/etc/init.d/orabbix
8) 编辑orabbix配置文件,把不需要的行用“#”号来注释掉:
[root@zabbix conf]#vi config.props
#comma separed list of Zabbix servers
ZabbixServerList=ZabbixServer1
注:以上等号后的名字必须与下行中等号前名字保持一样。
ZabbixServer1.Address=192.168.1.50
ZabbixServer1.Port=10051
注:以上端口号为与Zabbix Server通讯的端口,我这里是将Orabbix与Zabbix装在同一台机器上的,如果不在同一台机器,那装Orabbix的机器需要先装Zabbix
Agent,否则数据将无法传送到Zabbix Server。
#ZabbixServer2.Address=IP_ADDRESS_OF_ZABBIX_SERVER
#ZabbixServer2.Port=PORT_OF_ZABBIX_SERVER
注:以上本来行首是没有#号的,但我们这里没有第二个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=ASM-ORCL
注:
1. 以上等号后的名字可以自己任意取名,但在Zabbix中添加Oracle
Host时,必须用你在此设定的名字,否则无法监测。
2. 以上等号后面的值修改后,在下面的数据库连接定义=处,也需要修改相应的名字;
3. 这里建议使用Server Name-DBSID的方式来命名。

#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
ASM-ORCL.Url=jdbc:oracle:thin:@192.168.153.123:1521:ORCL
注:
1. 以上行开始的那个值,需要与之前DatabaseList后面的值保持一样。
2. 192.168.153.123为Oracle服务器的地址,1521为TNS
Port,ORCL为DB SID。

ASM-ORCL.User=system
ASM-ORCL.Password=oracle
注:以上为访问数据库的用户名和密码,因为我这里是测试环境,所以为了图方便,使用了SYSTEM帐号,建议在生产环境中为orabbix新建一个帐号,可以参考官方的文档,地址如下:
http://www.smartmarmot.com/wiki/index.php/Orabbix
我这里跟据官网列出了我测试环境中添加的帐号,如下:
CREATE USER ZABBIX
IDENTIFIEDBY
zabbix <Password>
DEFAULTTABLESPACE SYSTEM
TEMPORARYTABLESPACE TEMP
PROFILEDEFAULT
ACCOUNTUNLOCK;
GRANT CONNECT TO ZABBIX;
GRANTRESOURCE TO ZABBIX;
ALTERUSER ZABBIX DEFAULT ROLE ALL;
GRANT SELECT ANY TABLE TO ZABBIX;
GRANT CREATE SESSION TO ZABBIX;
GRANTSELECT ANY DICTIONARY TO ZABBIX;
GRANTUNLIMITED TABLESPACE TO ZABBIX;
GRANTSELECT ANY DICTIONARY TO ZABBIX;。
因为我使用的是Oracle 11g,所以还需要添加以下命令:
execdbms_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;

#Those values are optionals if not specified Orabbix is going to use thegeneral values.
ASM-ORCL.MaxActive=10
ASM-ORCL.MaxWait=100
ASM-ORCL.MaxIdle=1
ASM-ORCL.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
9) 保存以上配置后,使用/etc/init.d/orabbix start来启动Orabbix服务
注意:如果以上的config.props文件没有配置,或是配置了,但无法通过配置的信息正确连进Oracle数据库的话,执行以上命令,可是run.sh会出现如下的错误提示:
[root@zabbix orabbix]# /etc/init.d/orabbix start
cat: /opt/orabbix/conf/config.props: No such file ordirectory
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)

[root@zabbix orabbix]# ./run.sh
[root@zabbix orabbix]# Stopping
java.lang.Exception: ERROR on main - Connections is empty
atcom.smartmarmot.orabbix.Orabbixmon.run(Orabbixmon.java:101)
at com.smartmarmot.orabbix.bootstrap.main(bootstrap.java:50)。
10) 将Orabbix服务加入随系统启动:
chkconfig --add orabbix
chkconfig --level 345orabbix on
11) OK,按以上的步骤,这样的话,Orabbix服务器端就配置完成啦~~现在去zabbix的WEB页面去导入ORACLE的监测模板吧,在orabbix目录的template内,只要在configurationàTemplatesàImport
Template,然后选中orabbix/template/Orabbix_export_full.xml就OK啦~~
12) 在configurationàTemplatesàHosts中添加Oracle主机吧!记得Name要等于你在config.props中设的名字哦,另外,要将此机器加入到Template
Oracle中,这样就OK啦~~如下图:



13) 接下来,去MonitoringàGraphs和Latest
data中去看你的Oracle监测数据吧~~

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: