export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_.ZHS16GBK
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
6. 使配置完的環境變量生效 source ~/.bashrc
7.進入/opt/minitor/oracleDb,執行以下指令為oracledb_exporter.linux-amd64賦權。
可以私聊我一下我發你資源
chmod +x oracledb_exporter.linux-amd64
8. 再設定執行的環境變量,指令行直接執行如下指令export:
export DATA_SOURCE_NAME=使用者名/密碼@ 資料庫服務名 注意:某些字元在xshell中執行需要轉義
如:我這裡的使用者名密碼是 system/root12#$
export DATA_SOURCE_NAME="system/oracle12#\[email protected]"
9.執行 vim /opt/minitor/prometheus/prometheus.yml,添加以下配置檔案(紅色部分):
scrape_configs:
# The job name is added as a label `job=` to any timeseries scraped from this config.
- job_name: 'prometheus'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['ip:9090']
labels:
instance: prometheus
- job_name: oracle
static_configs:
- targets: ['ip:9161']
labels:
instance: oracle
10.啟動oracle_exporter
nohup ./oracledb_exporter.linux-amd64 &
11.去prometheus自帶的web頁面上檢視
12.在grafana中檢視配置狀态(推薦使用3333)
13.效果圖如下: