赞
踩
目录
2.分别解压到/prom和/prometheus_exporter
3.在exporter机器上安装mysql(我使用的是编译安装)
4.进入mysql,并且授权一个用户mysqld_exporter用于拉取数据
5.添加配置文件在/prom_exporter/mysqld_exporter/my.cnf,并且运行
prometheus_server(192.168.10.149):prometheus-2.42.0.linux-amd64.tar.gz
prometheus_exporter(192.168.10.159):mysqld_exporter-0.14.0.linux-amd64.tar.gz
tar xf ...
可以使用yum安装
yum install -y mysql-server
grant all on *.* to 'mysqld_exporter'@'%' identified by '123456';
首先改一下环境变量
- [root@slave1 mysqld_exporter]# PATH=/prom_exporter/mysqld_exporter/:$PATH
- [root@slave1 mysqld_exporter]# echo "PATH=/prom_exporter/mysqld_exporter/:$PATH" >>/root/.bashrc
- [client]
- user=mysqld_exporter
- password=123456
nohup mysqld_exporter --config.my-cnf=/prom_exporter/mysqld_exporter/my.cnf --web.listen-address 0.0.0.0:8091 &
vim /usr/lib/systemd/system/prometheus.service
- [Unit]
- Description=prometheus
- [Service]
- #安装的路径
- ExecStart=/prom/prometheus_server/prometheus --config.file=/prom/prometheus_server/prometheus.yml
- ExecReload=/bin/kill -HUP $MAINPID
- KillMode=process
- Restart=on-failure
- [Install]
- WantedBy=multi-user.target
7.更新deamon
systemctl daemon-reload
vim prometheus.yml,最后3行复制,然后写被监控机器的ip和port
service prometheus restart
1)添加数据源
2)导入模板
3)效果:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。