最新消息:时间抓起来说是金子,抓不住就是流水。

Prometheus安装与配置

Prometheus 老子黑牵翻 1766浏览 0评论

简介
Prometheus基于Golang编写,编译后的软件包,不依赖于任何的第三方依赖。只需要下载对应平台的二进制包,解压并且添加基本的配置即可正常启动Prometheus Server

Prometheus安装
Prometheus官网下载对应软件包(https://prometheus.io/download/)

下载对应平台的软件包到服务器

以2.30.0版本,Linux服务器为例

#下载软件包
wget https://github.com/prometheus/prometheus/releases/download/v2.30.0/prometheus-2.30.0.linux-amd64.tar.gz
#解压软件包
tar -zxvf prometheus-2.30.0.linux-amd64.tar.gz

可以将软件包移动到服务器存放软件的目录,并进入目录

mv prometheus-2.30.0.linux-amd64 /usr/local/prometheus
cd /usr/local/prometheus

将Prometheus添加到系统服务

vi /usr/lib/systemd/system/prometheus.service
[Unit]
Description=prometheus
After=network.target
[Service]
Type=simple
User=apps
ExecStart=/usr/local/prometheus/prometheus --web.enable-admin-api --config.file=/usr/local/prometheus/prometheus.yml --storage.tsdb.path=/usr/local/prometheus/data --web.listen-address=0.0.0.0:9090 --storage.tsdb.retention.time=90d --log.level=info --log.format=logfmt
Restart=on-failure
[Install]
WantedBy=multi-user.target

启停prometheus服务

systemctl restart prometheus  #重启服务
systemctl stop prometheus   #停止服务
systemctl start prometheus  #启动服务

转载请注明:LINUX服务器运维架构技术分享 » Prometheus安装与配置

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址