Share
Embed
Мониторинг и Kubernetes
Доклад технического директора компании «Флант» (http://flant.ru/) Дмитрия Столярова на RootConf 2018 (фестиваль РИТ++) про мониторинг кластеров Kubernetes с использованием Prometheus.
* Текстовый обзор доклада: https://habr.com/company/flant/blog/412901/
* Видео с выступления: https://youtu.be/zj6SlzzBRaA
* Анонс доклада на сайте конференции: http://rootconf.ru/moscow-rit/2018/abstracts/3507
flant
May 28, 2018
Transcript
344 slides
-
20 + 20 + 40 + 80 + 50 +
40 + 0 + 10 + 40 + 10 + 20 = 30 км/ч 11 Средняя скорость: -
20 + 20 + 40 + 80 + 50 +
40 + 0 + 10 + 40 + 10 + 20 = 30 км/ч 11 Средняя скорость: 30 км/ч × 11 минут = 5.5 км 60 Расстояние: -
20 + 20 + 40 + 80 + 50 +
40 + 0 + 10 + 40 + 10 + 20 = 30 км/ч 11 Средняя скорость: 30 км/ч × 11 минут = 5.5 км 60 Расстояние: Но как? По одометру же 7.2 км... -
Что такое мониторинг? Упреждение аварий Уведомление об аварии Быстрая диагностика
Точные данные Полезные графики -
Что такое мониторинг? Упреждение аварий Уведомление об аварии Быстрая диагностика
Точные данные Полезные графики Актуальные алерты -
Что такое мониторинг? Упреждение аварий Уведомление об аварии Быстрая диагностика
Система мониторинга Точные данные Полезные графики Актуальные алерты -
дни / недели часы / дни секунды минуты / часы
Железо Виртуалки x5 -
дни / недели часы / дни секунды минуты / часы
0 0 Железо Виртуалки Kubernetes x5 x50 -
Kubernetes Nodes ns/staging ns/production ... deploy/frontend deploy/backend deploy/redis ns/testing Redis
node-3: master link down for more than 60 seconds. -
Kubernetes Nodes ns/staging ns/production ... deploy/frontend deploy/backend deploy/redis ns/testing Redis
node-3: master link down for more than 60 seconds. Redis 10.14.26.82: master link down for more than 60 seconds. -
Kubernetes Nodes ns/staging ns/production ... deploy/frontend deploy/backend deploy/redis ns/testing Redis
node-3: master link down for more than 60 seconds. Redis 10.14.26.82: master link down for more than 60 seconds. Redis k8s_POD_redis-redis-1453984535-9xz kj_production_e58492f3-02b9-11e8-8dd2-90 1b0ebb25f4_1 (on node node-3): master link down for more than 60 seconds. -
55.7558, 37.6173 + 24 Пасмурно 7 м/c 53.1356, 32.5412 +
30 Солнечно 2 м/c 59.0531, 33.9861 + 22 Пасмурно 5 м/c 53.1234, 35.9074 + 15 Гроза 23 м/c 50.8461, 37.3451 + 20 Пасмурно 15 м/c -
Kubernetes Nodes ns/staging ns/production ... deploy/frontend deploy/backend deploy/redis ns/testing Redis
node-3: master link down for more than 60 seconds. Redis 10.14.26.82: master link down for more than 60 seconds. Redis k8s_POD_redis-redis-1453984535-9xz kj_production_e58492f3-02b9-11e8-8dd2-90 1b0ebb25f4_1 (on node node-3): master link down for more than 60 seconds. -
Kubernetes Nodes ns/staging ns/production ... deploy/frontend deploy/backend deploy/redis ns/testing Redis
node-3: master link down for more than 60 seconds. Redis 10.14.26.82: master link down for more than 60 seconds. Redis production/redis (pod redis-145398 4535-9xzkj on node-3): master link down for more than 60 seconds. Redis k8s_POD_redis-redis-1453984535-9xz kj_production_e58492f3-02b9-11e8-8dd2-90 1b0ebb25f4_1 (on node node-3): master link down for more than 60 seconds. -
Kubernetes Nodes ns/staging ns/production ... deploy/frontend deploy/backend deploy/redis ns/testing Redis
node-3: master link down for more than 60 seconds. Redis 10.14.26.82: master link down for more than 60 seconds. Redis k8s_POD_redis-redis-1453984535-9xz kj_production_e58492f3-02b9-11e8-8dd2-90 1b0ebb25f4_1 (on node node-3): master link down for more than 60 seconds. Redis production/redis (pod redis-145398 4535-9xzkj on node-3): master link down for more than 60 seconds. -
Kubernetes Nodes ns/staging ns/production ... deploy/frontend deploy/backend deploy/redis ns/testing Redis
node-3: master link down for more than 60 seconds. Redis 10.14.26.82: master link down for more than 60 seconds. Redis k8s_POD_redis-redis-1453984535-9xz kj_production_e58492f3-02b9-11e8-8dd2-90 1b0ebb25f4_1 (on node node-3): master link down for more than 60 seconds. Redis production/redis (pod redis-145398 4535-9xzkj on node-3): master link down for more than 60 seconds. -
Нужно группировать Service Discovery стал обязательным Объем данных вырос Текучка
метаданных Использовать встроенные примитивы -
Нужно группировать Service Discovery стал обязательным Объем данных вырос Текучка
метаданных Использовать встроенные примитивы Помнить, что “реальности” больше одной -
Нужно группировать Service Discovery стал обязательным Объем данных вырос Текучка
метаданных Использовать встроенные примитивы Помнить, что “реальности” больше одной В одном кластере много окружений -
Почему ? Самые популярные утилиты/сервисы для мониторинга кластеров Kubernetes Процентное
соотношение опрошенных (включая тех, кто использует несколько утилит) Источник: результаты опроса «The New Stack 2017 Kubernetes User Experience» Заданный вопрос: «Какие инструменты, продукты и сервисы вы используете для мониторинга кластеров Kubernetes?». Количество ответивших: 208. -
Почему ? Самые популярные утилиты/сервисы для мониторинга кластеров Kubernetes Процентное
соотношение опрошенных (включая тех, кто использует несколько утилит) Источник: результаты опроса «The New Stack 2017 Kubernetes User Experience» Заданный вопрос: «Какие инструменты, продукты и сервисы вы используете для мониторинга кластеров Kubernetes?». Количество ответивших: 208. -
Почему ? Источник: результаты опроса «The New Stack 2017 Kubernetes
User Experience» Заданный вопрос: «Какие инструменты, продукты и сервисы вы используете для мониторинга кластеров Kubernetes?». Количество ответивших: 208. Процентное соотношение опрошенных (включая тех, кто использует несколько утилит) Самые популярные утилиты/сервисы для мониторинга кластеров Kubernetes -
Почему ? Источник: результаты опроса «The New Stack 2017 Kubernetes
User Experience» Заданный вопрос: «Какие инструменты, продукты и сервисы вы используете для мониторинга кластеров Kubernetes?». Количество ответивших: 208. Процентное соотношение опрошенных (включая тех, кто использует несколько утилит) Самые популярные утилиты/сервисы для мониторинга кластеров Kubernetes -
Почему ? Самые популярные утилиты/сервисы для мониторинга кластеров Kubernetes Процентное
соотношение опрошенных (включая тех, кто использует несколько утилит) Источник: результаты опроса «The New Stack 2017 Kubernetes User Experience» Заданный вопрос: «Какие инструменты, продукты и сервисы вы используете для мониторинга кластеров Kubernetes?». Количество ответивших: 208. -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c -
Target #1 Target #2 Target #3 Targets 60 sec 60
sec 60 sec foo=a foo=b foo=c Collector my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... -
Target #1 Target #2 Target #3 Targets 60 sec 60
sec 60 sec foo=a foo=b foo=c my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 Collector Название метрики Лейблы Значение -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c TSDB -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c TSDB -
Target #1 Target #2 Target #3 Targets 60 sec 60
sec 60 sec foo=a foo=b foo=c Collector TSDB -
Target #1 Target #2 Target #3 Targets 60 sec 60
sec 60 sec foo=a foo=b foo=c my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... Collector TSDB -
Target #1 Target #2 Target #3 Targets 60 sec 60
sec 60 sec foo=a foo=b foo=c my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... … T1 my_metric{label=”a”, foo=”a”} 1 my_metric{label=”b”, foo=”a”} 6 my_metric{label=”c”, foo=”a”} 42 … Collector TSDB -
Target #2 Target #3 Targets 60 sec 60 sec foo=b
foo=c Target #1 60 sec foo=a my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... … T1 my_metric{label=”a”, foo=”a”} 1 my_metric{label=”b”, foo=”a”} 6 my_metric{label=”c”, foo=”a”} 42 … Collector TSDB -
Target #2 Target #3 Targets 60 sec 60 sec foo=b
foo=c my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... … T1 my_metric{label=”a”, foo=”a”} 1 my_metric{label=”b”, foo=”a”} 6 my_metric{label=”c”, foo=”a”} 42 … Collector Target #1 60 sec foo=a TSDB -
Target #2 Target #3 Targets 60 sec 60 sec foo=b
foo=c my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... Collector Target #1 60 sec foo=a … T1 my_metric{label=”a”, foo=”a”} 1 my_metric{label=”b”, foo=”a”} 6 my_metric{label=”c”, foo=”a”} 42 … TSDB -
Target #2 Target #3 Targets 60 sec 60 sec foo=b
foo=c my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... Collector Target #1 60 sec foo=a … T1 my_metric{label=”a”, foo=”a”} 1 my_metric{label=”b”, foo=”a”} 6 my_metric{label=”c”, foo=”a”} 42 … TSDB my_metric{label=”a”} 4 my_metric{label=”b”} 8 my_metric{label=”c”} 13 ... -
Target #2 Target #3 Targets 60 sec 60 sec foo=b
foo=c my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... … T1 T2 my_metric{label=”a”, foo=”a”} 1 4 my_metric{label=”b”, foo=”a”} 6 8 my_metric{label=”c”, foo=”a”} 42 13 … Collector Target #1 60 sec foo=a TSDB my_metric{label=”a”} 4 my_metric{label=”b”} 8 my_metric{label=”c”} 13 ... -
Target #2 Target #3 Targets 60 sec 60 sec foo=b
foo=c my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... Collector … T1 T2 T3 my_metric{label=”a”, foo=”a”} 1 4 7 my_metric{label=”b”, foo=”a”} 6 8 2 my_metric{label=”c”, foo=”a”} 42 13 24 … Target #1 60 sec foo=a TSDB my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... my_metric{label=”a”} 7 my_metric{label=”b”} 2 my_metric{label=”c”} 24 ... -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c TSDB -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c TSDB -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c TSDB -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c TSDB -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c TSDB -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c TSDB -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c TSDB -
Target #2 Target #3 Targets 60 sec 60 sec foo=b
foo=c Collector Target #1 60 sec foo=a TSDB -
Target #2 Target #3 Targets 60 sec 60 sec foo=b
foo=c Collector Target #1 60 sec foo=a ... ... ... TSDB Time based retention -
Target #2 Target #3 Targets 60 sec 60 sec foo=b
foo=c Collector Target #1 60 sec foo=a ... ... ... TSDB Time based retention 1-2 bytes per sample -
Target #2 Target #3 Targets 60 sec 60 sec foo=b
foo=c Collector Target #1 60 sec foo=a ... ... ... TSDB Time based retention 1-2 bytes per sample Хорошо переносит “Series Churn” -
Target #2 Target #3 Targets 60 sec 60 sec foo=b
foo=c Collector Target #1 60 sec foo=a ... ... ... TSDB Time based retention 1-2 bytes per sample Хорошо переносит “Series Churn” Только локально, никакой кластеризации и репликации! -
Target #2 Target #3 Targets 60 sec 60 sec foo=b
foo=c Collector Target #1 60 sec foo=a ... ... ... TSDB Time based retention 1-2 bytes per sample Хорошо переносит “Series Churn” Только локально, никакой кластеризации и репликации! Ultra IOPS-effective -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c TSDB -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c Service Discovery TSDB -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c Service Discovery API TSDB -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c Service Discovery API TSDB -
Targets Target #1 Target #2 Target #3 60 sec 60
sec 60 sec foo=a foo=b foo=c -
http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics Targets 30 sec 30 sec 30 sec
namespace=production namespace=production namespace=production -
http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics Targets 30 sec 30 sec 30 sec
namespace=production namespace=production namespace=production service=redis service=redis service=redis -
http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics Targets 30 sec 30 sec 30 sec
namespace=production namespace=production namespace=production service=redis pod=redis-84f78f6b56-qmm66 service=redis pod=redis-84f78f6b56-zqh2q service=redis pod=redis-84f78f6b56-s44hj -
http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics Targets 30 sec 30 sec 30 sec
namespace=production namespace=production namespace=production service=redis pod=redis-84f78f6b56-qmm66 service=redis pod=redis-84f78f6b56-zqh2q service=redis pod=redis-84f78f6b56-s44hj -
Targets Targets http://192.168.13.11:9121/metrics 30 sec namespace=production service=redis-cache pod=redis-7cd9d8dd49-2rgp8 http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics
http://192.168.13.27:9121/metrics 30 sec 30 sec 30 sec namespace=production namespace=production namespace=production service=redis pod=redis-84f78f6b56-qmm66 service=redis pod=redis-84f78f6b56-zqh2q service=redis pod=redis-84f78f6b56-s44hj -
Targets Targets http://192.168.13.11:9121/metrics 30 sec http://192.168.12.44:9121/metrics 30 sec namespace=production service=redis-cache
pod=redis-7cd9d8dd49-2rgp8 namespace=staging pod=redis-79996bb447-jnqc6 service=redis http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics 30 sec 30 sec 30 sec namespace=production namespace=production namespace=production service=redis pod=redis-84f78f6b56-qmm66 service=redis pod=redis-84f78f6b56-zqh2q service=redis pod=redis-84f78f6b56-s44hj -
http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics Targets 30 sec 30 sec 30 sec
YAML Конфиг namespace=production namespace=production namespace=production service=redis pod=redis-84f78f6b56-qmm66 service=redis pod=redis-84f78f6b56-zqh2q service=redis pod=redis-84f78f6b56-s44hj http://192.168.13.11:9121/metrics 30 sec namespace=production service=redis pod=redis-7cd9d8dd49-2rgp8 http://192.168.13.12:9121/metrics 30 sec namespace=production service=redis pod=redis-79996bb447-jnqc6 -
http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics Targets 30 sec 30 sec 30 sec
scrape_configs: ... Конфиг namespace=production namespace=production namespace=production service=redis pod=redis-84f78f6b56-qmm66 service=redis pod=redis-84f78f6b56-zqh2q service=redis pod=redis-84f78f6b56-s44hj http://192.168.13.11:9121/metrics 30 sec namespace=production service=redis pod=redis-7cd9d8dd49-2rgp8 http://192.168.13.12:9121/metrics 30 sec namespace=production service=redis pod=redis-79996bb447-jnqc6 -
http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics Targets 30 sec 30 sec 30 sec
scrape_configs: - job_name: redis ... Конфиг namespace=production namespace=production namespace=production service=redis pod=redis-84f78f6b56-qmm66 service=redis pod=redis-84f78f6b56-zqh2q service=redis pod=redis-84f78f6b56-s44hj http://192.168.13.11:9121/metrics 30 sec namespace=production service=redis pod=redis-7cd9d8dd49-2rgp8 http://192.168.13.12:9121/metrics 30 sec namespace=production service=redis pod=redis-79996bb447-jnqc6 -
http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics Targets 30 sec 30 sec 30 sec
scrape_configs: - job_name: redis ..................... ..................... ..................... ..................... ..................... ..................... ..................... Конфиг namespace=production namespace=production namespace=production service=redis pod=redis-84f78f6b56-qmm66 service=redis pod=redis-84f78f6b56-zqh2q service=redis pod=redis-84f78f6b56-s44hj http://192.168.13.11:9121/metrics 30 sec namespace=production service=redis pod=redis-7cd9d8dd49-2rgp8 http://192.168.13.12:9121/metrics 30 sec namespace=production service=redis pod=redis-79996bb447-jnqc6 -
http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics Targets 30 sec 30 sec 30 sec
scrape_configs: - job_name: redis ..................... ..................... ..................... ..................... ..................... ..................... ..................... Конфиг 1. Как подключиться к Kubernetes? namespace=production namespace=production namespace=production service=redis pod=redis-84f78f6b56-qmm66 service=redis pod=redis-84f78f6b56-zqh2q service=redis pod=redis-84f78f6b56-s44hj http://192.168.13.11:9121/metrics 30 sec namespace=production service=redis pod=redis-7cd9d8dd49-2rgp8 http://192.168.13.12:9121/metrics 30 sec namespace=production service=redis pod=redis-79996bb447-jnqc6 -
http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics Targets 30 sec 30 sec 30 sec
scrape_configs: - job_name: redis ..................... ..................... ..................... ..................... ..................... ..................... ..................... Конфиг 1. Как подключиться к Kubernetes? 2. Какие объекты получать? namespace=production namespace=production namespace=production service=redis pod=redis-84f78f6b56-qmm66 service=redis pod=redis-84f78f6b56-zqh2q service=redis pod=redis-84f78f6b56-s44hj http://192.168.13.11:9121/metrics 30 sec namespace=production service=redis pod=redis-7cd9d8dd49-2rgp8 http://192.168.13.12:9121/metrics 30 sec namespace=production service=redis pod=redis-79996bb447-jnqc6 -
http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics Targets 30 sec 30 sec 30 sec
scrape_configs: - job_name: redis ..................... ..................... ..................... ..................... ..................... ..................... ..................... Конфиг 1. Как подключиться к Kubernetes? 2. Какие объекты получать? 3. Как их отфильтровывать? namespace=production namespace=production namespace=production service=redis pod=redis-84f78f6b56-qmm66 service=redis pod=redis-84f78f6b56-zqh2q service=redis pod=redis-84f78f6b56-s44hj http://192.168.13.11:9121/metrics 30 sec namespace=production service=redis pod=redis-7cd9d8dd49-2rgp8 http://192.168.13.12:9121/metrics 30 sec namespace=production service=redis pod=redis-79996bb447-jnqc6 -
http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics Targets 30 sec 30 sec 30 sec
scrape_configs: - job_name: redis ..................... ..................... ..................... ..................... ..................... ..................... ..................... Конфиг 1. Как подключиться к Kubernetes? 2. Какие объекты получать? 3. Как их отфильтровывать? 4. Какие лейблы “вытаскивать”? namespace=production namespace=production namespace=production service=redis pod=redis-84f78f6b56-qmm66 service=redis pod=redis-84f78f6b56-zqh2q service=redis pod=redis-84f78f6b56-s44hj http://192.168.13.11:9121/metrics 30 sec namespace=production service=redis pod=redis-7cd9d8dd49-2rgp8 http://192.168.13.12:9121/metrics 30 sec namespace=production service=redis pod=redis-79996bb447-jnqc6 -
scrape_configs: - job_name: redis ..................... ..................... ..................... ..................... ..................... .....................
..................... Конфиг 1. Как подключиться к Kubernetes? 2. Какие объекты получать? 3. Как их отфильтровывать? 4. Какие лейблы “вытаскивать”? kind: Service apiVersion: v1 metadata: name: redis namespace: production spec: selector: app: redis ports: - protocol: TCP port: 6379 Kubernetes -
scrape_configs: - job_name: redis ..................... ..................... ..................... ..................... ..................... .....................
..................... Конфиг 1. Как подключиться к Kubernetes? 2. Какие объекты получать? 3. Как их отфильтровывать? 4. Какие лейблы “вытаскивать”? kind: Service apiVersion: v1 metadata: name: redis namespace: production spec: selector: app: redis ports: - protocol: TCP port: 6379 Kubernetes -
scrape_configs: - job_name: redis ..................... ..................... ..................... ..................... ..................... .....................
..................... Конфиг 1. Как подключиться к Kubernetes? 2. Какие объекты получать? 3. Как их отфильтровывать? 4. Какие лейблы “вытаскивать”? kind: Service apiVersion: v1 metadata: name: redis namespace: production spec: selector: app: redis ports: - protocol: TCP port: 6379 Kubernetes -
scrape_configs: - job_name: redis ..................... ..................... ..................... ..................... ..................... .....................
..................... Конфиг 1. Как подключиться к Kubernetes? 2. Какие объекты получать? 3. Как их отфильтровывать? 4. Какие лейблы “вытаскивать”? kind: Service apiVersion: v1 metadata: name: redis namespace: production spec: selector: app: redis ports: - protocol: TCP port: 6379 Kubernetes -
scrape_configs: - job_name: redis ..................... ..................... ..................... ..................... ..................... .....................
..................... Конфиг 1. Как подключиться к Kubernetes? 2. Какие объекты получать? 3. Как их отфильтровывать? 4. Какие лейблы “вытаскивать”? kind: Service apiVersion: v1 metadata: name: redis namespace: production labels: prometheus-target: redis spec: selector: app: redis ports: - protocol: TCP port: 6379 Kubernetes -
scrape_configs: - job_name: redis ..................... ..................... ..................... ..................... ..................... .....................
..................... Конфиг 1. Как подключиться к Kubernetes? 2. Какие объекты получать? 3. Как их отфильтровывать? 4. Какие лейблы “вытаскивать”? kind: Service apiVersion: v1 metadata: name: redis namespace: production labels: prometheus-target: redis spec: selector: app: redis ports: - protocol: TCP port: 6379 - protocol: TCP port: 9121 name: http-metrics Kubernetes -
scrape_configs: - job_name: redis ..................... ..................... ..................... ..................... ..................... .....................
..................... Конфиг 1. Как подключиться к Kubernetes? 2. Какие объекты получать? 3. Как их отфильтровывать? 4. Какие лейблы “вытаскивать”? kind: Service apiVersion: v1 metadata: name: redis namespace: production labels: prometheus-target: redis spec: selector: app: redis ports: - protocol: TCP port: 6379 - protocol: TCP port: 9121 name: http-metrics Kubernetes -
scrape_configs: - job_name: redis ..................... ..................... ..................... ..................... ..................... .....................
..................... Конфиг http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics 30 sec 30 sec 30 sec namespace=production namespace=production namespace=production service=redis pod=redis-84f78f6b56-qmm66 service=redis pod=redis-84f78f6b56-zqh2q service=redis pod=redis-84f78f6b56-s44hj http://192.168.13.11:9121/metrics 30 sec namespace=production service=redis pod=redis-7cd9d8dd49-2rgp8 http://192.168.13.12:9121/metrics 30 sec namespace=production service=redis pod=redis-79996bb447-jnqc6 1. Как подключиться к Kubernetes? 2. Какие объекты получать? 3. Как их отфильтровывать? 4. Какие лейблы “вытаскивать”? -
scrape_configs: - job_name: redis ..................... ..................... ..................... ..................... ..................... .....................
..................... Конфиг http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics Targets 30 sec 30 sec 30 sec namespace=production namespace=production namespace=production service=redis pod=redis-84f78f6b56-qmm66 service=redis pod=redis-84f78f6b56-zqh2q service=redis pod=redis-84f78f6b56-s44hj http://192.168.13.11:9121/metrics 30 sec namespace=production service=redis pod=redis-7cd9d8dd49-2rgp8 http://192.168.13.12:9121/metrics 30 sec namespace=production service=redis pod=redis-79996bb447-jnqc6 -
scrape_configs: - job_name: redis ..................... ..................... ..................... ..................... ..................... .....................
..................... Конфиг http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics Targets 30 sec 30 sec 30 sec namespace=production namespace=production namespace=production service=redis pod=redis-84f78f6b56-qmm66 service=redis pod=redis-84f78f6b56-zqh2q service=redis pod=redis-84f78f6b56-s44hj http://192.168.13.11:9121/metrics 30 sec namespace=production service=redis pod=redis-7cd9d8dd49-2rgp8 http://192.168.13.12:9121/metrics 30 sec namespace=production service=redis pod=redis-79996bb447-jnqc6 -
scrape_configs: - job_name: redis ..................... ..................... ..................... ..................... ..................... .....................
..................... Конфиг http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics Targets 30 sec 30 sec 30 sec redis namespace=production namespace=production namespace=production service=redis pod=redis-84f78f6b56-qmm66 service=redis pod=redis-84f78f6b56-zqh2q service=redis pod=redis-84f78f6b56-s44hj http://192.168.13.11:9121/metrics 30 sec namespace=production service=redis pod=redis-7cd9d8dd49-2rgp8 http://192.168.13.12:9121/metrics 30 sec namespace=production service=redis pod=redis-79996bb447-jnqc6 -
http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics Targets 30 sec 30 sec 30 sec
redis namespace=production namespace=production namespace=production service=redis pod=redis-84f78f6b56-qmm66 service=redis pod=redis-84f78f6b56-zqh2q service=redis pod=redis-84f78f6b56-s44hj scrape_configs: - job_name: redis ... - job_name: php-fpm ... - job_name: mysql ... Конфиг http://192.168.13.11:9121/metrics 30 sec namespace=production service=redis pod=redis-7cd9d8dd49-2rgp8 http://192.168.13.12:9121/metrics 30 sec namespace=production service=redis pod=redis-79996bb447-jnqc6 -
http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics Targets 30 sec 30 sec 30 sec
redis namespace=production namespace=production namespace=production service=redis pod=redis-84f78f6b56-qmm66 service=redis pod=redis-84f78f6b56-zqh2q service=redis pod=redis-84f78f6b56-s44hj scrape_configs: - job_name: redis ... - job_name: php-fpm ... - job_name: mysql ... Конфиг -
http://192.168.12.83:9121/metrics http://192.168.18.19:9121/metrics http://192.168.13.27:9121/metrics Targets 30 sec 30 sec 30 sec
redis namespace=production namespace=production namespace=production service=redis pod=redis-84f78f6b56-qmm66 service=redis pod=redis-84f78f6b56-zqh2q service=redis pod=redis-84f78f6b56-s44hj scrape_configs: - job_name: redis ... - job_name: php-fpm ... - job_name: mysql ... Конфиг http://pod-ip:http-metrics/metrics 30 sec php-fpm namespace=production service=backend pod=backend-6b56d45859-gqnh9hj http://pod-ip:http-metrics/metrics 30 sec mysql namespace=staging service=mysql pod=mysql-5cf7d9cc67-h6r8d http://pod-ip:http-metrics/metrics 30 sec namespace=testing service=mysql pod=mysql-5566877785-fpszg -
Компоненты Kubernetes redis http://pod-ip 30 sec kube-apiserver node= redis http://pod-ip
30 sec kube-controller-manager node= redis http://pod-ip 30 sec kube-scheduler node= redis http://pod-ip 30 sec kube-etcd3 node= Kubernetes Master Kubernetes Софт Custom redis http://pod-ip 30 sec kube-etcd2 node= -
http://pod-ip 30 sec kubelet node= Kubernetes Master Kubernetes Софт Custom
Компоненты Kubernetes -
http://pod-ip 30 sec kubelet node= redis http://pod-ip 30 sec kube-state-metrics
Kubernetes Master Kubernetes Софт Custom Компоненты Kubernetes -
http://pod-ip 30 sec kubelet node= redis http://pod-ip 30 sec kube-state-metrics
redis http://pod-ip 30 sec node-exporter node= Kubernetes Master Kubernetes Софт Custom Компоненты Kubernetes -
http://pod-ip 30 sec kube-prometheus-operator http://pod-ip 30 sec kube-prometheus pod= redis
http://pod-ip 30 sec ingress-nginx-controller node= controller= Kubernetes Master Kubernetes Компоненты Kubernetes Софт Custom http://pod-ip 30 sec kube-dns pod= -
Kubernetes Master Kubernetes Компоненты Kubernetes Софт Custom redis http://pod-ip 30
sec elasticsearch http://pod-ip 30 sec mongodb http://pod-ip 30 sec nginx http://pod-ip 30 sec php-fpm http://pod-ip 30 sec rabbitmq http://pod-ip 30 sec redis redis http://pod-ip 30 sec uwsgi ns= svc= pod= ns= svc= pod= ns= svc= pod= ns= svc= pod= ns= svc= pod= ns= svc= pod= ns= svc= pod= -
Компоненты Kubernetes Kubernetes Master Kubernetes Софт Custom kind: Service apiVersion:
v1 metadata: name: backend namespace: production spec: selector: app: backend ports: - protocol: TCP port: 80 Kubernetes -
Компоненты Kubernetes Kubernetes Master Kubernetes Софт Custom kind: Service apiVersion:
v1 metadata: name: backend namespace: production spec: selector: app: backend ports: - protocol: TCP port: 80 Kubernetes -
Компоненты Kubernetes Kubernetes Master Kubernetes Софт Custom kind: Service apiVersion:
v1 metadata: name: backend namespace: production spec: selector: app: backend ports: - protocol: TCP port: 80 Kubernetes -
Компоненты Kubernetes Kubernetes Master Kubernetes Софт Custom kind: Service apiVersion:
v1 metadata: name: backend namespace: production label: prometheus-custom-target: backend spec: selector: app: backend ports: - protocol: TCP port: 80 name: http-metrics Kubernetes -
Компоненты Kubernetes Kubernetes Master Kubernetes Софт Custom kind: Service apiVersion:
v1 metadata: name: backend namespace: production label: prometheus-custom-target: backend spec: selector: app: backend ports: - protocol: TCP port: 80 name: http-metrics Kubernetes -
Компоненты Kubernetes Kubernetes Master Kubernetes Софт Custom kind: Service apiVersion:
v1 metadata: name: backend namespace: production label: prometheus-custom-target: backend spec: selector: app: backend ports: - protocol: TCP port: 80 name: http-metrics Kubernetes -
Компоненты Kubernetes Kubernetes Master Kubernetes Софт Custom redis http://pod-ip 30
sec custom-backend ns= svc= pod= -
Компоненты Kubernetes Kubernetes Master Kubernetes Софт Custom redis http://pod-ip 30
sec custom-backend http://pod-ip 30 sec custom-foo http://pod-ip 30 sec custom-bar ns= svc= pod= ns= svc= pod= ns= svc= pod= -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c Service Discovery API TSDB -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c Service Discovery API TSDB Графики -
Collector Target #1 Target #2 Target #3 Targets 60 sec
60 sec 60 sec foo=a foo=b foo=c Service Discovery API TSDB Графики PromQL -
PromQL Execute my_metric T1 T2 T3 T4 my_metric{label=”a”} 1 3
12 11 my_metric{label=”b”} 6 4 7 5 my_metric{label=”c”} 42 18 33 19 my_metric{label=”d”} 19 2 14 6 -
PromQL Execute my_metric 60 sec T1 T2 T3 T4 my_metric{label=”a”}
1 3 12 11 my_metric{label=”b”} 6 4 7 5 my_metric{label=”c”} 42 18 33 19 my_metric{label=”d”} 19 2 14 6 60 sec 60 sec 60 sec -
PromQL Execute my_metric{label=”a”} T1 T2 T3 T4 my_metric{label=”a”} 1 3
12 11 my_metric{label=”b”} 6 4 7 5 my_metric{label=”c”} 42 18 33 19 my_metric{label=”d”} 19 2 14 6 -
PromQL Execute my_metric{label=~”a|b”} T1 T2 T3 T4 my_metric{label=”a”} 1 3
12 11 my_metric{label=”b”} 6 4 7 5 -
PromQL Execute my_metric{label=~”a|b”} × 8 T1 T2 T3 T4 my_metric{label=”a”}
1 3 12 11 my_metric{label=”b”} 6 4 7 5 -
T1 T2 T3 T4 my_metric{label=”a”} 1 3 12 11 my_metric{label=”b”}
6 4 7 5 PromQL Execute my_metric{label=~”a|b”} × 8 -
T1 T2 T3 T4 my_metric{label=”a”} 1 3 12 11 my_metric{label=”b”}
6 4 7 5 ×8 PromQL Execute my_metric{label=~”a|b”} × 8 -
T1 T2 T3 T4 my_metric{label=”a”} 1 3 12 11 my_metric{label=”b”}
6 4 7 5 ×8 PromQL Execute my_metric{label=~”a|b”} × 8 T1 T2 T3 T4 my_metric{label=”a”} 1x8 3x8 12x8 11x8 my_metric{label=”b”} 6x8 4x8 7x8 5x8 -
T1 T2 T3 T4 my_metric{label=”a”} 1 3 12 11 my_metric{label=”b”}
6 4 7 5 ×8 PromQL Execute my_metric{label=~”a|b”} × 8 T1 T2 T3 T4 my_metric{label=”a”} 1x8 3x8 12x8 11x8 my_metric{label=”b”} 6x8 4x8 7x8 5x8 T1 T2 T3 T4 my_metric{label=”a”} 8 24 96 88 my_metric{label=”b”} 48 32 56 40 -
T1 T2 T3 T4 my_metric{label=”a”} 1 3 12 11 my_metric{label=”b”}
6 4 7 5 PromQL Execute my_metric{label=~”a|b”} > 4 >4 T1 T2 T3 T4 my_metric{label=”a”} 1>4 3>4 12>4 11>4 my_metric{label=”b”} 6>4 4>4 7>4 5>4 -
T1 T2 T3 T4 my_metric{label=”a”} 1 3 12 11 my_metric{label=”b”}
6 4 7 5 PromQL Execute my_metric{label=~”a|b”} > 4 >4 T1 T2 T3 T4 my_metric{label=”a”} 1>4 3>4 12>4 11>4 my_metric{label=”b”} 6>4 4>4 7>4 5>4 T1 T2 T3 T4 my_metric{label=”a”} nil nil 12 11 my_metric{label=”b”} 6 nil 7 5 -
T1 T2 T3 T4 my_metric{label=”a”} 1 3 12 11 my_metric{label=”b”}
6 4 7 5 PromQL Execute my_metric{label=~”a|b”} > 4 >4 T1 T2 T3 T4 my_metric{label=”a”} 1>4 3>4 12>4 11>4 my_metric{label=”b”} 6>4 4>4 7>4 5>4 T1 T2 T3 T4 my_metric{label=”a”} nil nil 12 11 my_metric{label=”b”} 6 nil 7 5 -
PromQL Execute http_requests_total{host=”bar.io”, status=”2xx”} T1 T2 T3 T4 {host=”bar.io”, status=”2xx”}
6 29 42 61 60 sec 60 sec 60 sec 60 sec -
PromQL Execute http_requests_total{host=”bar.io”, status=”2xx”}[2m] T1 T2 T3 T4 {host=”bar.io”, status=”2xx”}
6 29 42 61 60 sec 60 sec 60 sec 60 sec -
PromQL Execute http_requests_total{host=”bar.io”, status=”2xx”}[2m] T1 T2 T3 T4 {host=”bar.io”, status=”2xx”}
6 29 42 61 2 min 60 sec 60 sec 60 sec 60 sec -
2 min PromQL Execute http_requests_total{host=”bar.io”, status=”2xx”}[2m] T1 T2 T3 T4
{host=”bar.io”, status=”2xx”} 6 29 42 61 T1 T2 T3 T4 {host=”bar.io”, status=”2xx”} [42,61] 60 sec 60 sec 60 sec 60 sec -
2 min PromQL Execute http_requests_total{host=”bar.io”, status=”2xx”}[2m] T1 T2 T3 T4
{host=”bar.io”, status=”2xx”} 6 29 42 61 T1 T2 T3 T4 {host=”bar.io”, status=”2xx”} [29,42] [42,61] 60 sec 60 sec 60 sec 60 sec -
2 min PromQL Execute http_requests_total{host=”bar.io”, status=”2xx”}[2m] T1 T2 T3 T4
{host=”bar.io”, status=”2xx”} 6 29 42 61 T1 T2 T3 T4 {host=”bar.io”, status=”2xx”} [6,29] [29,42] [42,61] 60 sec 60 sec 60 sec 60 sec -
PromQL Execute http_requests_total{host=”bar.io”, status=”2xx”}[2m] T1 T2 T3 T4 {host=”bar.io”, status=”2xx”}
6 29 42 61 T1 T2 T3 T4 {host=”bar.io”, status=”2xx”} [nil,6] [6,29] [29,42] [42,61] 60 sec 60 sec 60 sec 60 sec 2 min -
PromQL Execute http_requests_total{host=”bar.io”, status=”2xx”}[2m] T1 T2 T3 T4 {host=”bar.io”, status=”2xx”}
6 29 42 61 T1 T2 T3 T4 {host=”bar.io”, status=”2xx”} [nil,6] [6,29] [29,42] [42,61] 60 sec 60 sec 60 sec 60 sec -
PromQL Execute http_requests_total{host=”bar.io”, status=”2xx”}[2m] T1 T2 T3 T4 {host=”bar.io”, status=”2xx”}
6 29 42 61 T1 T2 T3 T4 {host=”bar.io”, status=”2xx”} [nil,6] [6,29] [29,42] [42,61] Range vector -
PromQL Execute increase(http_requests_total{host=”bar.io”, status=”2xx”}[2m]) T1 T2 T3 T4 {host=”bar.io”, status=”2xx”}
6 29 42 61 T1 T2 T3 T4 {host=”bar.io”, status=”2xx”} [nil,6] [6,29] [29,42] [42,61] Range vector -
PromQL Execute increase(http_requests_total{host=”bar.io”, status=”2xx”}[2m]) T1 T2 T3 T4 {host=”bar.io”, status=”2xx”}
6 29 42 61 T1 T2 T3 T4 {host=”bar.io”, status=”2xx”} [nil,6] [6,29] [29,42] [42,61] T1 T2 T3 T4 {host=”bar.io”, status=”2xx”} nil 23 13 19 Range vector -
PromQL Execute http_requests_total T1 T2 T3 T4 {host=”foo.io”, status=”2xx”} 0
1 3 12 {host=”foo.io”, status=”4xx”} 0 0 1 1 {host=”bar.io”, status=”2xx”} 6 29 42 61 {host=”bar.io”, status=”3xx”} 1 2 4 7 {host=”baz.io”, status=”1xx”} 1 1 2 3 {host=”baz.io”, status=”2xx”} 0 3 7 9 {host=”baz.io”, status=”5xx”} 0 0 0 1 -
PromQL Execute increase(http_requests_total[2m]) T1 T2 T3 T4 {host=”foo.io”, status=”2xx”} nil
1 2 9 {host=”foo.io”, status=”4xx”} nil 0 1 0 {host=”bar.io”, status=”2xx”} nil 23 13 19 {host=”bar.io”, status=”3xx”} nil 1 2 3 {host=”baz.io”, status=”1xx”} nil 0 1 1 {host=”baz.io”, status=”2xx”} nil 3 4 2 {host=”baz.io”, status=”5xx”} nil 0 0 1 -
PromQL Execute sum(increase(http_requests_total[2m])) T1 T2 T3 T4 {host=”foo.io”, status=”2xx”} nil
1 2 9 {host=”foo.io”, status=”4xx”} nil 0 1 0 {host=”bar.io”, status=”2xx”} nil 23 13 19 {host=”bar.io”, status=”3xx”} nil 1 2 3 {host=”baz.io”, status=”1xx”} nil 0 1 1 {host=”baz.io”, status=”2xx”} nil 3 4 2 {host=”baz.io”, status=”5xx”} nil 0 0 1 -
T1 T2 T3 T4 {host=”foo.io”, status=”2xx”} nil 1 2 9
{host=”foo.io”, status=”4xx”} nil 0 1 0 {host=”bar.io”, status=”2xx”} nil 23 13 19 {host=”bar.io”, status=”3xx”} nil 1 2 3 {host=”baz.io”, status=”1xx”} nil 0 1 1 {host=”baz.io”, status=”2xx”} nil 3 4 2 {host=”baz.io”, status=”5xx”} nil 0 0 1 PromQL Execute sum(increase(http_requests_total[2m])) -
T1 T2 T3 T4 {host=”foo.io”, status=”2xx”} nil 1 2 9
{host=”foo.io”, status=”4xx”} nil 0 1 0 {host=”bar.io”, status=”2xx”} nil 23 13 19 {host=”bar.io”, status=”3xx”} nil 1 2 3 {host=”baz.io”, status=”1xx”} nil 0 1 1 {host=”baz.io”, status=”2xx”} nil 3 4 2 {host=”baz.io”, status=”5xx”} nil 0 0 1 PromQL Execute sum(increase(http_requests_total[2m])) T1 T2 T3 T4 {} nil 28 23 35 -
T1 T2 T3 T4 {host=”foo.io”, status=”2xx”} nil 1 2 9
{host=”foo.io”, status=”4xx”} nil 0 1 0 {host=”bar.io”, status=”2xx”} nil 23 13 19 {host=”bar.io”, status=”3xx”} nil 1 2 3 {host=”baz.io”, status=”1xx”} nil 0 1 1 {host=”baz.io”, status=”2xx”} nil 3 4 2 {host=”baz.io”, status=”5xx”} nil 0 0 1 PromQL Execute sum(increase(http_requests_total[2m])) T1 T2 T3 T4 {} nil 28 23 35 -
PromQL Execute sum(increase(http_requests_total[2m])) by (host) T1 T2 T3 T4 {host=”foo.io”}
nil 1 3 9 {host=”bar.io”} nil 24 15 22 {host=”baz.io”} nil 3 5 4 -
PromQL Execute sum(increase(http_requests_total[2m])) by (host) T1 T2 T3 T4 {host=”foo.io”}
nil 1 3 9 {host=”bar.io”} nil 24 15 22 {host=”baz.io”} nil 3 5 4 -
PromQL Execute sum(increase(http_requests_total[2m])) by (status) T1 T2 T3 T4 {status=”1xx”}
nil 0 1 1 {status=”2xx”} nil 27 19 30 {status=”3xx”} nil 1 2 3 {status=”4xx”} nil 0 1 0 {status=”5xx”} nil 0 0 1 -
PromQL Execute sum(increase(http_requests_total[2m])) by (status) T1 T2 T3 T4 {status=”1xx”}
nil 0 1 1 {status=”2xx”} nil 27 19 30 {status=”3xx”} nil 1 2 3 {status=”4xx”} nil 0 1 0 {status=”5xx”} nil 0 0 1 -
PromQL Execute http_bytes_sent_total T1 T2 T3 T4 {host=”foo.io”} 0 540
1928 5980 {host=”bar.io”} 3451 16368 24334 27608 {host=”baz.io”} 505 2308 4752 6552 -
PromQL Execute increase(http_bytes_sent_total[2m]) T1 T2 T3 T4 {host=”foo.io”} nil 540
1388 4052 {host=”bar.io”} nil 12917 7966 3274 {host=”baz.io”} nil 1803 2444 1800 -
PromQL Execute increase(http_bytes_sent_total[2m]) / sum(increase(http_requests_total[2m])) by (host) T1 T2 T3
T4 {host=”foo.io”} nil 540 1388 4052 {host=”bar.io”} nil 12917 7966 3274 {host=”baz.io”} nil 1803 2444 1800 -
PromQL Execute increase(http_bytes_sent_total[2m]) / sum(increase(http_requests_total[2m])) by (host) T1 T2 T3
T4 {host=”foo.io”} nil 540 1388 4052 {host=”bar.io”} nil 12917 7966 3274 {host=”baz.io”} nil 1803 2444 1800 T1 T2 T3 T4 {host=”foo.io”} nil 1 3 9 {host=”bar.io”} nil 24 15 22 {host=”baz.io”} nil 3 5 4 -
PromQL Execute increase(http_bytes_sent_total[2m]) / sum(increase(http_requests_total[2m])) by (host) T1 T2 T3
T4 {host=”foo.io”} nil 540 1388 4052 {host=”bar.io”} nil 12917 7966 3274 {host=”baz.io”} nil 1803 2444 1800 T1 T2 T3 T4 {host=”foo.io”} nil 1 3 9 {host=”bar.io”} nil 24 15 22 {host=”baz.io”} nil 3 5 4 ÷ -
PromQL Execute increase(http_bytes_sent_total[2m]) / sum(increase(http_requests_total[2m])) by (host) T1 T2 T3
T4 {host=”foo.io”} nil 540 1388 4052 {host=”bar.io”} nil 12917 7966 3274 {host=”baz.io”} nil 1803 2444 1800 T1 T2 T3 T4 {host=”foo.io”} nil 1 3 9 {host=”bar.io”} nil 24 15 22 {host=”baz.io”} nil 3 5 4 T1 T2 T3 T4 {host=”foo.io”} nil 540/1 {host=”bar.io”} nil {host=”baz.io”} nil = -
PromQL Execute increase(http_bytes_sent_total[2m]) / sum(increase(http_requests_total[2m])) by (host) T1 T2 T3
T4 {host=”foo.io”} nil 540 1388 4052 {host=”bar.io”} nil 12917 7966 3274 {host=”baz.io”} nil 1803 2444 1800 T1 T2 T3 T4 {host=”foo.io”} nil 1 3 9 {host=”bar.io”} nil 24 15 22 {host=”baz.io”} nil 3 5 4 T1 T2 T3 T4 {host=”foo.io”} nil 540/1 {host=”bar.io”} nil 12917/24 {host=”baz.io”} nil -
PromQL Execute increase(http_bytes_sent_total[2m]) / sum(increase(http_requests_total[2m])) by (host) T1 T2 T3
T4 {host=”foo.io”} nil 540 1388 4052 {host=”bar.io”} nil 12917 7966 3274 {host=”baz.io”} nil 1803 2444 1800 T1 T2 T3 T4 {host=”foo.io”} nil 1 3 9 {host=”bar.io”} nil 24 15 22 {host=”baz.io”} nil 3 5 4 T1 T2 T3 T4 {host=”foo.io”} nil 540/1 1388/3 4052/9 {host=”bar.io”} nil 12917/24 7966/15 3274/22 {host=”baz.io”} nil 1803/3 2444/5 1800/4 -
PromQL Execute metric_x + metric_y metric_x{host=”foo.io”} metric_x{host=”bar.io”} metric_x{host=”example.io”} metric_y{host=”foo.io”} metric_y{host=”bar.io”}
metric_y{host=”unknown.io”} {host=”foo.io”} {host=”bar.io”} -
Collector Target #1 Target #2 Target #3 Targets 30 sec
30 sec 30 sec foo=a foo=b foo=c Service Discovery API TSDB Графики -
Collector Target #1 Target #2 Target #3 Targets foo=a foo=b
foo=c Service Discovery API TSDB Графики Evaluator 30 sec 30 sec 30 sec -
Collector Target #1 Target #2 Target #3 Targets foo=a foo=b
foo=c Service Discovery API TSDB Графики Evaluator 30 sec 30 sec 30 sec -
Collector Target #1 Target #2 Target #3 Targets foo=a foo=b
foo=c Service Discovery API TSDB Графики Evaluator PromQL 30 sec 30 sec 30 sec -
Collector Target #1 Target #2 Target #3 Targets foo=a foo=b
foo=c Service Discovery API TSDB Графики Evaluator PromQL 30 sec 30 sec 30 sec 30 sec -
Collector Target #1 Target #2 Target #3 Targets foo=a foo=b
foo=c Service Discovery API TSDB Алерты Графики Alertmanager Evaluator PromQL 30 sec 30 sec 30 sec 30 sec -
Collector Target #1 Target #2 Target #3 Targets foo=a foo=b
30 sec 30 sec 30 sec foo=c Service Discovery API Графики TSDB Алерты Alertmanager Evaluator PromQL 30 sec -
Collector Target #1 Target #2 Target #3 Targets foo=a foo=b
foo=c Service Discovery API Графики 30 sec 30 sec 30 sec TSDB Алерты Alertmanager Evaluator PromQL alert: Http5xx expr: increase(http_requests_total{status=”5xx”}[2m]) for: 5m labels: severity: warning annotations: summary: host {{$labels.host}} has 5xx 30 sec -
Collector Target #1 Target #2 Target #3 Targets foo=a foo=b
foo=c Service Discovery API Графики 30 sec 30 sec 30 sec TSDB Алерты Alertmanager Evaluator PromQL alert: Http5xx expr: increase(http_requests_total{status=”5xx”}[2m]) for: 5m labels: severity: warning annotations: summary: host {{$labels.host}} has 5xx 30 sec -
Collector Target #1 Target #2 Target #3 Targets foo=a foo=b
foo=c Service Discovery API Графики 30 sec 30 sec 30 sec TSDB Алерты Alertmanager Evaluator PromQL alert: Http5xx expr: increase(http_requests_total{status=”5xx”}[2m]) for: 5m labels: severity: warning annotations: summary: host {{$labels.host}} has 5xx 30 sec -
Collector Target #1 Target #2 Target #3 Targets foo=a foo=b
foo=c Service Discovery API Графики 30 sec 30 sec 30 sec TSDB Алерты Alertmanager Evaluator PromQL alert: Http5xx expr: increase(http_requests_total{status=”5xx”}[2m]) for: 5m labels: severity: warning annotations: summary: host {{$labels.host}} has 5xx 30 sec -
Collector Target #1 Target #2 Target #3 Targets foo=a foo=b
foo=c Service Discovery API Графики 30 sec 30 sec 30 sec TSDB Алерты Alertmanager Evaluator PromQL alert: Http5xx expr: increase(http_requests_total{status=”5xx”}[2m]) for: 5m labels: severity: warning annotations: summary: host {{$labels.host}} has 5xx 30 sec -
Collector Target #1 Target #2 Target #3 Targets foo=a foo=b
foo=c Service Discovery API TSDB Алерты Графики Alertmanager Evaluator 30 sec 30 sec 30 sec -
my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... my_metric{label=”a”, foo=”a”} my_metric{label=”b”,
foo=”a”} my_metric{label=”c”, foo=”a”} … aT1 1 6 42 -
my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... my_metric{label=”a”, foo=”a”} my_metric{label=”b”,
foo=”a”} my_metric{label=”c”, foo=”a”} … other_metric{x=”a”} 22 other_metric{x=”b”} 17 other_metric{x=”c”} 8 ... aT1 1 6 42 -
my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... my_metric{label=”a”, foo=”a”} my_metric{label=”b”,
foo=”a”} my_metric{label=”c”, foo=”a”} … other_metric{label=”a”, foo=”b”} other_metric{label=”b”, foo=”b”} other_metric{label=”c”, foo=”b”} other_metric{x=”a”} 22 other_metric{x=”b”} 17 other_metric{x=”c”} 8 ... aT1 1 6 42 bT1 22 17 8 -
my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... my_metric{label=”a”, foo=”a”} my_metric{label=”b”,
foo=”a”} my_metric{label=”c”, foo=”a”} … other_metric{label=”a”, foo=”b”} other_metric{label=”b”, foo=”b”} other_metric{label=”c”, foo=”b”} … my_metric{label=”b”, foo=”c”} my_metric{label=”c”, foo=”c”} my_metric{label=”d”, foo=”c”} … other_metric{x=”a”} 22 other_metric{x=”b”} 17 other_metric{x=”c”} 8 ... aT1 1 6 42 bT1 22 17 8 cT1 12 3 7 my_metric{label=”b”} 12 my_metric{label=”c”} 3 my_metric{label=”d”} 7 ... -
my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... my_metric{label=”a”, foo=”a”} my_metric{label=”b”,
foo=”a”} my_metric{label=”c”, foo=”a”} … other_metric{label=”a”, foo=”b”} other_metric{label=”b”, foo=”b”} other_metric{label=”c”, foo=”b”} … my_metric{label=”b”, foo=”c”} my_metric{label=”c”, foo=”c”} my_metric{label=”d”, foo=”c”} … other_metric{x=”a”} 22 other_metric{x=”b”} 17 other_metric{x=”c”} 8 ... aT1 aT2 1 7 6 2 42 24 bT1 22 17 8 cT1 12 3 7 my_metric{label=”b”} 12 my_metric{label=”c”} 3 my_metric{label=”d”} 7 ... my_metric{label=”a”} 7 my_metric{label=”b”} 2 my_metric{label=”c”} 24 ... -
my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... my_metric{label=”a”, foo=”a”} my_metric{label=”b”,
foo=”a”} my_metric{label=”c”, foo=”a”} … other_metric{label=”a”, foo=”b”} other_metric{label=”b”, foo=”b”} other_metric{label=”c”, foo=”b”} … my_metric{label=”b”, foo=”c”} my_metric{label=”c”, foo=”c”} my_metric{label=”d”, foo=”c”} … other_metric{x=”a”} 22 other_metric{x=”b”} 17 other_metric{x=”c”} 8 ... aT1 aT2 1 7 6 2 42 24 bT1 bT2 22 34 17 5 8 19 cT1 12 3 7 my_metric{label=”b”} 12 my_metric{label=”c”} 3 my_metric{label=”d”} 7 ... other_metric{x=”a”} 34 other_metric{x=”b”} 5 other_metric{x=”c”} 19 ... my_metric{label=”a”} 7 my_metric{label=”b”} 2 my_metric{label=”c”} 24 ... -
my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... my_metric{label=”a”, foo=”a”} my_metric{label=”b”,
foo=”a”} my_metric{label=”c”, foo=”a”} … other_metric{label=”a”, foo=”b”} other_metric{label=”b”, foo=”b”} other_metric{label=”c”, foo=”b”} … my_metric{label=”b”, foo=”c”} my_metric{label=”c”, foo=”c”} my_metric{label=”d”, foo=”c”} … other_metric{x=”a”} 22 other_metric{x=”b”} 17 other_metric{x=”c”} 8 ... aT1 aT2 1 7 6 2 42 24 bT1 bT2 22 34 17 5 8 19 cT1 cT2 12 18 3 19 7 49 my_metric{label=”b”} 12 my_metric{label=”c”} 3 my_metric{label=”d”} 7 ... my_metric{label=”b”} 18 my_metric{label=”c”} 19 my_metric{label=”d”} 49 ... other_metric{x=”a”} 34 other_metric{x=”b”} 5 other_metric{x=”c”} 19 ... my_metric{label=”a”} 7 my_metric{label=”b”} 2 my_metric{label=”c”} 24 ... -
my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... my_metric{label=”a”, foo=”a”} my_metric{label=”b”,
foo=”a”} my_metric{label=”c”, foo=”a”} … other_metric{label=”a”, foo=”b”} other_metric{label=”b”, foo=”b”} other_metric{label=”c”, foo=”b”} … my_metric{label=”b”, foo=”c”} my_metric{label=”c”, foo=”c”} my_metric{label=”d”, foo=”c”} … other_metric{x=”a”} 22 other_metric{x=”b”} 17 other_metric{x=”c”} 8 ... aT1 aT2 aT3 1 7 4 6 2 8 42 24 13 bT1 bT2 22 34 17 5 8 19 cT1 cT2 12 18 3 19 7 49 my_metric{label=”b”} 12 my_metric{label=”c”} 3 my_metric{label=”d”} 7 ... my_metric{label=”b”} 18 my_metric{label=”c”} 19 my_metric{label=”d”} 49 ... other_metric{x=”a”} 34 other_metric{x=”b”} 5 other_metric{x=”c”} 19 ... my_metric{label=”a”} 7 my_metric{label=”b”} 2 my_metric{label=”c”} 24 ... my_metric{label=”a”} 4 my_metric{label=”b”} 8 my_metric{label=”c”} 13 ... -
my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... my_metric{label=”a”, foo=”a”} my_metric{label=”b”,
foo=”a”} my_metric{label=”c”, foo=”a”} … other_metric{label=”a”, foo=”b”} other_metric{label=”b”, foo=”b”} other_metric{label=”c”, foo=”b”} … my_metric{label=”b”, foo=”c”} my_metric{label=”c”, foo=”c”} my_metric{label=”d”, foo=”c”} … other_metric{x=”a”} 22 other_metric{x=”b”} 17 other_metric{x=”c”} 8 ... aT1 aT2 aT3 1 7 4 6 2 8 42 24 13 bT1 bT2 22 34 17 5 8 19 cT1 cT2 12 18 3 19 7 49 my_metric{label=”b”} 12 my_metric{label=”c”} 3 my_metric{label=”d”} 7 ... my_metric{label=”b”} 18 my_metric{label=”c”} 19 my_metric{label=”d”} 49 ... other_metric{x=”a”} 34 other_metric{x=”b”} 5 other_metric{x=”c”} 19 ... my_metric{label=”a”} 7 my_metric{label=”b”} 2 my_metric{label=”c”} 24 ... my_metric{label=”a”} 4 my_metric{label=”b”} 8 my_metric{label=”c”} 13 ... -
my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... my_metric{label=”a”, foo=”a”} my_metric{label=”b”,
foo=”a”} my_metric{label=”c”, foo=”a”} … other_metric{label=”a”, foo=”b”} other_metric{label=”b”, foo=”b”} other_metric{label=”c”, foo=”b”} … my_metric{label=”b”, foo=”c”} my_metric{label=”c”, foo=”c”} my_metric{label=”d”, foo=”c”} … other_metric{x=”a”} 22 other_metric{x=”b”} 17 other_metric{x=”c”} 8 ... aT1 aT2 aT3 1 7 4 6 2 8 42 24 13 bT1 bT2 22 34 17 5 8 19 cT1 cT2 12 18 3 19 7 49 my_metric{label=”b”} 12 my_metric{label=”c”} 3 my_metric{label=”d”} 7 ... my_metric{label=”b”} 18 my_metric{label=”c”} 19 my_metric{label=”d”} 49 ... other_metric{x=”a”} 34 other_metric{x=”b”} 5 other_metric{x=”c”} 19 ... my_metric{label=”a”} 7 my_metric{label=”b”} 2 my_metric{label=”c”} 24 ... my_metric{label=”a”} 4 my_metric{label=”b”} 8 my_metric{label=”c”} 13 ... my_metric{label=”a”, foo=”a”} 4 my_metric{label=”b”, foo=”a”} 8 my_metric{label=”c”, foo=”a”} 13 … other_metric{label=”a”, foo=”b”} 34 other_metric{label=”b”, foo=”b”} 5 other_metric{label=”c”, foo=”b”} 19 … my_metric{label=”b”, foo=”c”} 18 my_metric{label=”c”, foo=”c”} 19 my_metric{label=”d”, foo=”c”} 49 … -
my_metric{label=”a”} 1 my_metric{label=”b”} 6 my_metric{label=”c”} 42 ... my_metric{label=”a”, foo=”a”} my_metric{label=”b”,
foo=”a”} my_metric{label=”c”, foo=”a”} … other_metric{label=”a”, foo=”b”} other_metric{label=”b”, foo=”b”} other_metric{label=”c”, foo=”b”} … my_metric{label=”b”, foo=”c”} my_metric{label=”c”, foo=”c”} my_metric{label=”d”, foo=”c”} … other_metric{x=”a”} 22 other_metric{x=”b”} 17 other_metric{x=”c”} 8 ... aT1 aT2 aT3 1 7 4 6 2 8 42 24 13 bT1 bT2 22 34 17 5 8 19 cT1 cT2 12 18 3 19 7 49 my_metric{label=”a”, foo=”a”} 4 my_metric{label=”b”, foo=”a”} 8 my_metric{label=”c”, foo=”a”} 13 … other_metric{label=”a”, foo=”b”} 34 other_metric{label=”b”, foo=”b”} 5 other_metric{label=”c”, foo=”b”} 19 … my_metric{label=”b”, foo=”c”} 18 my_metric{label=”c”, foo=”c”} 19 my_metric{label=”d”, foo=”c”} 49 … my_metric{label=”b”} 12 my_metric{label=”c”} 3 my_metric{label=”d”} 7 ... API GET /federate HTTP/1.0 my_metric{label=”b”} 18 my_metric{label=”c”} 19 my_metric{label=”d”} 49 ... other_metric{x=”a”} 34 other_metric{x=”b”} 5 other_metric{x=”c”} 19 ... my_metric{label=”a”} 7 my_metric{label=”b”} 2 my_metric{label=”c”} 24 ... my_metric{label=”a”} 4 my_metric{label=”b”} 8 my_metric{label=”c”} 13 ... -
Над чем мы работаем сейчас Автоматический триаж Автоматизация root cause
analysis PodPreset Еще одно измерение -
Что такое мониторинг? Упреждение аварий Уведомление об аварии Быстрая диагностика
Система мониторинга Точные данные Полезные графики Актуальные алерты -
Нужно группировать Service Discovery стал обязательным Объем данных вырос Текучка
метаданных Использовать встроенные примитивы Помнить, что “реальности” больше одной В одном кластере много окружений -
Нужно группировать Service Discovery стал обязательным Объем данных вырос Текучка
метаданных Использовать встроенные примитивы Помнить, что “реальности” больше одной В одном кластере много окружений -
Наш рецепт мониторинга Kubernetes! 1. Возьмите Prometheus 2. Приготовьте 2000
часов 3. Помните, что содержимое важнее системы! -
Наш рецепт мониторинга Kubernetes! 1. Возьмите Prometheus 2. Приготовьте 2000
часов 3. Помните, что содержимое важнее системы! 4. Сделайте мониторинг! -
Лучшие практики Continuous Delivery с Docker RootConf 2016 Собираем Docker-
образы быстро и удобно Highload 2016 Наш опыт с Kubernetes в небольших проектах RootConf 2017 Лучшие практики CI/CD с Kubernetes и GitLab Highload 2017 youtube.com/c/flant -
Наши Docker-проекты github.com/flant/dapp github.com/flant/loghouse Дмитрий Столяров [email protected] linkedin.com/in/distol github.com/distol Всем
спасибо! Наш блог на Хабрахабре habr.com/company/flant/ Наш youtube-канал youtube.com/c/flant