您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

监视 Azure 门户中的存储帐户Monitor a storage account in the Azure portal

Azure 存储分析提供所有存储服务的指标,以及 Blob、队列和表的日志。Azure Storage Analytics provides metrics for all storage services, and logs for blobs, queues, and tables. 可以使用 Azure 门户来配置要为帐户记录哪些指标和日志,并配置图表来提供指标数据的可视表示形式。You can use the Azure portal to configure which metrics and logs are recorded for your account, and configure charts that provide visual representations of your metrics data.

建议查看存储(预览版) Azure MonitorWe recommend you review Azure Monitor for Storage (preview). 它是 Azure Monitor 的一项功能,通过提供 Azure 存储服务性能、容量和可用性的统一视图,提供对 Azure 存储帐户的全面监视。It is a feature of Azure Monitor that offers comprehensive monitoring of your Azure Storage accounts by delivering a unified view of your Azure Storage services performance, capacity, and availability. 它不要求你启用或配置任何内容,你可以立即从预定义的交互式图表和包含的其他可视化效果中查看这些度量值。It does not require you to enable or configure anything, and you can immediately view these metrics from the pre-defined interactive charts and other visualizations included.

备注

在 Azure 门户中检查监视数据会产生相关的费用。There are costs associated with examining monitoring data in the Azure portal. 有关详细信息,请参阅存储分析For more information, see Storage Analytics.

Azure 文件目前支持存储分析指标,但尚不支持日志记录。Azure Files currently supports Storage Analytics metrics, but does not yet support logging.

有关使用存储分析及其他工具来识别、诊断和排查 Azure 存储相关问题的深入指导,请参阅监视、诊断和排查 Microsoft Azure 存储问题For an in-depth guide on using Storage Analytics and other tools to identify, diagnose, and troubleshoot Azure Storage-related issues, see Monitor, diagnose, and troubleshoot Microsoft Azure Storage.

为存储帐户配置监视Configure monitoring for a storage account

  1. Azure 门户中选择“存储帐户”,并单击存储帐户名称打开帐户仪表板。In the Azure portal, select Storage accounts, then the storage account name to open the account dashboard.

  2. 在菜单边栏选项卡的“监视”部分选择“诊断”。Select Diagnostics in the MONITORING section of the menu blade.

    监视选项

  3. 选择要监视的每个服务的指标数据类型,以及数据的保留策略Select the type of metrics data for each service you wish to monitor, and the retention policy for the data. 还可以通过将“状态”设置为“关闭”来禁用监视。You can also disable monitoring by setting Status to Off.

    监视选项

    若要设置数据保留策略,请移动“保留期(天)”滑块,或输入数据的保留天数(1 到 365 天)。To set the data retention policy, move the Retention (days) slider or enter the number of days of data to retain, from 1 to 365. 新存储帐户的默认保留期为 7 天。The default for new storage accounts is seven days. 如果不需要设置保留策略,请输入零。If you do not want to set a retention policy, enter zero. 如果没有保留策略,则是否删除监视数据由自己决定。If there is no retention policy, it is up to you to delete the monitoring data.

    警告

    手动删除指标数据会产生费用。You are charged when you manually delete metrics data. 陈旧的分析数据(超过保留策略的数据)将被系统删除,不会产生费用。Stale analytics data (data older than your retention policy) is deleted by the system at no cost. 建议根据要将帐户的存储分析数据保留多长时间来设置保留策略。We recommend setting a retention policy based on how long you want to retain storage analytics data for your account. 有关详细信息,请参阅按存储指标计费See Billing on storage metrics for more information.

  4. 完成监视配置后,选择“保存”。When you finish the monitoring configuration, select Save.

随后,一组默认的指标将显示在存储帐户边栏选项卡上的图表中,以及各个服务边栏选项卡(Blob、队列、表和文件)中。A default set of metrics is displayed in charts on the storage account blade, as well as the individual service blades (blob, queue, table, and file). 启用服务的指标后,最长可能需要一小时,数据才会显示在其图表中。Once you've enabled metrics for a service, it may take up to an hour for data to appear in its charts. 可以在任何指标图表中选择“编辑”,配置要在图表中显示的指标。You can select Edit on any metric chart to configure which metrics are displayed in the chart.

将“状态”设置为“关闭”可以禁用指标收集和日志记录。You can disable metrics collection and logging by setting Status to Off.

备注

Azure 存储使用表存储来存储存储帐户的指标,将指标存储在帐户中的表内。Azure Storage uses table storage to store the metrics for your storage account, and stores the metrics in tables in your account. 有关详细信息,请参阅:For more information, see. 指标的存储方式How metrics are stored.

自定义指标图表Customize metrics charts

使用以下过程选择要在指标图表中查看哪些存储指标。Use the following procedure to choose which storage metrics to view in a metrics chart.

  1. 首先在 Azure 门户中显示存储指标图表。Start by displaying a storage metric chart in the Azure portal. 可以在存储帐户边栏选项卡以及各个服务(Blob、队列、表和文件)的“指标”边栏选项卡中找到图表。You can find charts on the storage account blade and in the Metrics blade for an individual service (blob, queue, table, file).

    本示例使用“存储帐户边栏选项卡”上显示的以下图表:In this example, uses the following chart that appears on the storage account blade:

    在 Azure 门户中选择图表

  2. 单击图表中的任意位置以进行编辑。Click anywhere within the chart to edit the chart.

  3. 接下来,选择要在图表中显示的指标“时间范围”,以及要显示其指标的“服务”(Blob、队列、表或文件)。Next, select the Time Range of the metrics to display in the chart, and the service (blob, queue, table, file) whose metrics you wish to display. 此处已选择要显示 Blob 服务在过去一周的指标:Here, the past week's metrics are selected to display for the blob service:

    在“编辑图表”边栏选项卡中选择时间范围和服务

  4. 选择要在图表中显示的各个指标,并单击“确定”。Select the individual metrics you'd like displayed in the chart, then click OK.

    在“编辑图表”边栏选项卡选择各个指标

图表设置不会影响存储帐户中监视数据的收集、聚合或存储。Your chart settings do not affect the collection, aggregation, or storage of monitoring data in the storage account.

图表中可用的指标Metrics availability in charts

可用指标列表根据在下拉列表中选择的服务,以及要编辑的图表单位类型而异。The list of available metrics changes based on which service you've chosen in the drop-down, and the unit type of the chart you're editing. 例如,仅当所要编辑的图表显示百分比单位时,才能选择 PercentNetworkErrorPercentThrottlingError 等百分比指标:For example, you can select percentage metrics like PercentNetworkError and PercentThrottlingError only if you're editing a chart that displays units in percentage:

Azure 门户中的请求错误百分比图表

指标解析Metrics resolution

在“诊断”中选择的指标决定了可用于帐户的指标的解析:The metrics you selected in Diagnostics determines the resolution of the metrics that are available for your account:

  • “聚合”监视提供入口/出口、可用性、延迟和成功百分比等指标。Aggregate monitoring provides metrics such as ingress/egress, availability, latency, and success percentages. 系统将从 Blob、表、文件和队列服务聚合这些指标。These metrics are aggregated from the blob, table, file, and queue services.
  • “按 API”除了提供服务级别的聚合外,还提供更精细的解析,包括可用于单个存储操作的指标。Per API provides finer resolution, with metrics available for individual storage operations, in addition to the service-level aggregates.

配置指标警报Configure metrics alerts

可以创建警报,以便在达到存储资源指标的阈值时收到通知。You can create alerts to notify you when thresholds have been reached for storage resource metrics.

  1. 若要打开“警报规则”边栏选项卡,请向下滚动到“菜单”边栏选项卡的“监视”部分,并选择“警报(经典)”。To open the Alert rules blade, scroll down to the MONITORING section of the Menu blade and select Alerts (classic).
  2. 选择“添加指标警报(经典)”以打开“添加警报规则”边栏选项卡Select Add metric alert (classic) to open the Add an alert rule blade
  3. 为新的警报规则输入“名称”和“描述”。Enter a Name and Description for your new alert rule.
  4. 选择要为其添加警报的指标,以及警报条件阈值Select the Metric for which you'd like to add an alert, an alert Condition, and a Threshold. 阈值单位类型根据所选的指标而异。The threshold unit type changes depending on the metric you've chosen. 例如,“计数”是 ContainerCount 的单位类型,而 PercentNetworkError 指标的单位是百分比。For example, "count" is the unit type for ContainerCount, while the unit for the PercentNetworkError metric is a percentage.
  5. 选择“时间段”。Select the Period. 在该时间段内达到或超过阈值的指标将触发警报。Metrics that reach or exceed the Threshold within the period trigger an alert.
  6. (可选)配置“电子邮件”和“Webhook”通知。(Optional) Configure Email and Webhook notifications. 有关 Webhook 的详细信息,请参阅针对 Azure 指标警报配置 WebhookFor more information on webhooks, see Configure a webhook on an Azure metric alert. 如果未配置电子邮件或 Webhook 通知,警报只会显示在 Azure 门户中。If you do not configure email or webhook notifications, alerts will appear only in the Azure portal.

Azure 门户中的“添加警报规则”边栏选项卡

将指标图表添加到门户仪表板Add metrics charts to the portal dashboard

可将任何存储帐户的 Azure 存储指标图表添加到门户仪表板。You can add Azure Storage metrics charts for any of your storage accounts to your portal dashboard.

  1. Azure 门户中查看仪表板的同时单击“编辑仪表板”。Select click Edit dashboard while viewing your dashboard in the Azure portal.

  2. 在“磁贴库”中,选择“查找磁贴,依据” > “类型”。In the Tile Gallery, select Find tiles by > Type.

  3. 选择“类型” > “存储帐户”。Select Type > Storage accounts.

  4. 在“资源”中,选择要将其指标添加到仪表板的存储帐户。In Resources, select the storage account whose metrics you wish to add to the dashboard.

  5. 选择“类别” > “监视”。Select Categories > Monitoring.

  6. 将图表磁贴拖放到要显示的指标所在的仪表板中。Drag-and-drop the chart tile onto your dashboard for the metric you'd like displayed. 针对要在仪表板上显示的所有指标重复上述步骤。Repeat for all metrics you'd like displayed on the dashboard. 在下图中,为了方便演示,已突出显示“Blob - 请求总数”图表,但可将所有图表放置在仪表板上。In the following image, the "Blobs - Total requests" chart is highlighted as an example, but all the charts are available for placement on your dashboard.

    Azure 门户中的磁贴库

  7. 添加完图表后,请选择仪表板顶部附近的“完成自定义”。Select Done customizing near the top of the dashboard when you're done adding charts.

将图表添加到仪表板后,可以根据“自定义指标图表”所述进一步自定义这些图表。Once you've added charts to your dashboard, you can further customize them as described in Customize metrics charts.

配置日志记录Configure logging

可以指示 Azure 存储保存针对 Blob、表和队列服务发出的读取、写入和删除请求的诊断日志。You can instruct Azure Storage to save diagnostics logs for read, write, and delete requests for the blob, table, and queue services. 设置的数据保留策略也适用于这些日志。The data retention policy you set also applies to these logs.

备注

Azure 文件目前支持存储分析指标,但尚不支持日志记录。Azure Files currently supports Storage Analytics metrics, but does not yet support logging.

  1. Azure 门户中选择“存储帐户”,并单击存储帐户的名称打开存储帐户边栏选项卡。In the Azure portal, select Storage accounts, then the name of the storage account to open the storage account blade.

  2. 在菜单边栏选项卡的“监视”部分选择“诊断”。Select Diagnostics in the MONITORING section of the menu blade.

    Azure 门户中“监视”下面的诊断菜单项。

  3. 确保“状态”设置为“打开”,选择要为其启用日志记录的服务Ensure Status is set to On, and select the services for which you'd like to enable logging.

    在 Azure 门户中配置日志记录

  4. 单击“保存”。Click Save.

诊断日志保存在存储帐户下名为 $logs 的 Blob 容器中。The diagnostics logs are saved in a blob container named $logs in your storage account. 可以使用 Microsoft 存储资源管理器等存储资源管理器,或者使用存储客户端库或 PowerShell 以编程方式来查看日志数据。You can view the log data using a storage explorer like the Microsoft Storage Explorer, or programmatically using the storage client library or PowerShell.

有关如何访问 $logs 容器的信息,请参阅存储分析日志记录For information about accessing the $logs container, see Storage analytics logging.

后续步骤Next steps