Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/256.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Microsoft.Automation资源上缺少监视度量值_C#_.net_Azure_Azure Automation - Fatal编程技术网

C# Microsoft.Automation资源上缺少监视度量值

C# Microsoft.Automation资源上缺少监视度量值,c#,.net,azure,azure-automation,C#,.net,Azure,Azure Automation,我想使用检索Azure资源的监视度量值 我使用nuget软件包(版本0.18.1-preview) 我尝试从资源中检索度量。Microsoft自动化资源具有中所述的TotalJob度量 我还可以确认,因为我已检索到Microsoft.Automation资源的度量定义。我使用了MetricDefinitions.List。一切都很好 但是当我使用Metrics.List时,我无法检索任何度量值。我总是在响应中使用null值 我的代码片段如下: var subscriptionId = "<

我想使用检索Azure资源的监视度量值

我使用nuget软件包(版本0.18.1-preview)

我尝试从资源中检索度量。Microsoft自动化资源具有中所述的
TotalJob
度量

我还可以确认,因为我已检索到Microsoft.Automation资源的度量定义。我使用了
MetricDefinitions.List
。一切都很好

但是当我使用
Metrics.List
时,我无法检索任何度量值。我总是在响应中使用
null

我的代码片段如下:

var subscriptionId = "<MY_SUBSCRIPTION_ID>";
var resourceGroup = "Compute";
var resourceName = "cm-auto";

var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Automation/automationAccounts/{resourceName}";

using (IMonitorClient client = _azureMonitorClient.GenerateConnectionInformation(account, resource))
{
    var definitions =client.MetricDefinitions.List(resourceId); // It works correctly

    var timeSpan = $"{DateTime.UtcNow.AddHours(-3):yyyy-MM-ddTHH:mmZ}/{DateTime.UtcNow:yyyy-MM-ddTHH:mmZ}";
    var interval = TimeSpan.FromHours(1);
    var aggregation = "Total";
    var metric = "TotalJob";

    var values = client.Metrics.List(resourceId, metric: metric, timespan: timeSpan, interval: interval, aggregation: aggregation); // There I have always null values in the response result
}
var subscriptionId=“”;
var resourceGroup=“Compute”;
var resourceName=“cm auto”;
var resourceId=$“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Automation/automationAccounts/{resourceName}”;
使用(IMonitorClient=_azureMonitorClient.GenerateConnectionInformation(帐户、资源))
{
var definitions=client.MetricDefinitions.List(resourceId);//它工作正常
var timeSpan=$“{DateTime.UtcNow.AddHours(-3):yyyy-MM-ddTHH:mmZ}/{DateTime.UtcNow:yyyy-MM-ddTHH:mmZ}”;
var间隔=从小时开始的时间跨度(1);
var aggregation=“总计”;
var metric=“TotalJob”;
var values=client.Metrics.List(resourceId,metric:metric,timespan:timespan,interval:interval,aggregation:aggregation);//在响应结果中总是有空值
}
您还可以在屏幕截图上看到调试信息。

正如您所看到的,
TotalJob
度量有
null

我有一小时前工作过的工作。但是我没有看到任何关于工作的信息

我不明白为什么我看不到任何度量值

我的错误在哪里?

注意:我已经在其他Azure资源上检查了我的代码,如。 我的代码和所有这些资源都运行良好。我可以看到度量值


我仅在Microsoft.Automation资源上看不到度量值。

能否确认Azure门户中是否显示Microsoft.Automation资源的度量数据?对于Microsoft.Automation资源来说,这是一个度量不起作用的问题吗?或者只是通过SDK检索它?如果度量数据对此资源根本不起作用,您将需要打开一个支持票证。@然后我可以在Azure Portal上看到活动日志和作业统计信息。请复习一篇文章。我已经用超过48小时的时间间隔(从12月27日到12月29日)测试了我的代码片段。但我并没有从SDK中看到任何度量值。那个屏幕截图显示了活动日志和作业统计,而不是度量统计。您是否有屏幕截图,其中公制图表正确显示数据?在Azure门户中,浏览Azure Monitor->Metrics(预览)。根据对您的问题的描述,我的理论是,您的资源的Microsoft.Automation度量存在一些问题,它将涉及打开平台团队调查的支持票证。@AndyShen请重新审视。没有任何指标。这表明指标不适用于此资源。您需要打开Microsoft Automation团队的支持票证进行调查。