[原创]二进制安装prometheus

内容纲要

实验环境:Centos7.8 ip:192.168.50.20

1.下载prometheus包,解压并进入目录

[root@prometheus ~]wget https://github.com/prometheus/prometheus/releases/download/v2.22.0/prometheus-2.22.0.linux-amd64.tar.gz

[root@prometheus ~]tar zxvf prometheus-2.22.0.linux-amd64.tar.gz
[root@prometheus ~]cd prometheus-2.22.0.linux-amd64

2.配置prometheus(创建监控数据存放路径/data,设置存放数据周期3年)

[root@prometheus prometheus-2.22.0.linux-amd64]# mkdir /data
[root@prometheus prometheus-2.22.0.linux-amd64]# ./prometheus --config.file="prometheus.yml" --storage.tsdb.retention.time=3y --storage.tsdb.path="/data"

3.访问ip:9090

4.设置启动命令

[root@prometheus prometheus-2.22.0.linux-amd64]# cd /usr/lib/systemd/system

[root@prometheus system]# cp sshd.service prometheus.service
[root@prometheus system]# vi prometheus.service
[Unit]
Description=prometheus

[Service]
Restart=on-filure
ExecStart=/root/prometheus-2.22.0.linux-amd64/prometheus --config.file=/root/prometheus-2.22.0.linux-amd64/prometheus.yml

[Install]
WantedBy=multi-user.target

[root@prometheus system]# systemctl daemon-reload
[root@prometheus system]# systemctl start prometheus.service
spacer

Leave a reply

评论审核已启用。您的评论可能需要一段时间后才能被显示。

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据