搭建Prometheus-2.29

搭建Prometheus-2.29

   小白     2021年8月28日 18:23     57    

下载Prometheus
mkdir /data
cd /data
wget https://github.com/prometheus/prometheus/releases/download/v2.29.1/prometheus-2.29.1.linux-amd64.tar.gz
tar -zxvf prometheus-2.29.1.linux-amd64.tar.gz
mv prometheus-2.29.1.linux-amd64 prometheus
安装Prometheus
创建Prometheus启动用户
groupadd prometheus
useradd -g prometheus prometheus

创建启动文件
touch /usr/lib/systemd/system/prometheus.service

修改相关目录权限
chown prometheus:prometheus /usr/lib/systemd/system/prometheus.service
chown -R prometheus:prometheus /data/prometheus

将以下内容写入启动文件中
vim /usr/lib/systemd/system/prometheus.service
[Unit]
Description=Prometheus
Documentation=https://prometheus.io/
After=network.target

[Service]
Type=simple
User=prometheus
ExecStart=/data/prometheus/prometheus --config.file=/data/prometheus/prometheus.yml --web.enable-lifecycle --storage.tsdb.path=/data/prometheus/data --storage.tsdb.retention=60d
Restart=on-failure

[Install]
WantedBy=multi-user.target

 

启动Prometheus

systemctl start prometheus


文章评论

0

其他文章