prometheus 之监控Oracle

1.下载oracle客户端安装包,配置安装
https://www.oracle.com/database/technologies/instant-client/downloads.html
这里下载linux 最新版:oracle-instantclient19.3-basic-19.3.0.0.0-1.x86_64.rpm

rpm -ivh oracle-instantclient19.3-basic-19.3.0.0.0-1.x86_64.rpm

安装的文件默认放在两个位置:
头文件:/usr/include/oracle/19.3/client64/ 下,如果在使用时报错找不到头文件,记得看路径是否是这个。
包文件:/usr/lib/oracle/19.3/client64/ 下,包含{bin、lib}两个文件夹.

创建文件夹/usr/lib/oracle/19.3/client64/network/admin
创建数据库配置文件/usr/lib/oracle/19.3/client64/network/admin/tnsnames.ora

//数据库配置文件 ,host,PORT,SERVICE_NAME 需要配置
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = $ip)(PORT = $port))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = $sid)
)
)
2.配置环境变量 vim ~/.bashrc --根目录下为全局使用,为限制用户权限,可只修改某一用户的环境变量
export ORACLE_HOME=/usr/lib/oracle/19.3/client64
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_LANG='simplified chinese_china'.ZHS16GBK
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH

使配置完的环境变量生效 source ~/.bashrc

3.下载oracle_exporter
https://github.com/iamseth/oracledb_exporter/releases

export DATA_SOURCE_NAME=用户名/密码@ 数据库服务名 注意:某些字符在xshell中执行需要转义
//例如:
export DATA_SOURCE_NAME="system/cserver_6U@ORCL"

后台启动: nohup ./oracledb_exporter &
http://127.0.0.1:9161/

4.prometheus 配置

  • job_name: oracle
    static_configs:
    • targets: [‘127.0.0.1:9161‘]
      labels:
      instance: oracle

5.grafana 配置 dashbord
https://grafana.com/grafana/dashboards/3333

你可能感兴趣的:(prometheus 之监控Oracle)