Prometheus

Prometheus 是一个开源的服务监控系统和时间序列数据库

官网 https://prometheus.io/

特性:

高维度数据模型
自定义查询语言
可视化数据展示
高效的存储策略
易于运维
提供各种客户端开发库
警告和报警
数据导出

体系结构

Prometheus非常适合记录任何纯数字时间序列。

它既适合以机器为中心的监视,也适合于高度动态的面向服务的体系结构的监视。在微服务世界中,它对多维数据收集和查询的支持是一种特别的优势。

docker下安装

1.拉取镜像

docker pull prom/prometheus

2.运行

$ docker run -p 9090:9090 -v /tmp/prometheus-data:/prometheus-data prom/prometheus

如果要添加映射配置文件prometheus.yml

global:
  # 设定抓取数据的超时时间,默认为10s
  scrape_timeout: 15s
  # 设置规则刷新,每15秒刷新一次规则。默认值为每1分钟。
  evaluation_interval: 15s
alerting:
  alertmanagers:
  - static_configs:
    - targets: []
    scheme: http
    timeout: 10s
    api_version: v1
scrape_configs:
  # 一定要全局唯一, 采▒.▒ Prometheus 自身的 metrics
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

命令

docker run  -d -p 9090:9090 -v /tmp/prometheus.yml:/home/docker/prometheus.yml -v /tmp/prometheus-data:/prometheus-data prom/prometheus

浏览器打开 http://192.168.99.100:9090

使用prometheus_target_interval_length_seconds 确认是否有抓取到数据

原文地址:https://www.cnblogs.com/baby123/p/12699900.html