Getting a list of metrics
Written by
Updated at October 31, 2024
To get a list of metrics that belong to a specific cloud and folder, use the listMetrics method.
Getting started
To try the examples in this section:
- Make sure you have installed the cURL
utility that is used in the examples. - Get the ID of the folder for which you are granted the
monitoring.viewer
role or a higher role. - Get an IAM token:
- Instructions for users with a Yandex account.
- Instructions for a service account.
- Instructions for a federated account.
Sample request
Send the request and save the response to a file, e.g., output.json
:
export IAM_TOKEN=CggaATEVAgA...
curl \
--header "Content-Type: application/json" \
--header "Authorization: Bearer ${IAM_TOKEN}" \
--get 'https://monitoring.api.cloud.yandex.net/monitoring/v2/metrics/?folderId=b1gucmd4tma1********&pageSize=200' \
--data-urlencode 'selectors={service="managed-clickhouse", resource_id="c9q5e2a9i24p********"}' > output.json
Example response to a request to get a list of Managed Service for ClickHouse® service metrics for a resource:
output.json:
{
"metrics" : [
{
"labels" : {
"dc" : "rc1c",
"host" : "rc1c-dqd0h0i0********.mdb.yandexcloud.net",
"node" : "replica",
"resource_id" : "c9q5e2a9i24p********",
"resource_type" : "cluster",
"service" : "managed-clickhouse",
"shard" : "c9qdstaf9lfg********"
},
"name" : "net.packets_sent",
"type" : "DGAUGE"
},
{
"labels" : {
"dc" : "rc1c",
"host" : "rc1c-dqd0h0i0********.mdb.yandexcloud.net",
"node" : "replica",
"resource_id" : "c9q5e2a9i24p********",
"resource_type" : "cluster",
"service" : "managed-clickhouse",
"shard" : "c9qdstaf9lfg********"
},
"name" : "disk.free_inodes",
"type" : "DGAUGE"
}
]
}
Where:
resource_id
: Resource IDmetrics
: List of metrics
ClickHouse® is a registered trademark of ClickHouse, Inc