一、prometheus网址
https://prometheus.io/download/
下载prometheus的tar.gz解压包
二、安装prometheus
解压:
cd /usr/wubin
tar zxvf prometheus-2.14.0.linux-amd64.tar.gz
更名:
mv prometheus-2.14.0.linux-amd64 prometheus
查看版本:
./prometheus –version
修改配置文件底部监控本机:
vim prometheus.yml
修改配置
scrape_configs:
– job_name: ‘prometheus’
static_configs:
# 监控本地及端口
– targets: [‘172.16.75.205:9090’]
修改完成,wq保存退出;
启动;
./prometheus –config.file=prometheus.yml
三、设置开机自启
vim /usr/lib/systemd/system/prometheus.service
配置环境:
[Unit]
Description=Prometheus
After=network.target
[Service]
Type=simple
ExecStart=/usr/wubin/prometheus2.14/prometheus –config.file=/usr/wubin/prometheus2.14/prometheus.yml
[Install]
WantedBy=multi-user.target
输入完成,wq保存退出;
输入命令:
systemctl daemon-reload
systemctl enable prometheus
systemctl start prometheus
原创文章,作者:6024010,如若转载,请注明出处:https://blog.ytso.com/tech/aiops/244939.html