Vitaliy Levchenko对“微服务应用程序的Prometheus监视”的2016年报告的解密
与传统系统不同,Prometheus使对快速变化且组织复杂的系统的监视和维护变得容易。我将讨论实施经验,陷阱和意外行为,并展示如何快速配置整个系统,包括通知和仪表板。
![](https://habrastorage.org/webt/yl/ui/t5/yluit5prdugaofv9yuzme5xhbgm.png)
除了监视单一应用程序的经典问题之外,微服务还为监视带来了许多新的难题。服务的位置不断变化,经常出现新的服务,它们之间的依赖关系发生了变化,临时作业在随机的地方运行-稳定配置的概念消失了。生产的概念消失了:在一种环境中,一项服务的许多版本被启动了-在部署过程中,针对不同受众群体,用于测试等。看到这种幸福感,开发人员倾向于快速改进应用程序,创建许多新指标,不断取消旧指标,尽管如此,他们仍希望能够进行有效的监视并应对新问题。
Prometheus Google Borgmon , . , , — . — , . — .
, Prometheus .
![](https://habrastorage.org/webt/re/3e/pc/re3epcz0h2ank1nhg9-erq83_g0.png)
, , , . , . Prometheus , . :
![](https://habrastorage.org/webt/9t/p1/rv/9tp1rvnysgwgaaozvxhe2lecywc.png)
. . . .
, , developer. . . .
![](https://habrastorage.org/webt/ng/zi/up/ngziuppetd3loguftimzvbxvqxs.png)
, , , .
![](https://habrastorage.org/webt/02/oy/nl/02oynl9_itxf3v2bvv_jfrn3chu.png)
? . . docker. , , , .
![](https://habrastorage.org/webt/nw/7j/de/nw7jdelh3owc3msmomycbsw9eg4.png)
, . . , . , , – . ? , – . , production .
![](https://habrastorage.org/webt/gc/gk/ja/gcgkja1gmokkpbtoqcbewj63uui.png)
– production . production 10 . , continuous delivery. stages. . . .
![](https://habrastorage.org/webt/sk/5k/td/sk5ktde7iufbjkdqoj587mc_t9m.png)
, . . .
, . , , .
. , – . , - environments – . stage environment, environment, production.
, , . . , 20 , .
![](https://habrastorage.org/webt/ur/0o/cd/ur0ocdcdyq3a8ltumukaznwyaic.png)
. The twelve factor app – Production. , , . – .
![](https://habrastorage.org/webt/y0/54/nq/y054nqmgwaqa6jpmmjhbsijlpbs.png)
, .
. . . , , , . – . . . . , . . , . . .
– . . , , , Graphite, StatsD. , , push based, . .
– , , . . , , .
![](https://habrastorage.org/webt/yr/qe/mj/yrqemjuzyhgwajv4aap6vfywpjg.png)
, , . , . Graphite, . . , 100 000 – . – , 100 000 . – . , 21 . , , , .
![](https://habrastorage.org/webt/sh/yb/ou/shybouejvgjip5mw2h541ujjqog.png)
production Zabbix - ? . – . . . Zabbix – , . . , .
, . , , Zabbix . Nagios . , , . . . , , - .
, , , . Zabbix . , , Redis. .
![](https://habrastorage.org/webt/so/6j/eb/so6jebkuz-ilzcdvvh0klxcgk90.png)
, , . InfluxDB . . Graphite, InfluxDB , , .
InfluxDB , . . production. . . , . . .
, . , , . . . (?) . . .
, , , . . . , . . , – . .
Riemann . : « CPU ». CPU – 100 %, 0 %. .
– , CollectD . , . InfluxDB. - , - , - , CollectD , . , , .
InfluxDB , time-series , .
![](https://habrastorage.org/webt/7r/ye/sa/7ryesagxun8rycojo42x3le7mey.png)
Prometheus. ?
Google, , , Google Borgmom, , Facebook. , , , . . .
, . . production ( , , , ) , . . Prometheus .
. . Prometheus , . .
, . deprecate- . Grafana. Grafana , .
, Prometheus . . . . , 20 000 – . 24- 400 000 . 3 , 1 200 000. .
production . - . , . . , - .
![](https://habrastorage.org/webt/03/2g/as/032gasmg852cvhsskkz-hpqaixk.png)
, , , . . . environment. server, . handler . . . Prometheus . , .
, , . , , , . . , . .
? . : « environment , ». .
. - , , . , , , – .
![](https://habrastorage.org/webt/nr/31/h6/nr31h6exrcvssnejmp-amakxvi0.png)
Prometheus , . . , .
. . , 4 . . , . Zookeeper, , … 95 % , 20 100 %. . – . . . , .
![](https://habrastorage.org/webt/af/rd/m0/afrdm0tt9toeetxr25oibn39cve.png)
- pull metrics push metrics. , pull metrics .
![](https://habrastorage.org/webt/a2/fq/35/a2fq35t9s18slpcg1fteosxvmpq.png)
StatsD – Graphite, . StatsD , . . .
, exporter . , , 50 000 . . , , production, .
StatsD exporter Prometheus . StatsD, StatsD, gauge etc, .
push gateway push’. Prometheus. StatsD, push gateway .
![](https://habrastorage.org/webt/zf/sd/wf/zfsdwftrem9uanlcuuto-g9rynm.png)
. , Prometheus, , . . . , , . . Amazon, Kubernetes, Mesos, Consul . . . , .
, Ansible, . . . - , , , . , Prometheus. reload , .
, . , , . javascript . , . .
![](https://habrastorage.org/webt/el/bm/-c/elbm-ciyxpvuvffurpi0mudwh5g.png)
. - .
Prometheus . . open source. , Postgres exporter – , . Node exporter, .
, . , . , . .
systemd. .
![](https://habrastorage.org/webt/-j/ig/lo/-jiglog_3-g12okswzs1vwg46p0.png)
, . , .
. , . . , , . , , . Prometheus . . . Influx, .
. .
![](https://habrastorage.org/webt/mf/m3/xi/mfm3xizjmwswg0poxpeqsbzcibg.png)
. , - , . , , . – –rm – r <storage path/*
. . . , , production. , , .
federation, , federation , .
. . . Prometheus . .
openTSDB . , . openTSDB , , , , Hadoop.
![](https://habrastorage.org/webt/bw/aq/xb/bwaqxbxiokunqutnrc4uvm1nmbw.png)
, , , , histogram summary. , .
, , 100 – . 100 300 – . , 300 – . histogram. , … , , , . . . , histogram , . 10 , 10 . - . , recording rules. , , . , .
Summary – . Summary . Summary , . , , , . . , . , 99- , , . . , . .
summary . . . , .
-. . .
![](https://habrastorage.org/webt/vf/tg/vb/vftgvb5qhtjxzwnurnoikbxbxr8.png)
? ? , , , :
- . , , . . , latency , , . 99 % . , , - . . .
- .
- .
- .
- + .
![](https://habrastorage.org/webt/al/ab/do/alabdob5bmkqwszfy4z6gjb0xf8.png)
?
- . , . . 10 , 10 , 10 , . ( Service Discovery)
- , . Grafana . , . : « ». 10 . , . . , , .
- – , . . . . , , , , .
- – , , , , .
- , Prometheus . . , Prometheus docker. . . – . . .
! ! Zabbix. , . , . , , Zabbix. environment, ?
. – environment, . ( Kubernetes Service Discovery)
. ., , developer, ? . . environment?
.
environment?
environment. environment. environment. , environment, stable – environment. ( Kubernetes Service Discovery)
, . . . - , , . , - . . . , - , , . , ?
Zabbix production, , . , , , -. full time , . Zabbix, , , 3-4- . 3-4- , Zabbix – . .
, 3 Zabbix?
.
. . developers Prometheus?
.
? ?
.
. environment, - sender, Prometheus .
sender. Prometheus . API http’, . Consul, Prometheus , . .
. , , - Prometheus?
, . .
. docker’, , , , - , . overhead, . . . , ?
?
.
health handler, . , , . , , .
! ! 4 . StatsD, , , . StatsD, Influx’ Telegraf?
, StatsD, Influx.
Ok. , Grafana . , . Go, . , .
open source, .
GitHub , . . federation, ?
, . .
Ok. -?
, .
, . ? ?
. , . 100 000 . , 200 000-300 000. , , , , . Zabbix, . Influx , . . , queries .
?
?
, - , , .
, - . , . . .