服务端配置数据
vim prometheus.yml
scrape_configs:# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.- job_name: "prometheus"# metrics_path defaults to '/metrics'# scheme defaults to 'http'.static_configs:- targets: ["localhost:9090"]# 添加以下内容- job_name: "node_exporter"static_configs:# 如果有多个机器,用','分开- targets: ['ip:端口']# 重启prometheus服务
systemctl restart prometheus
监控mysql
# 官网下载安装mysqld-exporter
tar xf mysqld_exporter-0.15.0.linux-amd64.tar.gz -C /usr/local/
cd /usr/local
mv mysqld_exporter-0.15.0.linux-amd64 mysqld_exporter
cd mysqld_exporter/vim .my.cnf[client]
user=用户名
password=密码./mysqld_exporter --config.my-cnf="/usr/local/mysqld_exporter/.my.cnf" & //启动mysqld-exporterps -ef |grep mysqld_exporter //查看进程
ss -lntp |grep 4647 //过滤进程号,查看端口
默认端口:9104