你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
有关在 Azure 门户中使用这些查询的信息,请参阅 Log Analytics 教程。 有关 REST API,请参阅查询。
DevCenter - DevBox 存储和计算使用情况细分(按开发环境的分区)
获取给定月份的总存储和计算单位。
let startSearchTime = startofmonth(now());
let endSearchTime = startofmonth(now(), 1); // The second parameter represents the number of months to offset from the input date.
DevCenterBillingEventLogs
| where OperationName == "DevBoxUsage"
and StartTime >= startSearchTime
and StartTime < endSearchTime
| summarize arg_min(StartTime, *) by EventId // This will remove any duplicate rows. NOTE: Usages with the same EventId are not double charged, the dupe rows are only related to double logging.
| extend DevBoxName = UsageResourceName
| extend DevBoxId = UsageResourceUniqueId
| summarize StorageHours = countif(UsageType == "Storage"),
StorageMeterQuantity = round(sum(iff(UsageType == "Storage", Quantity, 0.0)), 6),
TotalRunningHours = round(sum(iff(UsageType == "Compute", Quantity, 0.0)), 6),
NormalRateComputeHours = round(sum(iff(UsageType == "Compute" and IsOverMonthlyBillingCap == false, Quantity, 0.0)), 6),
DiscountRateComputeHours = round(sum(iff(UsageType == "Compute" and IsOverMonthlyBillingCap == true, Quantity, 0.0)), 6)
by DevBoxName, DevBoxId
| project-reorder DevBoxName, DevBoxId, StorageHours, StorageMeterQuantity, TotalRunningHours, NormalRateComputeHours, DiscountRateComputeHours
DevCenter - 按池划分的 DevBox 计费计量明细
按池获取给定月份的总计量单位。
let startSearchTime = startofmonth(now());
let endSearchTime = startofmonth(now(), 1); // The second parameter represents the number of months to offset from the input date.
DevCenterBillingEventLogs
| where OperationName == "DevBoxUsage"
and StartTime >= startSearchTime
and StartTime < endSearchTime
| summarize arg_min(StartTime, *) by EventId // This will remove any duplicate rows. NOTE: Usages with the same EventId are not double charged, the dupe rows are only related to double logging.
| extend Pool = tolower(BilledResourceId)
| summarize MeterUsage = round(sum(Quantity), 6)
by Pool, MeterId, UsageType