我正在尝试将azure指标与我的仪表板应用程序(网络应用程序)集成,以便使用api请求进行实时监控。我尝试使用警报规则,但没有响应。
我提出的这个样本请求:
url:https://management.azure.com/subscriptions/XXXXXX-XXXX-XXXX-XXXX-XXXXX/resourceGroups/pwcdfp/providers/microsoft.insights/alertrules/test?api-version=2016-03-01
有效载荷:
{
"id": "/subscriptions/b3728f4e-cba5-44e2-bf02-b03e7fd1d94e/resourceGroups/pwcdfp/providers/microsoft.insights/alertrules/test",
"name": "test",
"type": "Microsoft.Insights/alertRules",
"location": "southeastasia",
"tags": {
"$type": "Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage",
"hidden-link:/subscriptions/b3728f4e-cba5-44e2-bf02-b03e7fd1d94e/resourceGroups/pwcdfp/providers/Microsoft.ClassicCompute/virtualMachines/pwcdfp": "Resource"
},
"properties": {
"name": "test",
"description": "test",
"isEnabled": true,
"condition": {
"$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.ThresholdRuleCondition, Microsoft.WindowsAzure.Management.Mon.Client",
"odata.type": "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
"dataSource": {
"$type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.RuleMetricDataSource, Microsoft.WindowsAzure.Management.Mon.Client",
"odata.type": "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
"resourceUri": "/subscriptions/b3728f4e-cba5-44e2-bf02-b03e7fd1d94e/resourceGroups/pwcdfp/providers/Microsoft.ClassicCompute/virtualMachines/pwcdfp",
"metricName": "Disk Read Bytes/sec"
},
"threshold": 1,
"windowSize": "PT5M",
"timeAggregation": "Average"
},
"lastUpdatedTime": "2016-09-19T05:34:38.6351894Z",
"provisioningState": "Succeeded",
"actions": []
}
}
content type: application/json
Authorization token:
SharedAccessSignature uid=57d95d630ac0d2007b030003&ex=2016-09-17T09:10:00.0000000Z&sn=F3s+t2ufw76Bmh9SuoYYnF4zek0v/2jz7NXbLYssk1vwnMhcAeNxLwiA1Sg2Q5aEiQw/yPPYrmVNJbaiJOC61g==
答案 0 :(得分:0)
问题有点不清楚,因为您首先询问如何获取Azure监控数据,然后描述警报,这是基于监控数据采取的操作。如果您尝试定期从Classic Compute VM获取指标数据,则警报不是正确的方法。仅在满足特定阈值时才会触发警报。相反,您可以使用.NET SDK来获取该数据。
并非所有资源都使用此SDK提供指标。特别是对于经典计算VM,除非您已启用Azure诊断,否则不会收到任何指标。您可以通过导航到Azure门户中的刀片来执行此操作,转到"诊断"并检查"基本指标。"