ModifyPrometheusRemoteWriteTarget
In this article:
ModifyPrometheusRemoteWriteTarget#
Description#
Запрос на изменение цели для записи метрик по протоколу Prometheus Remote Write.
Request Parameters#
parameters — Параметры цели Remote Write.
Type: Dict
Required: Yes
serviceId — The PaaS service ID.
Type: String
Required: Yes
targetId — Идентификатор цели Remote Write.
Type: String
Required: Yes
Response Elements#
prometheusRemoteWriteTarget — Изменённая цель Remote Write.
Тип: Объект PrometheusRemoteWriteTarget
Examples#
Managing PaaS services in K2 Cloud via API requires a customized version of the boto3 library:
import boto3
session = boto3.Session(
aws_access_key_id="<AWS_ACCESS_KEY_ID>",
aws_secret_access_key="<AWS_SECRET_ACCESS_KEY>",
region_name="",
)
paas_client = session.client(
'paas',
endpoint_url='https://paas.ru-msk.k2.cloud/',
)
target = paas_client.modify_prometheus_remote_write_target(
serviceId='fm-cluster-1ACD3963',
targetId="prometheus-remote-write-target-B9FF2AB1",
parameters={
"url": "https://remote-write.example.com/api/v1/write",
"username": "username1",
"password": "password1",
"write_relabel_configs": [
{
"action": "drop",
"regex": "go_gc_.*",
"source_labels": ["__name__"],
},
],
}
)
Or c2-paas utility from K2 Cloud API Client software suite:
c2-paas ModifyPrometheusRemoteWriteTarget serviceId fm-cluster-1ACD3963 targetId prometheus-remote-write-target-B9FF2AB1 parameters.url https://remote-write.example.com/api/v1/write parameters.username username1 parameters.password password1 parameters.write_relabel_configs.1.action drop parameters.write_relabel_configs.1.regex "go_gc_.*" parameters.write_relabel_configs.1.source_labels.1 "__name__"