简体   繁体   中英

Is it possible to get all available metrics for an Azure resource type?

I have written code that retrieves metric definitions for each resource type ( Documentation ) but as it turns out you can also specify a metric namespace. I am now confused as to how I can retrieve all metric definition for each resource.

I am now confused as to how I can retrieve all metric definition for each resource.

You just need to call this REST API without the metricnamespace parameter, it will return all the metric definitions, when the resourceUri is provided, the metricnamespace is decided.

For example, the resourceUri is /subscriptions/<subscription-id>/resourceGroups/<group-name>/providers/Microsoft.Storage/storageAccounts/joystoragev2 , then the metricnamespace is Microsoft.Storage/storageAccounts .

GET https://management.azure.com/{resourceUri}/providers/microsoft.insights/metricDefinitions?api-version=2018-01-01

For the supported metrics for the metric namespaces, see this link .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM