List metric definitions for a resource (older 2014-04-01 API version) in Azure Monitor REST API

 

Updated: September 26, 2016

See Common parameters and headers for headers and parameters that are used by all requests related to events.

Method

Request URI

GET

https://management.azure.com/subscriptions/{-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}/metricDefinitions?api-version={api-version}&$filter={filter}

Replace {resource-provider-namespace}, {resource-type}, and {resource-name} with the segments from the Resource ID you are interested in getting metrics for. For example, to get the metrics from a SQL database name “myDB” on “myServer” the request looks like:

GET

https://management.azure.com/subscriptions/{-id}/resourceGroups/{resource-group-name}/providers/Microsoft.SQL/servers/myServer/databases/myDB/metricDefinitions?api-version={api-version}

The $filter parameter is optional, and can be used to only retrieve certain metric definitions. For example, get just the definition for the CPU percentage counter, you can perform the following request:

$filter=name.value eq '\Processor(_Total)\% Processor Time'
This $filter is very restricted and allows only these "name eq <value>" clauses separated by " or "s. No other syntax is allowed.

Status code: 200

{
  "value": [ {
    "name": {
      "value": "\\Processor(_Total)\\% Processor Time",
      "localizedValue": "CPU percentage guest OS"
    },
    "unit": "Percent",
    "primaryAggregationType": "Average",
    "resourceUri": "/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/norapp/providers/microsoft.classiccompute/virtualmachines/norapp005",
    "metricAvailabilities": [ {
      "timeGrain": "PT1H",
      "retention": "P10675199DT2H48M5.4775807S",
      "location": {
        "tableEndpoint": "https://devtestvhdse9ad273e6b3f.table.core.windows.net/",
        "tableInfo": [ {
          "tableName": "WADMetricsPT1HP10DV2S20150131",
          "startTime": "2015-01-31T00:00:00Z",
          "endTime": "2015-02-10T00:00:00Z",
          "sasToken": "?sv=2014-02-14&tn=WADMetricsPT1HP10DV2S20150131&spk=%3A002Fsubscriptions%3A002F62732b21%3A002D9b6b%3A002D4ca0%3A002Dad4b%3A002D536c42d690cb%3A002FresourceGroups%3A002Fnorapp%3A002Fproviders%3A002Fmicrosoft%3A002Eclassiccompute%3A002Fvirtualmachines%3A002Fnorapp005&epk=%3A002Fsubscriptions%3A002F62732b21%3A002D9b6b%3A002D4ca0%3A002Dad4b%3A002D536c42d690cb%3A002FresourceGroups%3A002Fnorapp%3A002Fproviders%3A002Fmicrosoft%3A002Eclassiccompute%3A002Fvirtualmachines%3A002Fnorapp005&sig=vUVBPwpnKU7IPg4pTzDGnUxWYdOtXjdZJAJWa1t9zSI%3D&se=2015-02-02T02%3A18%3A24Z&sp=r",
          "sasTokenExpirationTime": "2015-02-02T02:18:24.2979035Z"
        } ],
        "partitionKey": ":002Fsubscriptions:002F62732b21:002D9b6b:002D4ca0:002Dad4b:002D536c42d690cb:002FresourceGroups:002Fnorapp:002Fproviders:002Fmicrosoft:002Eclassiccompute:002Fvirtualmachines:002Fnorapp005"
      }
    } ]
  } ]
}

Element Name

Description

name

LocalizableString object containing the name and a localized value.

unit

Representing the units of the metric. Possible values are: Count, Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond.

primaryAggregationType

Enumeration value defining how to use the values for display. Possible values are: None, Average, Total, Minimum, Maximum, Last.

resourceUri

Resource associated with the metric.

metricAvailabilities

Collection of availability information defining what timeGrains are available to be queried and its retention.

timeGrain

Metrics will be available for this timegrain. Expressed as a duration ‘PT1M’, ‘P1D’ etc.

retention

Metrics may be queried for this interval. Expressed as a duration as above. For example, 'P30D' means the metric is retained and hence could be queried for up to 30 days in the past.

location

Details of the location of the metric data that's stored.

Show: