• zabbix-使用orabbix来监控oracle11g


    Orabbix简介说明

    1. DB Version (i.e. Validity of package)数据库版本

    2. Archiving (Archive log production with trend analysis)归档文件

    3. Event Waits (Files I/O, single block read, multi-block read, direct path read, SQLNet Messages, Control file I/O, Log Write)等待的事件

    4. Hit Ratio (Hit Ratio on Triggers, Tables/Procedures, SQL Area, Body)

    5. Logical I/O (Server performance on Logical I/O of: Current Read, Consistent Read, Block Change)逻辑I/O

    6. Physical I/O (Redo Writes, Datafile Writes, Datafile Reads)物理I/O

      PGA

    7. SGA (In particular; Fixed Buffer, Java Pool, Large Pool, Log Buffer, Shared Poolm Buffer Cache)

    8. Shared Pool (Pool Dictionary Cache, Pool Free Memory, Library Chache, SQL Area, MISC.)共享池

    9. Pin Hit Ratio (Oracle library cache pin are caused by contention with the library cache, the area used to store SQL executables for re-use)

    10. Sessions / Processes**会话数和进程数**

    11. Sessions (Active Sessions, Inactive Sessions, System Sessions)

    12. DBSize/DBFileSize (DBSize size of database really used space and of Filesize)数据库大小

    下载安装jdk8

    下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

    安装步骤:

    #将软件上传到服务器
    #mkdir /usr/java
    #tar -zxvf jdk-8u171-linux-x64.tar.gz
    #mv jdk1.8.0_171 /usr/java/
    #echo -e '# config java
    JAVA_HOME=/usr/java/jdk1.8.0_171
    CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
    # config path
    PATH=$JAVA_HOME/bin:$PATH
    export PATH JAVA_HOME CLASSPATH
    ' >> /etc/profile
    r/java/jdk1.8.0_171
    CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
    # config path
    PATH=$JAVA_HOME/bin:$PATH
    export PATH JAVA_HOME CLASSPATH
    ' >> /etc/profile
    #source /etc/profile

    创建oracle监控帐号,在oracle的sqlplus窗口里面执行:

    create tablespace zabbix datafile'+DATA' size 16G autoextend off;
    create tablespace zabbix_idx datafile'+DATA' size 2G autoextend off;
    CREATE  USER zabbix IDENTIFIED BY zabbix DEFAULT TABLESPACE zabbix 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的日志显示中也会有错误提示。:

    SQL> exec dbms_network_acl_admin.create_acl(acl => 'resolve.xml',description=> 'resolve acl', principal =>'zabbix', is_grant => true, privilege => 'resolve');
    BEGIN dbms_network_acl_admin.create_acl(acl => 'resolve.xml',description=> 'resolve acl', principal =>'zabbix', is_grant => true, privilege => 'resolve'); END;
    *
    ERROR at line 1:
    ORA-30554: function-based index XDB.XDB$ACL_XIDX is disabled
    ORA-06512: at "SYS.DBMS_NETWORK_ACL_ADMIN", line 258
    ORA-06512: at line 1
    SQL> exec dbms_network_acl_admin.assign_acl(acl => 'resolve.xml', host =>'*');
    BEGIN dbms_network_acl_admin.assign_acl(acl => 'resolve.xml', host =>'*'); END;
    *
    ERROR at line 1:
    ORA-31001: Invalid resource handle or path name "/sys/acls/resolve.xml"
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
    ORA-06512: at "SYS.DBMS_NETWORK_ACL_ADMIN", line 97
    ORA-06512: at "SYS.DBMS_NETWORK_ACL_ADMIN", line 485
    ORA-06512: at line 1

    安装部署orabbix

    orabbix只需要安装在一台服务器即可,orabbix就是一个oracle客户端去查找oracle中的数据,然后传给zabbix:

    # 下载:
    mkdir /usr/local/orabbix
    cd /usr/local/orabbix
    wget  http://nchc.dl.sourceforge.net/project/orabbix/orabbix-1.2.3.zip
    # 安装:
    unzip orabbix-1.2.3.zip 
    chmod +x run.sh
    cp init.d/orabbix /etc/init.d/
    sed -i 's#orabbix=/opt/orabbix#orabbix=/usr/local/orabbix#g' /etc/init.d/orabbix
    chmod +x /etc/init.d/orabbix
    sed -i 's#java#/usr/java/jdk1.8.0_171/bin/java#g' /usr/local/orabbix/run.sh    

    配置config. Props:

    orabbix所有的配置文件都在conf目录中,需要将默认的配置文件config.props.sample复制一份后再进行修改和配置。

    cd /usr/local/orabbix/conf
    cp config.props.sample config.props
    vim config.props

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

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

     

    启动orabbix服务

    #启动程序
    [root@ntpd orabbix]# service orabbix start
    Starting Orabbix service:
    #查看启动日志是否有报错
    [root@ntpd logs]# tail -200f orabbix.log 
     2018-06-13 16:32:46,326 [main] INFO  Orabbix - Starting Orabbix Version 1.2.3 
     2018-06-13 16:32:46,341 [main] INFO  Orabbix - Orabbix started with pid:14146
     2018-06-13 16:32:46,341 [main] INFO  Orabbix - PidFile -> ./logs/orabbix.pid
     2018-06-13 16:32:46,513 [main] INFO  Orabbix - DB Pool created: org.apache.commons.dbcp.datasources.SharedPoolDataSource@7fbe847c
     2018-06-13 16:32:46,514 [main] INFO  Orabbix - URL=jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.220.2.84)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = 192.220.2.85)(PORT = 1521))(LOAD_BALANCE = yes)(FAILOVER = yes))(CONNECT_DATA = (SERVER = DEDICATED)(FAILOVER_MODE = (TYPE = SESSION)(METHOD = BASIC))(SERVICE_NAME = orcl)(RETRIES = 1)(DELAY = 3)))
     2018-06-13 16:32:46,514 [main] INFO  Orabbix - maxPoolSize=10
     2018-06-13 16:32:46,514 [main] INFO  Orabbix - maxIdleSize=1
     2018-06-13 16:32:46,514 [main] INFO  Orabbix - maxIdleTime=1800000ms
     2018-06-13 16:32:46,514 [main] INFO  Orabbix - poolTimeout=100
     2018-06-13 16:32:46,514 [main] INFO  Orabbix - timeBetweenEvictionRunsMillis=-1
     2018-06-13 16:32:46,514 [main] INFO  Orabbix - numTestsPerEvictionRun=3
    #查看进程是否存在
    [root@ntpd logs]# ps aux |grep orabbix
    root     14146  8.1  0.5 7059940 86192 pts/3   Sl   16:32   0:02 /usr/java/jdk1.8.0_171/bin/java -Duser.language=en -Duser.country=US -Dlog4j.configuration=./conf/log4j.properties -cp lib/commons-codec-1.4.jar:lib/commons-dbcp-1.4.jar:lib/commons-lang-2.5.jar:lib/commons-logging-1.1.1.jar:lib/commons-pool-1.5.4.jar:lib/hsqldb.jar:lib/log4j-1.2.15.jar:lib/ojdbc6.jar:.:./orabbix-1.2.3.jar com.smartmarmot.orabbix.bootstrap start ./conf/config.props

    界面导入oracle模版文件

    [root@ntpd template]# ll
    total 228
    -rw-r--r-- 1 root root 107257 Oct 25  2011 Orabbix_export_full.xml
    -rw-r--r-- 1 root root  21399 Oct 25  2011 Orabbix_export_graphs.xml
    -rw-r--r-- 1 root root  86724 Oct 25  2011 Orabbix_export_items.xml
    -rw-r--r-- 1 root root   4911 Oct 25  2011 Orabbix_export_triggers.xml
    [root@ntpd template]# pwd
    /usr/local/orabbix/template
    image

    导入成功后:

    image

    将模板导入到被监控的节点:

  • 相关阅读:
    【转】PowerManager 与 WakeLock
    【转】设计模式总结之模式分类
    【转】一篇文章,教你学会Git
    【转】Iconfont
    【转】码云source tree 提交超过100m 为什么大文件推不上去
    各 Android 平台版本支持的 API 级别
    【转】Android进程机制
    【转】数据库CRUD操作
    【转】数据库--视图的基本概念以及作用
    动态规划的两种形式
  • 原文地址:https://www.cnblogs.com/snailshadow/p/9673902.html
Copyright © 2020-2023  润新知