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

posted @ 2020-06-21 21:19  人艰不拆_zmc  阅读(9922)  评论(3编辑  收藏  举报