1、官网下载
https://prometheus.io/docs/introduction/overview/
2、安装
移动prometheus-2.54.0.linux-amd64.tar.gz到 /wagpt
tar -xf prometheus-2.54.0.linux-amd64.tar.gz
mv prometheus-2.54.0.linux-amd64 prometheus
3、注册成系统服务
[Unit]
Description=Prometheus server daemon
After=network.target
[Service]
Type=simple
User=root
Group=root
ExecStart=/wagpt/prometheus/prometheus
–config.file “/wagpt/prometheus/prometheus.yml”
–storage.tsdb.path “/wagpt/prometheus/data”
–storage.tsdb.retention=15d
–web.enable-lifecycle
Restart=on-failure
[Install]
WantedBy=multi-user.target
4、设置开机自启动
systemctl daemon-reload # 通知systemd重新加载配置文件
systemctl enable prometheus.service # 设置为开机自启动
systemctl start prometheus.service # 开启服务
systemctl status prometheus.service # 查看状态为Active: active (running)
systemctl restart prometheus.service # 重启服务