orabbix 监控oracle

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了orabbix 监控oracle相关的知识,希望对你有一定的参考价值。

一 、Orabbix 介绍

orabbix是一个用来监控oracle数据库性能的zabbix插件工具,通过安装在被监控服务器上客户端上收集数据并传给zabbix服务器端,然后通过调用图形显示。具有以下功能:

1. 数据库版本

2. 归档文件

3. 等待的事件(如文件的I/O,单块的读,多块的读,直接读,SQLNet消息,控制文件I/O,日志写等)

4. HitRatio(监控Hit Ratio的触发,表/存储过程,SQLArea,Body)

5. 逻辑I/O(当前读操作,持续的读操作,块的更改)

6. PGA

7. SGA(固定的缓冲,JAVApool,Large Pool,Log Buffer,Shared Pool,Buffer Cache)

8. 物理I/O(重写操作,数据文件写操作,数据文件读操作)

9. SharePool(PoolDictionary Cache, Pool Free Memory, Library Cache,Sql Area ,Misc.)

10. Pin Hit Ratio(monitor Hit Ratio on Trigger, Tables/Procedures, SQLArea,Body)

11. Session/Processes(monitor Sessions and processes)

12. Session (ActiveSession, Inactive Sessions, System Session)


二、创建Oracle监控账号并赋权

CREATE  USER zabbix IDENTIFIED BY ys_zb_0418 DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK;
 
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;

注意: 如果是oracle11g的数据库版本,还需要执行下面的语句开放ACL的访问控制,否则在监控的过程中有部份内容无法正常显示(例于数据库版本,数据库文件大小等),而且orabbix的日志显示中也会有错误提示

    exec dbms_network_acl_admin.create_acl(acl => 'resolve.xml',description=> 'resolve acl', principal =>'ZABBIX', is_grant => trueprivilege => 'resolve');

    exec dbms_network_acl_admin.assign_acl(acl => 'resolve.xml', host =>'*');

    commit;

 

    # --执行过程

    SQLexec dbms_network_acl_admin.create_acl(acl => 'resolve.xml',description=> 'resolve acl', principal =>'ZABBIX', is_grant => trueprivilege => 'resolve');

 

    PL/SQLprocedure successfully completed.

 

    SQLexec dbms_network_acl_admin.assign_acl(acl => 'resolve.xml', host =>'*');

 

    PL/SQLprocedure successfully completed.

 

    SQLcommit;

 

    Commit complete.

 

    SQL>



三、安装配置orabbix

  1. 安装JDK

    tar -xf jdk-7u79-linux-x64.tar.gz -C /usr/local/

  2. 安装orabbix

    下载地址:http://www.smartmarmot.com/product/orabbix/download/

   # mdkir -p /usr/local/orabbix
   # mv orabbix-1.2.3.zip /usr/local/orabbix
   # unzip orabbix-1.2.3.zip
   # chmod +x run.sh
      # cp init.d/orabbix /etc/init.d/
      # sed -i 's#/opt/orabbix#orabbix=/usr/local/orabbix#g' /etc/init.d/orabbix
      # chmod +x /etc/init.d/orabbix
      # sed -i 's#java#//usr/local/jdk1.7.0_79/bin/java#g' /usr/local/orabbix/run.sh

    准备orabbix 配置文件      

     # cp config.props.sample  config.props
     # vim config.props


技术分享图片  

技术分享图片

需要注意的是DatabaseList=App01指的是被监控服务器的名称,该名称要和zabbix server界面中的机器名称保持一致,该配置文件中后续所引用的设定都以该名称为准。

App01.Url=jdbc:oracle:thin:@ 192.168.154.130:1521:orcl指定的是被监控服务器的连接信息(例如采用jdbc的联接方式,服务器地址是 192.168.154.130,oracle的端口是1521,orcl指的是数据库的实例名称)


3. 配置 orabbix 启动脚本 并启动orabbix

# service orabbix start


4. 导入oracle 监控模板

Configuration->Template->Import

技术分享图片




以上是关于orabbix 监控oracle的主要内容,如果未能解决你的问题,请参考以下文章

zabbix利用orabbix监控oracle

zabbix利用orabbix监控oracle

orabbix 监控oracle

zabbix之 orabbix模板监控oracle

亲测的orabbix监控Oracle过程

Orabbix 监控oracle表空间 Low Level Discovery