json - 从 AZURE 检索 SQL Server 数据的指标值时出错

标签 json rest azure azure-sql-database

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'

上面是我传递的用于获取 sql server 指标数据的 url

我得到的回复是:

{
"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": []
    }
]}

时间序列中没有数据。

可能是什么问题?

最佳答案

如果我不指定过滤器,当我使用“2017-05-01-preview”作为 API 版本时,可以返回 dtu_conspiration_percent(默认指标)。

enter image description here

时间序列数据:

enter image description here

如果我将过滤器指定为您的过滤器并使用“2017-05-01-preview”作为 API 版本,则会收到 400 错误。

enter image description here

this article 中的“检索指标值”部分下,我发现:

Note

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

您可以尝试使用“2016-06-01”作为 API 版本来检索指标值。

enter image description here

关于json - 从 AZURE 检索 SQL Server 数据的指标值时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46168289/

相关文章:

rest - 从索引中获取所有文档 - elasticsearch

rest - 什么是超媒体、超媒体控件、超媒体格式

python - Django 中的 RESTful API 用于从服务器获取信息

azure - 获取 Client_id、secret 和tenantId,以通过 ansible 验证 Microsoft Azure

javascript - 向 api.twitter.com 发出 XMLHttpRequest 的解决方法?

python - 将一个大的 json 文件拆分成多个小文件

javascript - 在 UI 上解析上传的 CSV 文件(约 8GB)时,在内存中存储非常大的 JSON 对象

javascript - JSON 到输入选择的选项

当我尝试登录时,Azure 门户显示错误 AADSTS50020

python - 我可以在 azure 应用服务中使用不同的文件结构吗?