Prometheus——部署

Prometheus——部署

软件包版本

prometheus-2.14.0-rc.0.linux-amd64.tar.gz

详细步骤

解压

[root@server01 ~]# mkdir /opt/src
[root@server01 ~]# tar -xvf prometheus-2.14.0-rc.0.linux-amd64.tar.gz -C /opt/
[root@server01 ~]# cd /opt/
[root@server01 prometheus]# ln -s prometheus-2.14.0-rc.0.linux-amd64/ prometheus

 添加用户

[root@server01 ~]# groupadd prometheus
[root@server01 ~]# useradd -g prometheus -s /sbin/nologin prometheus

创建数据目录+权限

[root@server01 ~]# chown -R prometheus:prometheus /opt/prometheus
# 这里出现过权限问题
[root@server01 ~]# chmod 777 /opt/prometheus -R

配置启动文件

[root@server01 ~]# vi /usr/lib/systemd/system/prometheus.service

[Unit]
Description=prometheus
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/opt/prometheus/prometheus --config.file=/opt/prometheus/prometheus.yml --storage.tsdb.path=/opt/prometheus --storage.tsdb.retention=15d --log.level=info
Restart=on-failure
[Install]
WantedBy=multi-user.target

[root@server01 ~]# chown prometheus:prometheus /usr/lib/systemd/system/prometheus.service
[root@server01 ~]# systemctl enable prometheus
[root@server01 ~]# systemctl start prometheus

访问10.4.7.10:9090/graph成功代表部署完成

猜你喜欢

转载自www.cnblogs.com/Wshile/p/12922037.html