zabbix 之 orabbix安裝指導

    zabbix利用orabbix監控oracle

    

    

    Orabbix 是一個用來監控 Oracle 數據庫實例的 Zabbix 插件。下載地址:

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

     

     Orabbix插件的安裝與配置

     確保安裝jdk環境,java version查看,沒有則通過yum來安裝JAVA:yum install java

     

     1.在/opt目錄下新建一個orabbix目錄:

     [root@oracle orabbix]#mkdir -p /opt/orabbix

    (建議在此目錄下,如果放置其他目錄稍後需要更改orabbix的啓動文件orabbix,啓動文件默認寫在opt/orabbix目錄下 )

     

     2. 解壓安裝文件

    cd /opt/orabbix
    unzip orabbix-1.2.3.zip

     

    3.賦予權限

    chmod -R a+x /opt/orabbix/

     

    4 通過/opt/orabbix/conf/config.props.sample文件創建一個config.props文件:

     

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

      

    5.  編輯orabbix配置文件,具體如下

     [root@oracle orabbix]#vi conf/config.props

     

    ZabbixServerList=ZabbixServer1

    

    ZabbixServer1.Address=10.0.0.10

    ZabbixServer1.Port=10051

    

    #ZabbixServer2.Address=IP_ADDRESS_OF_ZABBIX_SERVER

    #ZabbixServer2.Port=PORT_OF_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=rac1,rac2

    

    #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

    rac1.Url=jdbc:oracle:thin:@10.0.0.3:1521:racdb1

    rac1.User=zabbix

    rac1.Password=zabbix

    #Those values are optionals if not specified Orabbix is going to use the general values

    rac1.MaxActive=10

    rac1.MaxWait=100

    rac1.MaxIdle=1

    rac1.QueryListFile=./conf/query.props

    

    rac2.Url=jdbc:oracle:thin:@10.0.0.4:1521:racdb2

    rac2.User=zabbix

    rac2.Password=zabbix

    #Those values are optionals if not specified Orabbix is going to use the general values

    rac2.MaxActive=10

    rac2.MaxWait=100

    rac2.MaxIdle=1

    rac2.QueryListFile=./conf/query.props

    #rac2.Url=jdbc:oracle:thin:@server2.domain.example.com:<LISTENER_PORT>:rac2

    #rac2.User=zabbix

    #rac2.Password=zabbix_password

    #rac2.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

    

    

    在數據庫服務器上(注意,是數據庫服務器)創建zabbix用戶如下步驟:

    

CREATE USER zabbix IDENTIFIED BY zabbix DEFAULT TABLESPACE users 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;

         

    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;

     

     6.  創建執行文件(直接cp即可)

    cp /opt/orabbix/init.d/orabbix /etc/init.d/orabbix

    7.保存退出,啓動orabbix服務(確保有執行權限)

    /etc/init.d/orabbix start

    Orabbix服務加入隨系統啓動:

    chkconfig --add orabbix
    chkconfig --level 345 orabbix on

     

     常見問題:

    若config.props文件未配置,或是配置了錯誤,無法通過配置的信息正確連進Oracle數據庫的,會出現以下錯誤信息

    [root@zabbix orabbix]# /etc/init.d/orabbix start

     

    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)

     

    可查看log信息判斷解決

    [root@oracle orabbix]# tail -f /opt/orabbix/logs/orabbix.log

     

    到此,安裝配置完成,則通過web頁面訪問直接導入模塊即可,模板文件:

    Orabbix_export_full.xml

    導入後生成template模板名爲:Template_Oracle

    將oracle主機host與導入的模板Template_Oracle關聯;

    注意:zabbix頁面中配置oracle主機host名稱必須和上面DatabaseList=rac1,rac2中的rac1、rac2一致,並且大小寫敏感!!!!


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章