排查指标图表问题Troubleshooting metrics charts

在 Azure 指标资源管理器中创建、自定义或解释图表时如果遇到问题,请参考本文。Use this article if you run into issues with creating, customizing, or interpreting charts in Azure metrics explorer. 如果你不熟悉指标,请参阅指标资源管理器入门指标资源管理器的高级功能If you are new to metrics, learn about getting started with metrics explorer and advanced features of metrics explorer. 还可以查看配置的指标图表示例You can also see examples of the configured metric charts.

找不到要选择的资源Can't find your resource to select it

你已单击“选择资源”按钮,但资源选取器对话框中未显示你的资源。 You clicked on the Select a resource button, but don't see your resource in the resource picker dialog.

解决方案: 只有在选择订阅和资源组之后,指标资源管理器才会列出可用的资源。Solution: Metrics explorer requires you to select subscriptions and resource groups before listing available resources. 如果看不到你的资源:If you don't see your resource:

  1. 确保已在“订阅”下拉列表中选择正确的订阅。 Ensure that you've selected correct subscription in the Subscription dropdown. 如果你的订阅未列出,请单击“目录 + 订阅设置”,并添加包含资源的订阅。 If your subscription isn't listed, click on the Directory + Subscription settings and add a subscription with your resource.

  2. 确保已选择正确的资源组。Ensure that you've selected the correct resource group.

    警告

    为提供最佳性能,当你首次打开指标资源管理器时,“资源组”下拉列表中不会包含预先选择的资源组。 For best performance, when you first open metrics explorer, the Resource group dropdown has no pre-selected resource groups. 必须至少选择一个组才能看到任何资源。You must pick at least one group before you can see any resources.

图表未显示任何数据Chart shows no data

有时,在选择正确的资源和指标后,图表可能不会显示任何数据。Sometimes the charts might show no data after selecting correct resources and metrics. 此行为可能是由以下多种原因造成的:This behavior can be caused by several of the following reasons:

未为你的订阅注册 Microsoft.Insights 资源提供程序Microsoft.Insights resource provider isn't registered for your subscription

需要在订阅中注册 Microsoft.Insights 资源提供程序才能浏览指标。Exploring metrics requires Microsoft.Insights resource provider registered in your subscription. 在许多情况下,该资源提供程序会自动注册(即,配置警报规则、自定义任何资源的诊断设置或配置自动缩放规则之后)。In many cases, it is registered automatically (that is, after you configure an alert rule, customize diagnostic settings for any resource, or configure an autoscale rule). 如果未注册 Microsoft.Insights 资源提供程序,必须遵循 Azure 资源提供程序和类型中所述的步骤手动将其注册。If the Microsoft.Insights resource provider is not registered, you must manually register it by following steps described in Azure resource providers and types.

解决方案: 打开“订阅”>“资源提供程序”选项卡,检查是否为订阅注册了 Microsoft.InsightsSolution: Open Subscriptions, Resource providers tab, and verify that Microsoft.Insights is registered for your subscription.

你对资源没有足够的访问权限You don't have sufficient access rights to your resource

在 Azure 中,对指标的访问由 Azure 基于角色的访问控制 (Azure RBAC) 控制。In Azure, access to metrics is controlled by Azure role-based access control (Azure RBAC). 只有监视读取者监视参与者参与者的成员才能浏览任何资源的指标。You must be a member of monitoring reader, monitoring contributor, or contributor to explore metrics for any resource.

解决方案: 请确保你对要在其中浏览指标的资源拥有足够的权限。Solution: Ensure that you have sufficient permissions for the resource from which you are exploring metrics.

资源在选定的时间范围内未发出指标Your resource didn't emit metrics during the selected time range

某些资源不会持续发出指标。Some resources don’t constantly emit their metrics. 例如,Azure 不会收集已停止的虚拟机的指标。For example, Azure will not collect metrics for stopped virtual machines. 其他资源可能只在发生某种情况时才发出指标。Other resources might emit their metrics only when some condition occurs. 例如,显示事务处理时间的指标至少需要有一个事务发生。For example, a metric showing processing time of a transaction requires at least one transaction. 如果在选定的时间范围内未发生任何事务,图表自然是空的。If there were no transactions in the selected time range, the chart will naturally be empty. 此外,尽管 Azure 中的大部分指标每隔一分钟收集一次,但有些指标的收集频率更低。Additionally, while most of the metrics in Azure are collected every minute, there are some that are collected less frequently. 请参阅指标文档,了解有关你正在尝试浏览的指标的更多详细信息。See the metric documentation to get more details about the metric that you are trying to explore.

解决方案: 将图表时间更改为更大的范围。Solution: Change the time of the chart to a wider range. 一开始可以使用较大的时间粒度“过去 30 天”(或依赖于“自动时间粒度”选项)。You may start from “Last 30 days” using a larger time granularity (or relying on the “Automatic time granularity” option).

选取的时间范围超过 30 天You picked a time range greater than 30 days

Azure 中的大多数指标将存储 93 天Most metrics in Azure are stored for 93 days. 但是,在任何单个图表中,只能查询不超过 30 天的数据。However, you can only query for no more than 30 days worth of data on any single chart. 此限制不适用于基于日志的指标This limitation doesn't apply to log-based metrics.

解决方案: 如果你看到空白图表或者图表仅显示一部分指标数据,请确认时间选取器中的开始日期与结束日期之差是否不超过 30 天间隔。Solution: If you see a blank chart or your chart only displays part of metric data, verify that the difference between start- and end- dates in the time picker doesn't exceed the 30-day interval.

所有指标值超过了已锁定的 y 轴范围All metric values were outside of the locked y-axis range

锁定图表 y 轴的边界时,你可能无意中造成图表显示区域不显示图表线条。By locking the boundaries of chart y-axis, you can unintentionally make the chart display area not show the chart line. 例如,如果 y 轴已锁定为 0% 到 50% 的范围,而指标包含 100% 的常量值,则线条始终会显示在可视区域的外部,使图表看上去是空白的。For example, if the y-axis is locked to a range between 0% and 50%, and the metric has a constant value of 100%, the line is always rendered outside of the visible area, making the chart appear blank.

解决方案: 确认图表的 y 轴边界是否未锁定在指标值的范围以外。Solution: Verify that the y-axis boundaries of the chart aren’t locked outside of the range of the metric values. 如果 y 轴边界已锁定,你可以暂时将其重置,以确保指标值不超过图表范围。If the y-axis boundaries are locked, you may want to temporarily reset them to ensure that the metric values don’t fall outside of the chart range. 不建议使用 summinmax 聚合以自动粒度锁定图表的 y 轴范围,因为在调整浏览器窗口大小或者更改不同的屏幕分辨率时,图表值会随着粒度而变化。Locking the y-axis range isn’t recommended with automatic granularity for the charts with sum, min, and max aggregation because their values will change with granularity by resizing browser window or going from one screen resolution to another. 切换粒度可能会使图表显示区域保持空白。Switching granularity may leave the display area of your chart empty.

你正在查看来宾 OS 指标,但未启用 Azure 诊断扩展You are looking at a Guest OS metric but didn’t enable Azure Diagnostic Extension

收集来宾 OS 指标需要配置 Azure 诊断扩展,或使用资源的“诊断设置”面板来启用该扩展。 Collection of Guest OS metrics requires configuring the Azure Diagnostics Extension or enabling it using the Diagnostic Settings panel for your resource.

解决方案: 如果 Azure 诊断扩展已启用,但你仍然无法看到指标,请遵循 Azure 诊断扩展故障排除指南中所述的步骤。Solution: If Azure Diagnostics Extension is enabled but you are still unable to see your metrics, follow steps outlined in Azure Diagnostics Extension troubleshooting guide. 另请参阅无法选取来宾 OS 命名空间和指标的故障排除步骤See also the troubleshooting steps for Cannot pick Guest OS namespace and metrics

仪表板上显示“检索数据时出错”消息“Error retrieving data” message on dashboard

如果仪表板是使用后来已弃用并已从 Azure 中删除的某个指标创建的,则可能会发生此问题。This problem may happen when your dashboard was created with a metric that was later deprecated and removed from Azure. 若要确认是否存在这种情况,请打开资源的“指标”选项卡,然后检查指标选取器中的可用指标。 To verify that it is the case, open the Metrics tab of your resource, and check the available metrics in the metric picker. 如果该指标未显示,则表示它已从 Azure 中删除。If the metric is not shown, the metric has been removed from Azure. 一般情况下,如果某个指标已弃用,会有一个更好的新指标可以提供有关资源运行状况的类似透视图。Usually, when a metric is deprecated, there is a better new metric that provides with a similar perspective on the resource health.

解决方案: 在仪表板上选取图表的备选指标来更新出错的磁贴。Solution: Update the failing tile by picking an alternative metric for your chart on dashboard. 可以查看 Azure 服务的可用指标列表You can review a list of available metrics for Azure services.

图表显示虚线Chart shows dashed line

Azure 指标图表使用虚线样式来指示两个已知时间粒度数据点之间存在缺失值(也称为“null 值”)。Azure metrics charts use dashed line style to indicate that there is a missing value (also known as “null value”) between two known time grain data points. 例如,如果你在时间选择器中选择了“1 分钟”时间粒度,但指标是在 07:26、07:27、07:29 和 07:30 报告的(请注意第二和第三个数据点之间的分钟间隔),则 07:27 和 07:29 数据点之间会以虚线连接,所有其他数据点之间以实线连接。For example, if in the time selector you picked “1 minute” time granularity but the metric was reported at 07:26, 07:27, 07:29, and 07:30 (note a minute gap between second and third data points), then a dashed line will connect 07:27 and 07:29 and a solid line will connect all other data points. 当指标使用 countsum 聚合时,虚线将下降到零。The dashed line drops down to zero when the metric uses count and sum aggregation. 对于 avgminmax 聚合,虚线将连接两个最接近的已知数据点。For the avg, min or max aggregations, the dashed line connects two nearest known data points. 此外,当图表最右侧或最左侧缺少数据时,虚线将朝缺失数据点的方向延长。Also, when the data is missing on the rightmost or leftmost side of the chart, the dashed line expands to the direction of the missing data point. 指标插图metric image

解决方案: 此行为是设计使然。Solution: This behavior is by design. 这样可以识别缺失的数据点。It is useful for identifying missing data points. 折线图能够出色地可视化高密度指标的趋势,但对于包含稀疏值的指标,可能很难解释,尤其是必须将值与时间粒度关联时。The line chart is a superior choice for visualizing trends of high-density metrics but may be difficult to interpret for the metrics with sparse values, especially when corelating values with time grain is important. 虚线可以方便阅读这些图表,但如果图表仍不清晰,请考虑使用不同的图表类型查看指标。The dashed line makes reading of these charts easier but if your chart is still unclear, consider viewing your metrics with a different chart type. 例如,对同一个指标使用散点图可以清晰地显示每个时间粒度,因为它只会在某个值存在时才可视化某个点,并在该值缺失时统一跳过数据点:指标插图For example, a scattered plot chart for the same metric clearly shows each time grain by only visualizing a dot when there is a value and skipping the data point altogether when the value is missing: metric image

备注

如果你仍然偏向于使用折线图来查看指标,将鼠标移到图表上可在鼠标指针位置突出显示数据点,这可能有助于评估时间粒度。If you still prefer a line chart for your metric, moving mouse over the chart may help to assess the time granularity by highlighting the data point at the location of the mouse pointer.

图表显示值出现意外的下降Chart shows unexpected drop in values

在许多情况下,指标值的明显下降是图表上显示的数据造成的一种错觉。In many cases, the perceived drop in the metric values is a misunderstanding of the data shown on the chart. 如果图表显示最近几分钟的数据,则总和或计数下降可能会给你造成误解,因为 Azure 此时尚未收到或处理最后的指标数据点。You can be misled by a drop in sums or counts when the chart shows the most-recent minutes because the last metric data points haven’t been received or processed by Azure yet. 指标处理延迟在几分钟范围内变化,具体取决于所用的服务。Depending on the service, the latency of processing metrics can be within a couple minutes range. 对于显示最近 1 分钟或 5 分钟粒度时间范围的图表,过去几分钟的值的下降会更明显:指标插图For charts showing a recent time range with a 1- or 5- minute granularity, a drop of the value over the last few minutes becomes more noticeable: metric image

解决方案: 此行为是设计使然。Solution: This behavior is by design. 我们相信,即使数据是部分性的或者不完整的,在收到数据后立即显示数据比较有利。 We believe that showing data as soon as we receive it is beneficial even when the data is partial or incomplete. 这样,就可以更快地做出重要结论,并立即开始调查。Doing so allows you to make important conclusion sooner and start investigation right away. 例如,对于显示失败次数的指标,查看部分值 X 可以判断,在给定的分钟内至少发生了 X 次失败。For example, for a metric that shows the number of failures, seeing a partial value X tells you that there were at least X failures on a given minute. 然后可以立即开始调查问题,而不是等到图表中显示此分钟内发生的确切失败次数,确切的数字可能不如立即调查那么重要。You can start investigating the problem right away, rather than wait to see the exact count of failures that happened on this minute, which might not be as important. 收到整个数据集后,图表将会更新,但此时,它可能还会显示更近时间内发生的新的不完整数据点。The chart will update once we receive the entire set of data, but at that time it may also show new incomplete data points from more recent minutes.

无法选取来宾 OS 命名空间和指标Cannot pick Guest OS namespace and metrics

虚拟机和虚拟机规模集有两种类别的指标:Azure 托管环境收集的虚拟机主机指标,以及虚拟机上运行的监视代理所收集的来宾 OS(经典)指标 。Virtual machines and virtual machine scale sets have two categories of metrics: Virtual Machine Host metrics that are collected by the Azure hosting environment, and Guest OS (classic) metrics that are collected by the monitoring agent running on your virtual machines. 启用 Azure 诊断扩展即可安装监视代理。You install the monitoring agent by enabling Azure Diagnostic Extension.

默认情况下,来宾 OS 指标存储在 Azure 存储帐户中,可通过资源的“诊断设置”选项卡选取这些指标。 By default, Guest OS metrics are stored in Azure Storage account, which you pick from the Diagnostic settings tab of your resource. 如果未收集来宾 OS 指标或者指标资源管理器无法访问这些指标,则你只会看到“虚拟机主机”指标命名空间: If Guest OS metrics aren't collected or metrics explorer cannot access them, you will only see the Virtual Machine Host metric namespace:

图表上的

解决方案: 如果在指标资源管理器中未看到“来宾 OS (经典)”命名空间和指标: Solution: If you don't see Guest OS (classic) namespace and metrics in metrics explorer:

  1. 确认 Azure 诊断扩展已启用并配置为收集指标。Confirm that Azure Diagnostic Extension is enabled and configured to collect metrics.

    警告

    无法使用 Log Analytics 代理(也称为 Microsoft Monitoring Agent 或“MMA”)将“来宾 OS”指标发送到存储帐户。 You cannot use Log Analytics agent (also referred to as the Microsoft Monitoring Agent, or "MMA") to send Guest OS into a storage account.

  2. 请确保已为订阅注册 Microsoft.Insights 资源提供程序 。Ensure that Microsoft.Insights resource provider is registered for your subscription.

  3. 验证存储帐户是否不受防火墙的保护。Verify that storage account isn't protected by the firewall. Azure 门户需要对存储帐户的访问权限才能检索指标数据和绘制图表。Azure portal needs access to storage account in order to retrieve metrics data and plot the charts.

  4. 使用 Azure 存储资源管理器验证指标是否流入存储帐户。Use the Azure storage explorer to validate that metrics are flowing into the storage account. 如果未收集指标,请遵循 Azure 诊断扩展故障排除指南进行操作。If metrics aren't collected, follow the Azure Diagnostics Extension troubleshooting guide.

后续步骤Next steps