Boa tarde, querido leitor! Este artigo surgiu de uma tentativa de analisar o monitoramento operacional a partir da análise. Será útil para você se:
- algo da lista a seguir é familiar: Grafana, InfluxDB, Prometheus, Zabbix ou outro sistema de monitoramento com idéias semelhantes;
- Você não é um especialista / profissional / intermediário em vários tipos de exibição de séries temporais e estatísticas (caso contrário, será muito chato para você);
- há um desejo de olhar para alguns aspectos "sob o microscópio".
Se você decidir que as condições acima são atendidas, seja bem-vindo ao gato.
![](https://habrastorage.org/webt/9w/uu/c1/9wuuc1scxsjf1xullgcft4difr4.png)
"Diga-me, por favor, para onde devo ir daqui?"
"Onde você quer ir?" - respondeu o gato.
"Eu não ligo ..." disse Alice.
"Então não importa para onde ir", disse o gato.
"... só para chegar a algum lugar", explicou Alice.
"Você com certeza vai a algum lugar", disse o gato. "Você apenas tem que ir o tempo suficiente."
Alice no país das maravilhas por Lewis Carroll
A jornada começa ...
. , , , , . , «?» . ? , ( , )! , .
, RFC1065:
…
3.2.3.3. Counter
This application-wide type represents a non-negative integer which
Rose & McCloghrie [Page 8]
RFC 1065 SMI August 1988
monotonically increases until it reaches a maximum value, when it
wraps around and starts increasing again from zero. This memo
specifies a maximum value of 2^32-1 (4294967295 decimal) for
counters.
3.2.3.4. Gauge
This application-wide type represents a non-negative integer, which
may increase or decrease, but which latches at a maximum value. This
memo specifies a maximum value of 2^32-1 (4294967295 decimal) for
gauges.
…
, , 1988- , : . - , , , Prometheus.
. — : , , . — - . - …
UI Grafana, , , - , $__interval, , , . — , 4k. , , — . , , .
, ( ) « » . :
![](https://habrastorage.org/webt/kk/mg/yu/kkmgyuoqorph2nj-0opslxtbah8.png)
, “Step count” 200 300 (, , . : 10 , :
, ! ( ) , , .
. ( Influx’, ):
![](https://habrastorage.org/webt/yb/bg/wc/ybbgwcxzsnwelzi7bvzveshh_do.png)
InfluxDB, , : An instantaneous rate of change is equivalent to a derivative ( ), . , , , , (average rate of change). . , , mean ( ), , . , «» , - . , , , , , .
«» : , last, ( InfluxQL, promql ). last . , . , , 00 . non_negative_derivative(first(...)) . , , — , — : ( ) .
![](https://habrastorage.org/webt/xc/fg/bf/xcfgbfuogb-kf1tnnnp5dt8_mpa.png)
, ? .
mean, InfluxDB : max, min, last, , , — stddev. prometheus min_over_time, max_over_time, stddev_over_time, Influx ( , ). Last, , , , , mean: - , mean , «».
Obviamente, max e min funcionarão tão independentemente. Mas e se você combinar esses dois e adicionar a média a eles? Acontece que essa idéia não é algo novo, geralmente é antiga, como pirâmides. Dos exemplos "clássicos" de sistemas de monitoramento, lembro-me das tendências no Zabbix (procurei intencionalmente um link para uma versão mais antiga) e no Graphite Whisper Rollup , bem como no RRDtool anterior , que também era usado no Cacti , onde, por algum motivo, min estava ausente por padrão. Talvez, apesar de todo o texto a seguir, essa seja uma das melhores abordagens. É bastante informativo, não muito barulhento, intuitivo, barato na implementação, relativamente universal e disponível em quase todos os sistemas modernos.
Exemplos de renderização semelhante:- no zabbix
![](https://habrastorage.org/webt/2w/7s/hx/2w7shxl3bm1we8qltfxxacfu-rq.png)
- Grafana
![](https://habrastorage.org/webt/3c/dx/e9/3cdxe9v3rhvqhvhfzumwwlggxig.png)
, min mean ( max avg) , , Grafana Legend -> Values , , , .
«»
, , stddev — standard deviation, - . , , . , , «» . , (, , , , ).
, : error bar. — “ ”, 1-, 2- 3- (25% , 75% ). , ? :) , , Grafana. , pandas seaborn ( plotly).
![](https://habrastorage.org/webt/00/zc/zv/00zczv5q_wmqhw-u1iysl-s8r0y.png)
, , « » , , . “the Datasaurus Dozen animation” Google.
![](https://habrastorage.org/webt/qp/se/w_/qpsew_hk5pq5xartzejihmoie0c.gif)
, , , . , , , .
, « » . ? seaborn! , : violinplot. , « » « -» , , - , : violinplot Grafana.
: , , ? , ? ? , ? - .
, , . : Google SRE book. « » (, , ): latency, traffic, errors, saturation. , - ( ), . : saturation % 100, : 100, «» , 0 — , , , . , , — , .
, : . , , , /. (, , ): pull push. , . , , , push — Riemann-tools, pull — Prometheus.
Telegraf, (input-plugins) , (output-plugins) . , discovery-plugins— input-plugins, . , , LLD (low-level discovery) Zabbix, . «»: ( ). (, prometheus-operator), , . , , … Kubernetes, — Influxdata. - ( API/RPC) snap, , , ( , ).
, pull- -, . , . , , , . . , : (, Riemann ). . , , , , (, - ). Graphite / statsd, , , UI. Prometheus recording rules Thanos Compact, TICK- , , : Continues Queries InfluxDB TICKscript Kapacitor. , , — , Histogram Summary Prometheus, Accumulator interface Telegraf.
B , , , , :
![](https://habrastorage.org/webt/y5/xq/h_/y5xqh_6hncbttyz_9uroipvrcf0.png)
, UI, . : , , , UI-preprocessing. , . , «» UI-preprocessing UI, , . , , / — .
« » , 3- , , . , , .
, , : Prometheus, Telegraf . , , heatmap ( ), Grafana. , « », .
Grafana
![](https://habrastorage.org/webt/il/ad/kt/iladktmpvehizvbrmjgzisr1fz0.png)
, Grafana heatmap time series buckets, , , CPU :
![](https://habrastorage.org/webt/rt/rs/hi/rtrshins_e1qd5wdbw_4vxz8hdk.png)
, :
- :
;
latency, traffic, errors saturation. - , .
- ( ), , , .
- . - Grafana ( UI ), , , , - Python JS.
Grafana ) UI; ) ; ) .
— , : , , .
![](https://habrastorage.org/webt/st/k7/hr/stk7hrxq18b_u40cpu3bvrngmpw.png)
, , , . . latency .