0

尝试以编程方式从 Web 应用的 Azure 管理 API 中检索性能指标定义和值

使用最新的 Nuget 包(基于 Rest)进行 Azure 管理:Assembly Microsoft.Azure.Management.Websites.dll,v1.0.0.2

无论我将什么参数传递给过滤器属性,ctx.Sites.GetSiteMetrics 都会返回内部服务器错误

                    var defs = ctx.Sites.GetSiteMetrics(site.AzureResourceGroup, site.AzureResourceName, false,
                        string.Format("$filter=(startTime eq '{0}')",
                            DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(10)).ToString("yyyy-MM-ddThh:mm:ssZ"))).Value;

ctx.Sites.GetSiteMetricDefinitions 返回 15 个空对象(序列化不正确?)

早期版本的库(基于 TokenCloudCredential)返回更模糊的错误(找不到资源)

有任何想法吗?

根据要求,GetSiteMetricDefinitions 调用的提琴手输出(看起来确实不正确的序列化?)

    {
   "id":"/subscriptions/xxxxxxxxx-xxxx-xxxx-xxxx-4384e4cfd2d6/resourceGroups/ARMTest/providers/Microsoft.Web/sites/WebAppArmTest1/metricdefinitions",
   "value":[
      {
         "name":{
            "value":"CpuTime",
            "localizedValue":"CPU Time"
         },
         "unit":"Seconds",
         "primaryAggregationType":"Total",
         "resourceUri":null,
         "metricAvailabilities":[
            {
               "timeGrain":"PT1M",
               "retention":"P2D"
            },
            {
               "timeGrain":"PT1H",
               "retention":"P30D"
            },
            {
               "timeGrain":"P1D",
               "retention":"P90D"
            }
         ],
         "properties":[

         ]
      },
      {
         "name":{
            "value":"Requests",
            "localizedValue":"Requests"
         },
         "unit":"Count",
         "primaryAggregationType":"Total",
         "resourceUri":null,
         "metricAvailabilities":[
            {
               "timeGrain":"PT1M",
               "retention":"P2D"
            },
            {
               "timeGrain":"PT1H",
               "retention":"P30D"
            },
            {
               "timeGrain":"P1D",
               "retention":"P90D"
            }
         ],
         "properties":[

         ]
      },
      {
         "name":{
            "value":"BytesReceived",
            "localizedValue":"Data In"
         },
         "unit":"Bytes",
         "primaryAggregationType":"Total",
         "resourceUri":null,
         "metricAvailabilities":[
            {
               "timeGrain":"PT1M",
               "retention":"P2D"
            },
            {
               "timeGrain":"PT1H",
               "retention":"P30D"
            },
            {
               "timeGrain":"P1D",
               "retention":"P90D"
            }
         ],
         "properties":[

         ]
      },
      {
         "name":{
            "value":"BytesSent",
            "localizedValue":"Data Out"
         },
         "unit":"Bytes",
         "primaryAggregationType":"Total",
         "resourceUri":null,
         "metricAvailabilities":[
            {
               "timeGrain":"PT1M",
               "retention":"P2D"
            },
            {
               "timeGrain":"PT1H",
               "retention":"P30D"
            },
            {
               "timeGrain":"P1D",
               "retention":"P90D"
            }
         ],
         "properties":[

         ]
      },
      {
         "name":{
            "value":"Http2xx",
            "localizedValue":"Http 2xx"
         },
         "unit":"Count",
         "primaryAggregationType":"Total",
         "resourceUri":null,
         "metricAvailabilities":[
            {
               "timeGrain":"PT1M",
               "retention":"P2D"
            },
            {
               "timeGrain":"PT1H",
               "retention":"P30D"
            },
            {
               "timeGrain":"P1D",
               "retention":"P90D"
            }
         ],
         "properties":[

         ]
      },
      {
         "name":{
            "value":"Http3xx",
            "localizedValue":"Http 3xx"
         },
         "unit":"Count",
         "primaryAggregationType":"Total",
         "resourceUri":null,
         "metricAvailabilities":[
            {
               "timeGrain":"PT1M",
               "retention":"P2D"
            },
            {
               "timeGrain":"PT1H",
               "retention":"P30D"
            },
            {
               "timeGrain":"P1D",
               "retention":"P90D"
            }
         ],
         "properties":[

         ]
      },
      {
         "name":{
            "value":"Http401",
            "localizedValue":"Http 401"
         },
         "unit":"Count",
         "primaryAggregationType":"Total",
         "resourceUri":null,
         "metricAvailabilities":[
            {
               "timeGrain":"PT1M",
               "retention":"P2D"
            },
            {
               "timeGrain":"PT1H",
               "retention":"P30D"
            },
            {
               "timeGrain":"P1D",
               "retention":"P90D"
            }
         ],
         "properties":[

         ]
      },
      {
         "name":{
            "value":"Http403",
            "localizedValue":"Http 403"
         },
         "unit":"Count",
         "primaryAggregationType":"Total",
         "resourceUri":null,
         "metricAvailabilities":[
            {
               "timeGrain":"PT1M",
               "retention":"P2D"
            },
            {
               "timeGrain":"PT1H",
               "retention":"P30D"
            },
            {
               "timeGrain":"P1D",
               "retention":"P90D"
            }
         ],
         "properties":[

         ]
      },
      {
         "name":{
            "value":"Http404",
            "localizedValue":"Http 404"
         },
         "unit":"Count",
         "primaryAggregationType":"Total",
         "resourceUri":null,
         "metricAvailabilities":[
            {
               "timeGrain":"PT1M",
               "retention":"P2D"
            },
            {
               "timeGrain":"PT1H",
               "retention":"P30D"
            },
            {
               "timeGrain":"P1D",
               "retention":"P90D"
            }
         ],
         "properties":[

         ]
      },
      {
         "name":{
            "value":"Http406",
            "localizedValue":"Http 406"
         },
         "unit":"Count",
         "primaryAggregationType":"Total",
         "resourceUri":null,
         "metricAvailabilities":[
            {
               "timeGrain":"PT1M",
               "retention":"P2D"
            },
            {
               "timeGrain":"PT1H",
               "retention":"P30D"
            },
            {
               "timeGrain":"P1D",
               "retention":"P90D"
            }
         ],
         "properties":[

         ]
      },
      {
         "name":{
            "value":"Http4xx",
            "localizedValue":"Http 4xx"
         },
         "unit":"Count",
         "primaryAggregationType":"Total",
         "resourceUri":null,
         "metricAvailabilities":[
            {
               "timeGrain":"PT1M",
               "retention":"P2D"
            },
            {
               "timeGrain":"PT1H",
               "retention":"P30D"
            },
            {
               "timeGrain":"P1D",
               "retention":"P90D"
            }
         ],
         "properties":[

         ]
      },
      {
         "name":{
            "value":"Http5xx",
            "localizedValue":"Http Server Errors"
         },
         "unit":"Count",
         "primaryAggregationType":"Total",
         "resourceUri":null,
         "metricAvailabilities":[
            {
               "timeGrain":"PT1M",
               "retention":"P2D"
            },
            {
               "timeGrain":"PT1H",
               "retention":"P30D"
            },
            {
               "timeGrain":"P1D",
               "retention":"P90D"
            }
         ],
         "properties":[

         ]
      },
      {
         "name":{
            "value":"MemoryWorkingSet",
            "localizedValue":"Memory working set"
         },
         "unit":"Bytes",
         "primaryAggregationType":"Total",
         "resourceUri":null,
         "metricAvailabilities":[
            {
               "timeGrain":"PT1M",
               "retention":"P2D"
            },
            {
               "timeGrain":"PT1H",
               "retention":"P30D"
            },
            {
               "timeGrain":"P1D",
               "retention":"P90D"
            }
         ],
         "properties":[

         ]
      },
      {
         "name":{
            "value":"AverageMemoryWorkingSet",
            "localizedValue":"Average memory working set"
         },
         "unit":"Bytes",
         "primaryAggregationType":"Average",
         "resourceUri":null,
         "metricAvailabilities":[
            {
               "timeGrain":"PT1M",
               "retention":"P2D"
            },
            {
               "timeGrain":"PT1H",
               "retention":"P30D"
            },
            {
               "timeGrain":"P1D",
               "retention":"P90D"
            }
         ],
         "properties":[

         ]
      },
      {
         "name":{
            "value":"AverageResponseTime",
            "localizedValue":"Average Response Time"
         },
         "unit":"Seconds",
         "primaryAggregationType":"Average",
         "resourceUri":null,
         "metricAvailabilities":[
            {
               "timeGrain":"PT1M",
               "retention":"P2D"
            },
            {
               "timeGrain":"PT1H",
               "retention":"P30D"
            },
            {
               "timeGrain":"P1D",
               "retention":"P90D"
            }
         ],
         "properties":[

         ]
      }
   ]
}
4

0 回答 0