Oracle 插件: http://www.smartmarmot.com/product/orabbix/download/ 官网地址
Orabbix插件的安装与配置
确保安装jdk环境,java version查看,没有则通过yum来安装JAVA:yum install java
1.在/opt目录下新建一个orabbix目录:
[root@oracleorabbix]#midir -p /opt/orabbix
(建议在此目录下,如果放置其他目录稍后需要更改orabbix的启动文件orabbix,启动文件默认写在opt/orabbix目录下 )
2.解压安装文件
[root@oracleorabbix]#unzip orabbix-1.2.3.zip
3.赋予权限
[root@oracleorabbix]# chmod -R a+x orabbix/
4 通过/opt/orabbix/conf/config.props.sample文件创建一个config.props文件:
[root@oracleorabbix]#cp/opt/orabbix/conf/config.props.sample /opt/orabbix/conf/config.props
5. 编辑orabbix配置文件,具体如下
[root@oracleorabbix]#vi confi/config.props
#comma separed list of Zabbix servers
#ZabbixServerList=ZabbixServer1,ZabbixServer2
ZabbixServerList=ZabbixServer1
#(zabbixserver的名字,下行中address和port都引用到了这个名字,所以下面两行的前缀名字要与这里的名字保持一致)
#ZabbixServer1.Address=IP_ADDRESS_OF_ZABBIX_SERVER
ZabbixServer1.Address=192.168.3.163
#ZabbixServer1.Port=PORT_OF_ZABBIX_SERVER
ZabbixServer1.Port=10051
#ZabbixServer2.Address=IP_ADDRESS_OF_ZABBIX_SERVER
#ZabbixServer2.Port=PORT_OF_ZABBIX_SERVER
#pidFile
OrabbixDaemon.PidFile=./logs/orabbix.pid
#frequencyof item’s refresh
OrabbixDaemon.Sleep=300
#MaxThreadNumbershould be >= than the number of your databases
OrabbixDaemon.MaxThreadNumber=100
#put here your databases in a comma separatedlist
#DatabaseList=DB1,DB2,DB3
DatabaseList=DB_QM (DB名称,可随意定义,但要与下文保持一致,切记要与监控的主机名称保持一致,会在页面配置时用到)
#Configuration of Connection pool
#if notspecified Orabbis is going to use default values (hardcoded)
#Maximumnumber of active connection inside pool
DatabaseList.MaxActive=10
#The maximumnumber of milliseconds that the pool will wait
#(when thereare no available connections) for a connection to be returned
#beforethrowing an exception, or <= 0 to wait indefinitely.
DatabaseList.MaxWait=100
DatabaseList.MaxIdle=1
#define here your connection string for eachdatabase
#DB1.Url=jdbc:oracle:thin:@server.domain.example.com:<LISTENER_PORT>:DB1
DB_QM.Url=jdbc:oracle:thin:@192.168.3.250:1521:qmeas
#确保有jdk环境,因为这里是通过JDBC连接的
#DB1.User=zabbix
DB_QM.User=qm
#DB1.Password=zabbix_password
DB_QM.Password=qm
#DB的用户和密码,可创建zabbix用户,并赋予权限,如下文(这里直接用dba权限用户)
#Thosevalues are optionals if not specified Orabbix is going to use the generalvalues
DB_QM.MaxActive=10
DB_QM.MaxWait=100
DB_QM.MaxIdle=1
DB_QM.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
#注销未用到的DB连接
创建zabbix用户如下步骤:
CREATE USERZABBIX
IDENTIFIEDBY zabbix
DEFAULTTABLESPACE SYSTEM
TEMPORARYTABLESPACE TEMP
PROFILEDEFAULT
ACCOUNTUNLOCK;
GRANTCONNECT TO ZABBIX;
GRANTRESOURCE TO ZABBIX;
ALTER USERZABBIX DEFAULT ROLE ALL;
GRANT SELECTANY TABLE TO ZABBIX;
GRANT CREATESESSION TO ZABBIX;
GRANT SELECTANY DICTIONARY TO ZABBIX;
GRANTUNLIMITED TABLESPACE TO ZABBIX;
GRANT SELECTANY DICTIONARY TO ZABBIX;
Oracle11g添加如下命令
Execdbms_network_acl_admin.create_acl(acl => ‘resolve.xml’,description=>’resolve acl’, principal =>’ZABBIX’, is_grant => true, privilege=>’resolve’);
execdbms_network_acl_admin.assign_acl(acl=> ‘resolve.xml’, host =>’*’);
commit;
直接在sqlplus下执行
6. 创建执行文件(直接cp即可)
[root@oracleorabbix]# cp /opt/orabbix/init.d/orabbix/etc/init.d/orabbix
7.保存退出,启动orabbix服务(确保有执行权限)
/etc/init.d/orabbixstart
Orabbix服务加入随系统启动:
chkconfig–add orabbix
chkconfig–level 345 orabbix on
常见问题:
若config.props文件未配置,或是配置了错误,无法通过配置的信息正确连进Oracle数据库的,会出现以下错误信息
[root@zabbixorabbix]# /etc/init.d/orabbix start
StartingOrabbix service:
[root@zabbixorabbix]# 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)
用sqlplus 测试看看账号面膜能否成功登陆
可查看log信息判断解决
[root@oracleorabbix]# tail -f /opt/orabbix/logs/orabbix.log
到此,安装配置完成,则通过web页面访问直接导入模块即可
导入模板
在解压文件的templat目录下有xml的4个文件:直接使用full文件,可以直接导入。其中包括了Item,如何触发器,可自行修改;
在hosts配置页的右上角点import导入,注意勾选templates,注意看报错提示; 可以直接导入成功!
正常展示效果如下