Prometheus 是由 SoundCloud 开发的开源监控报警系统和时序列数据库(TSDB),自2012年起,许多公司及组织已经采用 Prometheus,而且该项目有着很是活跃的开发者和用户社区,如今已经成为一个独立的开源项目,而且保持独立于任何公司,Prometheus 在2016加入 CNCF ( Cloud Native Computing Foundation ), 做为在 kubernetes 以后的第二个由基金会主持的项目。github地址(https://github.com/prometheus)node
prometheus使用启动参数和配置文件进行配置,启动参数配置系统参数,配置文件配置做业和实例内容mysql
# Prometheus 启动的时候,能够加载运行参数 -config.file 指定配置文件,默认为 prometheus.yml
# 全局配置
global:
scrape_interval:
15s
# 拉取 targets 的默认时间间隔
scrape_timeout:
15s
# 拉取一个 target 的超时时间
evaluation_interval:
15s
# 执行 rules 的时间间隔
# 额外的属性,会添加到拉取的数据并存到数据库中
external_labels:
monitor:
'codelab-monitor'
# 告警配置
alerting:
# 动态修改 alert 属性的规则配置
alert_relabel_configs:
[
- <relabel_config> ...
]
# 动态发现 Alertmanager 的配置
alertmanagers:
[
- <alertmanager_config> ...
]
# 规则配置
rule_files:
-
"rules/node.rules"
-
"rules2/*.rules"
# 数据拉取配置
scrape_configs:
-
job_name
:
'prometheus'
# 任务名称
scrape_interval:
5s
# 拉取时间间隔
# scrape_timeout: 拉取超时时间
metrics_path:/prometheus/metrics
# 拉取节点的 metric 路径
# scheme: 拉取数据访问协议
# 静态服务发现
static_configs:
-
targets
:
[
'localhost:9090'
]
|