Example of the module configuration | Пример настройки модуля |
yaml apiVersion: deckhouse.io/v1alpha1 kind: ModuleConfig metadata: name: prometheus-pushgateway spec: version: 1 enabled: true settings: instances:
| yaml apiVersion: deckhouse.io/v1alpha1 kind: ModuleConfig metadata: name: prometheus-pushgateway spec: version: 1 enabled: true settings: instances:
|
PushGateway address (from a container pod): | Адрес PushGateway (из контейнера пода): |
Pushing a metric | Отправка метрики |
An example of pushing a metric using curl: | Пример отправки метрики через curl: |
shell echo “test_metric{env=”dev”} 3.14” | curl –data-binary @- http://first.kube-prometheus-pushgateway:9091/metrics/job/myapp | shell echo “test_metric{env=”dev”} 3.14” | curl –data-binary @- http://first.kube-prometheus-pushgateway:9091/metrics/job/myapp |
The metrics will be available in Prometheus in 30 seconds (after the data are scraped). An example: | Через 30 секунд (после скрейпа данных) метрики будут доступны в Prometheus. Пример: |
text test_metric{container=”prometheus-pushgateway”, env=”dev”, exported_job=”myapp”, instance=”10.244.1.155:9091”, job=”prometheus-pushgateway”, pushgateway=”prometheus-pushgateway”, tier=”cluster”} 3.14 | text test_metric{container=”prometheus-pushgateway”, env=”dev”, exported_job=”myapp”, instance=”10.244.1.155:9091”, job=”prometheus-pushgateway”, pushgateway=”prometheus-pushgateway”, tier=”cluster”} 3.14 |
The job name ( | Название job (в примере — |
You may need to get a list of all available job names to choose a unique name (in order not to spoil existing graphs and alerts). Use the following query to get a list of all existing jobs: | Возможно, вам потребуется получить список всех имеющихся job для выбора уникального названия (чтобы не испортить существующие графики и алерты). Получить список всех имеющихся job можно следующим запросом: |
Deleting metrics | Удаление метрик |
An example of deleting all metrics of a group | Пример удаления всех метрик группы |
shell curl -X DELETE http://first.kube-prometheus-pushgateway:9091/metrics/job/myapp/instance/10.244.1.155:9091 | shell curl -X DELETE http://first.kube-prometheus-pushgateway:9091/metrics/job/myapp/instance/10.244.1.155:9091 |
Since PushGateway stores the scraped metrics in memory, all metrics will be lost when the Pod is restarted. | Так как PushGateway хранит полученные метрики в памяти, при рестарте пода все метрики будут утеряны. |