简体   繁体   中英

Error in retrieving metric values for SQL server data from AZURE

https://management.azure.com/subscriptions/{subscription Id}/resourceGroups/{Resource Group}/providers/Microsoft.Sql/servers/{servername}/providers/microsoft.insights/metrics?api-version=2017-05-01-preview&$filter=(name.value eq 'dtu_consumption_percent' ) and startTime eq 2017-09-10 and endTime eq 2017-09-11 and timeGrain eq duration'PT1H'

The above is the url I am passing to get the data for sql server metrics

The response i am getting is :

{
"cost": 0,
"timespan": "2017-09-12T03:56:27Z/2017-09-12T04:56:27Z",
"interval": "PT1M",
"value": [
    {
        "id": "/subscriptions/{subscription Id}/resourceGroups/{Resource Group}/providers/Microsoft.Sql/servers/{server name}/providers/Microsoft.Insights/metrics/dtu_consumption_percent",
        "type": "Microsoft.Insights/metrics",
        "name": {
            "value": "dtu_consumption_percent",
            "localizedValue": "DTU percentage"
        },
        "unit": "Percent",
        "timeseries": []
    }
]}

There is no data in time series.

What could be the issue ?

If I do not specify the filters, the dtu_consumption_percent (default metric) can be returned when I use " 2017-05-01-preview" as the API version.

在此处输入图片说明

Data of timeseries:

在此处输入图片说明

If I specify the filters as yours and use " 2017-05-01-preview" as the API version, I get 400 error.

在此处输入图片说明

Under “Retrieve Metric Values” section in this article , I find:

Note

To retrieve metric values using the Azure Monitor REST API, use "2016-06-01" as the API version.

You can try to use "2016-06-01" as the API version to retrieve metric values.

在此处输入图片说明

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