Prometheus 安装部署

Prometheus 安装部署


 

Prometheus(普罗米修斯)是一款开源的监控系统,使用 go 语言开发,启动速度快,易于部署,下载后可直接运行。

(以CentOS 7.x为例)

1、下载Prometheus

wget https://github.com/prometheus/prometheus/releases/download/v2.8.0/prometheus-2.8.0.linux-amd64.tar.gz
tar xf prometheus-2.8.0.linux-amd64.tar.gz -C /usr/local/
mv /usr/local/prometheus-2.8.0.linux-amd64 /usr/local/prometheus
cd /usr/local/prometheus

2、查看 Prometheus 版本

./prometheus --version

3、启动 Prometheus

启动一个Prometheus是非常容易的,默认的配置文件prometheus.yml,默认启动后的端口为9090。

./prometheus &

4、以服务方式启动

添加到系统服务,方便于管理

vi /etc/systemd/system/prometheus.service

在 prometheus.service 文件中,添加如下内容:

[Unit]
Description=Prometheus Monitoring System
Documentation=Prometheus Monitoring System
 
[Service]
ExecStart=/usr/local/prometheus/prometheus 
  --config.file=/usr/local/prometheus/prometheus.yml 
  --web.listen-address=:9090
 
[Install]
WantedBy=multi-user.target

5、启动服务,设置开机自启

systemctl daemon-reload
systemctl enable prometheus
systemctl start prometheus

6、访问 Prometheus

默认是 9090端口

访问http://IP:9090,个人环境访问效果如下:

7、配置 Graph 图表

1)选择一个默认的采集指标

2)点击 “Execute”,可以在 Console 中看到相应的 Element 

 3)也可以在  Graph 中看到相应的图表信息

4)鼠标移动到曲线图的某个时间点,可以很直观地看到实时的性能数据

原文地址:https://www.cnblogs.com/miracle-luna/p/13211423.html