Compare languages | The extended-monitoring module: configuration

How to use extended-monitoring-exporter

Как использовать extended-monitoring-exporter

Attach the extended-monitoring.deckhouse.io/enabled label to the Namespace to enable the export of extended monitoring metrics. You can do it by:

  • adding the appropriate helm-chart to the project (recommended method);
  • adding it to .gitlab-ci.yml (kubectl patch/create);
  • attaching it manually (kubectl label namespace my-app-production extended-monitoring.deckhouse.io/enabled="").
  • configuring via namespace-configurator module.

Чтобы включить экспортирование extended-monitoring метрик, нужно навесить на namespace лейбл extended-monitoring.deckhouse.io/enabled любым удобным способом, например:

  • добавить в проект соответствующий helm-чарт (рекомендуемый);
  • добавить в описание .gitlab-ci.yml (kubectl patch/create);
  • поставить руками (kubectl label namespace my-app-production extended-monitoring.deckhouse.io/enabled="");
  • настроить через namespace-configurator модуль.

Any of the methods above would result in the emergence of the default metrics (+ any custom metrics with the threshold.extended-monitoring.deckhouse.io/ prefix) for all supported Kubernetes objects in the target namespace. Note that monitoring is enabled automatically for a number of non-namespaced Kubernetes objects described below.

Сразу же после этого для всех поддерживаемых Kubernetes-объектов в данном namespace в Prometheus появятся default-метрики + любые кастомные с префиксом threshold.extended-monitoring.deckhouse.io/. Для ряда non-namespaced Kubernetes-объектов, описанных ниже, мониторинг включается автоматически.

You can also add custom labels with the specified value to threshold.extended-monitoring.deckhouse.io/something Kubernetes objects, e.g., kubectl label pod test threshold.extended-monitoring.deckhouse.io/disk-inodes-warning=30. In this case, the label value will replace the default one.

К Kubernetes-объектам threshold.extended-monitoring.deckhouse.io/что-то свое можно добавить любые другие лейблы с указанным значением. Пример: kubectl label pod test threshold.extended-monitoring.deckhouse.io/disk-inodes-warning=30. В таком случае значение из лейбла заменит значение по умолчанию.

You can disable monitoring on a per-object basis by adding the extended-monitoring.deckhouse.io/enabled=false label to it. Thus, the default labels will also be disabled (as well as label-based alerts).

Слежение за объектом можно отключить индивидуально, поставив на него лейбл extended-monitoring.deckhouse.io/enabled=false. Соответственно, отключатся и лейблы по умолчанию, а также все алерты, привязанные к лейблам.

Standard labels and supported Kubernetes objects

Стандартные лейблы и поддерживаемые Kubernetes-объекты

Below is the list of labels used in Prometheus Rules and their default values.

Далее приведен список используемых в Prometheus Rules лейблов, а также их стандартные значения.

Note, that all the labels start with the threshold.extended-monitoring.deckhouse.io/ prefix. The value specified in a label is a number that sets the alert trigger threshold.

Обратите внимание, что все лейблы начинаются с префикса threshold.extended-monitoring.deckhouse.io/. Указанное в лейбле значение — число, которое устанавливает порог срабатывания алерта.

For example, the label threshold.extended-monitoring.deckhouse.io/5xx-warning: "5" on the Ingress resource changes the alert threshold from 10% (default) to 5%.

Например, лейбл threshold.extended-monitoring.deckhouse.io/5xx-warning: "5" на Ingress-ресурсе изменяет порог срабатывания алерта с 10% (по умолчанию) на 5%.

Non-namespaced Kubernetes objects

Non-namespaced Kubernetes-объекты

Non-namespaced Kubernetes objects do not need labels on the namespace, and monitoring on them is enabled by default when the module is enabled.

Non-namespaced Kubernetes-объекты не нуждаются в лейблах на namespace и мониторинг на них включается по умолчанию при включении модуля.

Node

Node

Label Type Default value
disk-bytes-warning int (percent) 70
disk-bytes-critical int (percent) 80
disk-inodes-warning int (percent) 90
disk-inodes-critical int (percent) 95
load-average-per-core-warning int 3
load-average-per-core-critical int 10
Label Type Default value
disk-bytes-warning int (percent) 70
disk-bytes-critical int (percent) 80
disk-inodes-warning int (percent) 90
disk-inodes-critical int (percent) 95
load-average-per-core-warning int 3
load-average-per-core-critical int 10

Caution! These labels do not apply to imagefs (/var/lib/docker by default) and nodefs (/var/lib/kubelet by default) volumes. The thresholds for these volumes are configured completely automatically according to the kubelet’s eviction thresholds. The default values are available here; for more info, see the exporter.

Важно! Эти лейблы не действуют для тех разделов, в которых расположены imagefs (по умолчанию — /var/lib/docker) и nodefs (по умолчанию — /var/lib/kubelet). Для этих разделов пороги настраиваются полностью автоматически согласно eviction thresholds в kubelet. Значения по умолчанию см. тут, подробнее см. экспортер.

Namespaced Kubernetes objects

Namespaced Kubernetes-объекты

Pod

Под

Label Type Default value
disk-bytes-warning int (percent) 85
disk-bytes-critical int (percent) 95
disk-inodes-warning int (percent) 85
disk-inodes-critical int (percent) 90
Label Type Default value
disk-bytes-warning int (percent) 85
disk-bytes-critical int (percent) 95
disk-inodes-warning int (percent) 85
disk-inodes-critical int (percent) 90

Ingress

Ingress

Label Type Default value
5xx-warning int (percent) 10
5xx-critical int (percent) 20
Label Type Default value
5xx-warning int (percent) 10
5xx-critical int (percent) 20

Deployment

Deployment

Label Type Default value
replicas-not-ready int (count) 0
Label Type Default value
replicas-not-ready int (count) 0

The threshold implies the number of unavailable replicas in addition to maxUnavailable. This threshold will be triggered if the number of unavailable replicas is greater than maxUnavailable by the amount specified. Suppose replicas-not-ready is 0. In this case, the threshold will be triggered if the number of unavailable replicas is greater than maxUnavailable. If replicas-not-ready is set to 1, then the threshold will be triggered if the number of unavailable replicas is greater than maxUnavailable + 1. This way, you can fine-tune this parameter for specific Deployments (that may be unavailable) in the namespace with the extended monitoring enabled to avoid getting excessive alerts.

Порог подразумевает количество недоступных реплик сверх maxUnavailable. Сработает, если недоступно реплик больше на указанное значение, чем разрешено в maxUnavailable. То есть при нуле сработает, если недоступно больше, чем указано в maxUnavailable, а при единице сработает, если недоступно больше, чем указано в maxUnavailable, плюс 1. Таким образом, у конкретных Deployment, которые находятся в namespace со включенным расширенным мониторингом и которым допустимо быть недоступными, можно подкрутить этот параметр, чтобы не получать ненужные алерты.

Statefulset

Statefulset

Label Type Default value
replicas-not-ready int (count) 0
Label Type Default value
replicas-not-ready int (count) 0

The threshold implies the number of unavailable replicas in addition to maxUnavailable (see the comments on Deployment).

Порог подразумевает количество недоступных реплик сверх maxUnavailable (см. комментарии к Deployment).

DaemonSet

DaemonSet

Label Type Default value
replicas-not-ready int (count) 0
Label Type Default value
replicas-not-ready int (count) 0

The threshold implies the number of unavailable replicas in addition to maxUnavailable (see the comments on Deployment).

Порог подразумевает количество недоступных реплик сверх maxUnavailable (см. комментарии к Deployment).

CronJob

CronJob

Note that only the deactivation using the extended-monitoring.deckhouse.io/enabled=false label is supported.

Работает только выключение через лейбл extended-monitoring.deckhouse.io/enabled=false.

How does it work?

Как работает

The module exports specific Kubernetes object labels to Prometheus. It allows you to improve Prometheus rules by adding the thresholds for triggering alerts. Using metrics that this module exports, you can, e.g., replace the “magic” constants in rules.

Модуль экспортирует в Prometheus специальные лейблы Kubernetes-объектов. Позволяет улучшить Prometheus-правила путем добавления порога срабатывания для алертов. Использование метрик, экспортируемых данным модулем, позволяет, например, заменить «магические» константы в правилах.

Before:

До:

text ( kube_statefulset_status_replicas - kube_statefulset_status_replicas_ready )

1

text ( kube_statefulset_status_replicas - kube_statefulset_status_replicas_ready )

1

After:

После:

text ( kube_statefulset_status_replicas - kube_statefulset_status_replicas_ready )

on (namespace, statefulset) ( max by (namespace, statefulset) (extended_monitoring_statefulset_threshold{threshold=”replicas-not-ready”}) )

text ( kube_statefulset_status_replicas - kube_statefulset_status_replicas_ready )

on (namespace, statefulset) ( max by (namespace, statefulset) (extended_monitoring_statefulset_threshold{threshold=”replicas-not-ready”}) )