prometheus官網:https://prometheus.io/download/
搭建環境參考:https://blog.csdn.net/baidu_36943075/article/details/91829364
一、安裝配置prometheus 參考:https://www.jianshu.com/p/c9b46bc18624
啟動:systemctl start prometheus
查看狀態:systemctl status prometheus
二、安裝go環境
查看版本go version
三、啟動node_exporter
nohup ./node_exporter & #啟動node_exporter並后台運行
ps -ef | grep node_exporter #檢查進程的方式查看是否運行成功
四、安裝mysql
systemctl start mysqld #啟動
五、安裝mysql_exporter
nohup ./mysqld_exporter --config.my-cnf=.my.cnf & #后台啟動
ps -ef | grep mysqld_exporter #查看是否運行成功
六、安裝redis_exporter
nohup ./redis_exporter exporter redis://localhost:16379 & #后台啟動
ps -ef | grep redis_exporter
七、安裝grafana
參考:https://grafana.com/grafana/download
systemctl start grafana-server #啟動
八、Altermanager監控告警
1.添加郵件配置:vim /etc/grafana/grafana.ini
重啟grafana服務:systemctl restart grafana-server

2. 配置grafana郵件
3.安裝alertmanager
alertmanager配置郵箱 vim alertmanager.yml

后台啟動: nohup ./alertmanager --config.file=alertmanager.yml &
九、修改prometheus配置文件
1.添加rule_files; 2.新增rule_files文件(直接復制別人的樣例);
3.重啟prometheus: nohup ./prometheus --config.file=prometheus.yml &


