软件下载
https://prometheus.io/download/
安装
tar zvxf prometheus-2.35.0.linux-amd64.tar.gz -C /usr/local/
cd /usr/local
mv prometheus-2.35.0.linux-amd64 prometheus
groupadd prometheus
useradd -g prometheus -m -d /var/lib/prometheus -s /sbin/nologin prometheus
chown prometheus:prometheus -R prometheus/
注册服务
cd /etc/systemd/system
vim prometheus.service
[Unit]
Description=prometheus
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/data
Restart=on-failure
[Install]
WantedBy=multi-user.target
启动服务
systemctl daemon-reload
systemctl start prometheus
systemctl status prometheus
systemctl enable prometheus