测试环境 172.16.139.186
1、安装prometheus客户端
[root@172-16-139-186 1-prometheus]#tar -xf prometheus-2.33.3.linux-amd64.tar.gz #解压软件包
[root@172-16-139-186 1-prometheus]#mv prometheus-2.33.3.linux-amd64/ /usr/local/prometheus #将软件包移动到安装软件的目录并改名
[root@172-16-139-186 1-prometheus]#cd /usr/local/prometheus/
[root@172-16-139-186 1-prometheus]#./prometheus --version
[root@172-16-139-186 1-prometheus]#sed -i '$s/"localhost:/"172.16.139.186:/' prometheus.yml #修改配置文件,IP为本机地址
[root@172-16-139-186 1-prometheus]#./promtool check config ./prometheus.yml #检查配置文件语法
[root@172-16-139-186 1-prometheus]#vim /usr/lib/systemd/system/prometheus.service
[root@172-16-139-186 1-prometheus]#systemctl daemon-reload
[root@172-16-139-186 1-prometheus]#systemctl enable prometheus.service --now
[root@172-16-139-186 1-prometheus]#ss -tunlp |grep 9090
此时通过浏览器访问:172.16.139.186:9090 ;确保prometheus正常