prometheus監控oracle


1、下載oracle_exporter

https://github.com/iamseth/oracledb_exporter/releases

2、export DATA_SOURCE_NAME=用戶名/密碼@ 數據庫服務名

# export Oracle location:
export DATA_SOURCE_NAME=system/password@oracle-sid
# or using a complete url:
export DATA_SOURCE_NAME=user/password@//myhost:1521/service

 例如:

export DATA_SOURCE_NAME=C##cwbase1_9999/test2020@//10.20.31.129:1521/orcl

注意:某些字符在xshell中執行需要轉義

3、運行oracle_exporter

nohup oracledb_exporter -log.level error -web.listen-address 0.0.0.0:9161 > out.log &
或
nohup ./oracledb_exporter &

 默認地址:http://ip:9161/

注意:執行這步命令時會報錯(ImportError: libclntsh.so.18.1: cannot open shared object file: No such file or directory),解決方案如下:

  3.1、設置環境變量:

export ORACLE_BASE=/u19/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.3.0/dbhome_1
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH

  3.2、編輯/etc/ld.so.conf,在最后一行輸入獲取的路徑((注意里面的路徑要按照自己實際情況來寫)),例如:

/u19/app/oracle/product/19.3.0/dbhome_1/lib/libclntsh.so.18.1

  3.3、執行:

ldconfig

4、prometheus 配置

- job_name: oracle

    static_configs:
    - targets: ['10.20.31.129:9161']
      labels:
        instance: oracle-129-ospflow

5、grafana 配置 dashbord

https://grafana.com/grafana/dashboards/3333


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM