Prometheus——部署

时间:2020-05-20
本文章向大家介绍Prometheus——部署,主要包括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成功代表部署完成

原文地址:https://www.cnblogs.com/Wshile/p/12922037.html