什么是Prometheus?
Prometheus (普罗米修斯)是由 SoundCloud开发的开源监控报警系统和时序列数据库 。
Prometheus的特点
- 多维度数据模型。 灵活的查询语言。
- 不依赖分布式存储,单个服务器节点是自主的。
- 通过基于HTTP的pull方式采集时序数据。
- 可以通过中间网关进行时序列数据推送。
- 通过服务发现或者静态配置来发现目标服务对象。
- 支持多种多样的图表和界面展示,比如Grafana等。
官网地址:
https://prometheus.io/
基本原理
Prometheus的基本原理是通过HTTP协议周期性抓取被监控组件的状态,任意组件只要提供对应的HTTP接口就可以接入监控。
架构图
安装prometheus
官网下载,解压即可使用
wget https://github.com/prometheus/prometheus/releases/download/v2.30.3/prometheus-2.30.3.linux-amd64.tar.gz
配置文件:
vi prometheus.yml
启动prometheus
./prometheus &
prometheus 加到系统服务
# vi /etc/systemd/system/prometheus.service [Unit] Description=Prometheus Monitoring System documentation=Prometheus Monitoring System [Service] ExecStart=/data/app/prometheus/prometheus --config.file=/data/app/prometheus/prometheus.yml --web.listen-address=:9080 [Install] WantedBy=multi-user.target



