Prometheus 介绍(一)

2019-08-26  本文已影响0人  济南打工人

Prometheus 简介

官网:https://prometheus.io
      Prometheus 是一套开源的系统监控报警框架。它启发于 Google 的 borgmon 监控系统,由工作在 SoundCloud 的 google 前员工在 2012 年创建,作为社区开源项目进行开发,并于 2015 年正式发布。2016 年,Prometheus 正式加入 Cloud Native Computing Foundation,成为受欢迎度仅次于 Kubernetes 的项目。
作为新一代的监控框架,Prometheus 具有以下特点:

      需要指出的是,由于数据采集可能会有丢失,所以 Prometheus 不适用对采集数据要 100% 准确的情形。但如果用于记录时间序列数据,Prometheus 具有很大的查询优势,此外,Prometheus 适用于微服务的体系架构。


Prometheus 组成及架构

Prometheus 生态圈中包含了多个组件,其中许多组件是可选的:

从上图可以看出,Prometheus 的主要模块包括:Prometheus server, exporters, Pushgateway, PromQL, Alertmanager 以及图形界面。
其大概的工作流程是:

Prometheus 相关概念

下面将对 Prometheus 中的数据模型,metric 类型以及 instance 和 job 等概念进行介绍,以便读者在 Prometheus 的配置和使用中可以有一个更好的理解。
数据模型
Prometheus 中存储的数据为时间序列,是由 metric 的名字和一系列的标签(键值对)唯一标识的,不同的标签则代表不同的时间序列。

四种 Metric 类型

Prometheus 客户端库主要提供四种主要的 metric 类型:
Counter

例如,查询 http_requests_total{method=“get”, job=“Prometheus”, handler=“query”} 返回 8,10 秒后,再次查询,则返回 14。
Gauge

例如:go_goroutines{instance=“172.17.0.2”, job=“Prometheus”} 返回值 147,10 秒后返回 124。
Histogram

例如,查询 http_request_duration_microseconds_sum{job=“Prometheus”, handler=“query”} 时,返回结果如下:
图 2. Histogram metric 返回结果图

图片.png

Summary

instance 和 jobs

上一篇 下一篇

猜你喜欢

热点阅读