Prometheus是最初在SoundCiloud上构建的开源系统监视和警报工具包 。自2012年成立以来,许多公司和组织都采用了Prometheus,该项目拥有非常活跃的开发人员和用户社区。现在,它是一个独立的开源项目,并且独立于任何公司进行维护。为了强调这一点并阐明项目的治理结构,Prometheus在2016年加入了 Cloud Native Computing Foundation,这是继Kubernetes之后的第二个托管项目。
普罗米修斯的主要特点是:
Prometheus生态系统包含多个组件,其中许多是可选的:
大多数Prometheus组件都是用Go编写的,因此易于构建和部署为静态二进制文件。
下图说明了Prometheus的体系结构及其某些生态系统组件

为您的平台下载最新版本的Prometheus,然后解压缩:
# tar xf prometheus-2.23.0.linux-amd64.tar.gz
# cd prometheus-2.23.0.linux-amd64
Prometheus服务器是一个称为prometheus(或prometheus.exe在Microsoft Windows上)的二进制文件。我们可以运行二进制文件,并通过传递--help标志来查看有关其选项的帮助
# ./prometheus --help
usage: prometheus [<flags>]
The Prometheus monitoring server
Flags:
-h, --help Show context-sensitive help (also try --help-long and --help-man).
--version Show application version.
.......
启动Prometheus方式有两种;默认端口号是9090
# ./prometheus #这样执行的话会占用的终端,
# ./prometheus & #&可以放置后台运行
# firewall-cmd --permanent --add-port=9090/tcp
# firewall-cmd --reload
普罗米修斯应该开始。您还应该能够在http:// localhost:9090上浏览到有关其自身的状态页面。给它大约30秒的时间,以从其自己的HTTP指标终结点收集有关其自身的数

设置系统时间
# date -s "20201215 16:56:35"

global:
scrape_interval: 15s
evaluation_interval: 15s
rule_files:
# - "first.rules"
# - "second.rules"
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
有示例配置文件中配置的三个模块:global,rule_files,和scrape_configs。
global块控制Prometheus服务器的全局配置。我们有两个选择;