文章目录
Prometheus(普罗米修斯)概述
prometheus:Prometheus是一套开源的监控&报警&时间序列数据库的组合,起始是由SoundCloud公司开发的。
非常少的外部依赖+系统集成(docker Nginx JMX等),安装操作简单服务自动化发现,实现一种Profiling监控方式,实时分析系统运行的状态、执行时间、调用次数等,以找到系统的热点,为性能优化提供依据。
环境搭建
(1)下载prometheus
解压-由于普罗米修斯还将自己的数据公开为HTTP端点,因此可以对其自身的健康状况进行刮擦和监视。
http:// localhost:9090 进行监控,验证自身度量标准http:// localhost:9090 / metrics(其他端口后面加/metrics即可)。
下载地址https://prometheus.io/download/
(2)解压Prometheus
tar xvfz prometheus-*.tar.gz
cd prometheus-*
./prometheus --help(查看帮助文档)
(3)配置prometheus.yml
YAML 的数据组织主要依靠的是空白,缩进,分行等结构实现配置
在线YAML编辑器https://www.bejson.com/validators/yaml_editor/
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
-