用docker+prometheus+grafana监控mysql,发现grafana仪表盘没显示数据,麻烦大佬看看是什么问题!
命令如下
docker run --name=prometheus -d -p 9090:9090 -v $(pwd)/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
docker run --name grafana -d -p 8000:3000 grafana/grafana
docker run --name some-mysql -v $(pwd)/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root -p 8001:3306 -d mysql
docker run -d --name mysql-exporter -p 9104:9104 -e DATA_SOURCE_NAME="root:root@(127.0.0.1:8001)/mysql" prom/mysqld-exporter
prometheus.yml配置如下
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
# Prometheus 监控配置
- job_name: 'prometheus'
static_configs:
- targets: ['192.168.0.2:9090']
# MySQL 监控配置
- job_name: 'mysql'
static_configs:
- targets: ['192.168.0.2:9104']