介绍

prometheus不仅能对服务器、应用jvm、硬件、持续集成等监控,还能对数据库和数据库连接池进行监控。下面介绍下mysql监控搭建流程

下载
网址:https://github.com/prometheus/mysqld_exporter
按需下载mysqld_exporter版本

安装
- 步骤
-
解压
- 使用环境变量运行
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'
启动成功后prometheus页面可访问指标数据

ps:提供个mysql比较全的grafana配置,直接使用inport添加json!

链接:https://pan.baidu.com/s/1Z4iI0uLXqMcREXW01Q-S1g
提取码:vcbf
拓展 oracledb_exporter
对于oracle监控,下载oracledb_exporter采集器,再执行命令,这里就不详细说明了.
只是把遇到的错误记录一下
启动:
nohup ./oracledb_exporter &
默认地址:http://ip:9161/
执行这步命令时会报错(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/
网友评论