安装前的环境准备

1.     确保JRE环境,使用java命令可以识别

2.     修改zabbixserver和agent的host文件,但在Zabbix中添加Oracle Host时,必须用你在此设定的名字DatabaseList的名称必须一致

3.     run.sh脚本java要替换为绝对路径,如果zabbix不是安装在/opt/zabbix下,启动脚本也要修改路径

4.     创建日志文件路径  mkdir  -p  /opt/orabbix/log

     5  给orabbix目录下附权限chmod a+x /opt/orabbix –R

2.安装orabbix

orabbix官网:http://www.smartmarmot.com/wiki/index.php?title=Orabbix

下载地址:http://www.smartmarmot.com/product/orabbix/download/  最新版本orabbix-1.2.3.zip

下载后上传到Zabbix-server的/opt/orabbix/下(建议目录,否则会影响后续脚本执行)

#mkdir /opt/orabbix

#cd /opt/orabbit

#unzip orabbix-1.2.3.zip

3. 配置orabbix

创建orabbix配置文件编辑config.props

#cp /opt/orabbix/conf/config.props.sample /opt/orabbix/conf/config.props

vi /opt/orabbix/conf/config.props

ZabbixServerList=node3

ZabbixServer1.Address=192.168.41.35 -----zabbix server ip

ZabbixServer1.Port=10051 -----zabbix agent端口

----注:以上等号后的名字必须与下行中等号前名字保持一样。端口号为与Zabbix Server通讯的端口,我这里是将Orabbix与Zabbix装在同一台机器上的,如果不在同一台机器,那装Orabbix的机器需要先装Zabbix Agent,否则数据将无法传送到Zabbix Server。

#pidFile

OrabbixDaemon.PidFile=./logs/orabbix.pid

#frequency of item's refresh

OrabbixDaemon.Sleep=300

DatabaseList=DB1 (这里必须与Oracle Host中的一致,否则无法解析)

以上等号后的名字可以自己任意取名,但在Zabbix中添加Oracle Host时,必须用你在此设定的名字,否则无法监测。以上等号后面的值修改后,在下面的数据库连接定义=处,也需要修改相应的名字;

DatabaseList.MaxActive=10

DatabaseList.MaxWait=100

DatabaseList.MaxIdle=1

DB1.Url=jdbc:oracle:thin:@192.168.12.54:1521:racdb1

DB1.User=zabbix

DB1.Password=zabbix

配置orabbix的服务和进程

#cp -a /opt/orabbix/init.d/orabbix /etc/init.d/orabbix

#chmod 755 /etc/init.d/orabbix

#/etc/init.d/orabbix start

 

在Oracle端增加用户和权限

CREATE USER ZABBIX IDENTIFIED BY zabbix DEFAULT TABLESPACE SYSTEM TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK;

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;

 

 

GRANT ALTER SESSION TO zabbix;

GRANT CREATE SESSION TO zabbix;

GRANT CONNECT TO zabbix;

ALTER USER zabbix DEFAULT ROLE ALL;

GRANT SELECT ON V_$INSTANCE TO zabbix;

GRANT SELECT ON DBA_USERS TO zabbix;

GRANT SELECT ON V_$LOG_HISTORY TO zabbix;

 

GRANT SELECT ON V_$LOG TO zabbix;

GRANT SELECT ON V_$PARAMETER TO zabbix;

GRANT SELECT ON SYS.DBA_AUDIT_SESSION TO zabbix;

GRANT SELECT ON V_$LOCK TO zabbix;

GRANT SELECT ON DBA_REGISTRY TO zabbix;

GRANT SELECT ON V_$LIBRARYCACHE TO zabbix;

GRANT SELECT ON V_$SYSSTAT TO zabbix;

 

GRANT SELECT ON V_$PARAMETER TO zabbix;

GRANT SELECT ON V_$LATCH TO zabbix;

GRANT SELECT ON V_$PGASTAT TO zabbix;

GRANT SELECT ON V_$SGASTAT TO zabbix;

 

GRANT SELECT ON V_$LIBRARYCACHE TO zabbix;

GRANT SELECT ON V_$PROCESS TO zabbix;

GRANT SELECT ON DBA_DATA_FILES TO zabbix;

GRANT SELECT ON DBA_TEMP_FILES TO zabbix;

GRANT SELECT ON DBA_FREE_SPACE TO zabbix;

GRANT SELECT ON V_$SYSTEM_EVENT TO zabbix;

GRANT SELECT ON V_$locked_object TO zabbix;

GRANT SELECT ON dba_objects TO zabbix;

GRANT SELECT ON dba_tablespaces TO zabbix;

GRANT SELECT ON v_$session TO zabbix;

 

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;