介紹
prometheus不僅能對(duì)服務(wù)器迫摔、應(yīng)用jvm轴踱、硬件埃元、持續(xù)集成等監(jiān)控涝涤,還能對(duì)數(shù)據(jù)庫和數(shù)據(jù)庫連接池進(jìn)行監(jiān)控。下面介紹下mysql監(jiān)控搭建流程
下載
網(wǎng)址:https://github.com/prometheus/mysqld_exporter
按需下載mysqld_exporter版本
安裝
- 步驟
-
解壓
- 使用環(huán)境變量運(yùn)行
export DATA_SOURCE_NAME='user:password@(hostname:3306)/'
nohup ./mysqld_exporter &
- prometheus.yml新增配置
- job_name: 'mysql'
static_configs:
- targets: ['192.168.1.137:9104']
labels:
instance: 'mysql-137'
啟動(dòng)成功后prometheus頁面可訪問指標(biāo)數(shù)據(jù)
ps:提供個(gè)mysql比較全的grafana配置岛杀,直接使用inport添加json阔拳!
鏈接:https://pan.baidu.com/s/1Z4iI0uLXqMcREXW01Q-S1g
提取碼:vcbf
拓展 oracledb_exporter
對(duì)于oracle監(jiān)控,下載oracledb_exporter采集器类嗤,再執(zhí)行命令糊肠,這里就不詳細(xì)說明了.
只是把遇到的錯(cuò)誤記錄一下
啟動(dòng):
nohup ./oracledb_exporter &
默認(rèn)地址:http://ip:9161/
執(zhí)行這步命令時(shí)會(huì)報(bào)錯(cuò)(ImportError: libclntsh.so.18.1: cannot open shared object file: No such file or directory),解決方案如下:
ln -s /app/oracle/product/11.2/db_1/lib/libclntsh.so.11.1 libclntsh.so.18.1
export LD_LIBRARY_PATH=/app/oracle/product/11.2/db_1/lib/