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

Azure Monitor 概述Azure Monitor overview

Azure Monitor 提供用于收集、分析和处理来自云与本地环境的遥测数据的综合解决方案,可将应用程序和服务的可用性和性能最大化。Azure Monitor maximizes the availability and performance of your applications and services by delivering a comprehensive solution for collecting, analyzing, and acting on telemetry from your cloud and on-premises environments. 它可以帮助你了解应用程序的性能,并主动识别影响应用程序及其所依赖资源的问题。It helps you understand how your applications are performing and proactively identifies issues affecting them and the resources they depend on.

可以使用 Azure Monitor 执行的操作的几个示例包括:Just a few examples of what you can do with Azure Monitor include:


此服务支持Azure Lighthouse,后者允许服务提供商登录到自己的租户,以管理客户已委派的订阅和资源组。This service supports Azure Lighthouse, which lets service providers sign in to their own tenant to manage subscriptions and resource groups that customers have delegated.


下图提供了 Azure Monitor 的概要视图。The following diagram gives a high-level view of Azure Monitor. 示意图的中心是用于指标和日志(Azure Monitor 使用的两种基本类型的数据)的数据存储。At the center of the diagram are the data stores for metrics and logs, which are the two fundamental types of data used by Azure Monitor. 左侧是用于填充这些数据存储监视数据源On the left are the sources of monitoring data that populate these data stores. 右侧是 Azure Monitor 针对这些收集的数据执行的不同功能,例如分析、警报和流式传输到外部系统。On the right are the different functions that Azure Monitor performs with this collected data such as analysis, alerting, and streaming to external systems.

Azure Monitor 概述

监视数据平台Monitoring data platform

Azure Monitor 收集的所有数据属于以下两种基本类型之一:指标和日志All data collected by Azure Monitor fits into one of two fundamental types, metrics and logs. 指标是数字值,用于描述系统某些方面在特定时间点的情况。Metrics are numerical values that describe some aspect of a system at a particular point in time. 指标是轻型数据,可以支持近实时方案。They are lightweight and capable of supporting near real-time scenarios. 日志包含不同类型的已经整理成记录的数据,每种类型都有不同的属性集。Logs contain different kinds of data organized into records with different sets of properties for each type. 与性能数据一样,事件和跟踪等遥测数据也作为日志存储,因此,可将它们合并以进行分析。Telemetry such as events and traces are stored as logs in addition to performance data so that it can all be combined for analysis.

Azure 门户中的“概述”页会直接显示 Azure Monitor 针对许多 Azure 资源收集的数据。For many Azure resources, you'll see data collected by Azure Monitor right in their Overview page in the Azure portal. 例如,在查看任一虚拟机时,多个图表会显示性能指标。Have a look at any virtual machine for example, and you'll see several charts displaying performance metrics. 单击任一图形会在 Azure 门户上的指标资源管理器中打开数据,可在其中绘制多个指标在不同时间段的值的图表。Click on any of the graphs to open the data in metrics explorer in the Azure portal, which allows you to chart the values of multiple metrics over time. 可以通过交互方式查看图表,也可以将其固定到某个仪表板,与其他可视化效果一起查看。You can view the charts interactively or pin them to a dashboard to view them with other visualizations.


可以使用查询来分析 Azure Monitor 收集的日志数据,这些查询可以快速检索、合并和分析所收集的数据。Log data collected by Azure Monitor can be analyzed with queries to quickly retrieve, consolidate, and analyze collected data. 可以使用 Azure 门户中的 Log Analytics 创建和测试查询,然后可以直接使用不同的工具分析数据,或者保存查询以便与可视化效果警报规则配合使用。You can create and test queries using Log Analytics in the Azure portal and then either directly analyze the data using different tools or save queries for use with visualizations or alert rules.

Azure Monitor 使用 Azure 数据资源管理器使用的 Kusto 查询语言的某个版本,该查询语言适用于简单的日志查询,但也包括高级功能,例如聚合、联接和智能分析。Azure Monitor uses a version of the Kusto query language used by Azure Data Explorer that is suitable for simple log queries but also includes advanced functionality such as aggregations, joins, and smart analytics. 可以通过多个课程快速了解此查询语言。You can quickly learn the query language using multiple lessons. 特定指南提供给已熟悉 SQLSplunk 的用户。Particular guidance is provided to users who are already familiar with SQL and Splunk.


Azure Monitor 收集哪些数据?What data does Azure Monitor collect?

Azure Monitor 可从各种源收集数据。Azure Monitor can collect data from a variety of sources. 可将应用程序的监视数据视为划分了层次,范围从应用程序、应用程序依赖的任何操作系统和服务,直到平台本身。You can think of monitoring data for your applications in tiers ranging from your application, any operating system and services it relies on, down to the platform itself. Azure Monitor 从以下每个层收集数据:Azure Monitor collects data from each of the following tiers:

  • 应用程序监视数据:有关编写的代码的性能和功能的数据,不管平台是什么。Application monitoring data: Data about the performance and functionality of the code you have written, regardless of its platform.
  • 来宾 OS 监视数据:有关运行应用程序的操作系统的数据。Guest OS monitoring data: Data about the operating system on which your application is running. 此应用程序可以在 Azure 中运行,也可以在其他云中或本地运行。This could be running in Azure, another cloud, or on-premises.
  • Azure 资源监视数据:有关 Azure 资源的操作的数据。Azure resource monitoring data: Data about the operation of an Azure resource.
  • Azure 订阅监视数据:有关 Azure 订阅操作和管理的数据,以及有关 Azure 本身运行状况和操作的数据。Azure subscription monitoring data: Data about the operation and management of an Azure subscription, as well as data about the health and operation of Azure itself.
  • Azure 租户监视数据:有关租户级 Azure 服务(例如 Azure Active Directory)操作的数据。Azure tenant monitoring data: Data about the operation of tenant-level Azure services, such as Azure Active Directory.

在创建 Azure 订阅并开始添加虚拟机和 Web 应用等资源后,Azure Monitor 会立即开始收集数据。As soon as you create an Azure subscription and start adding resources such as virtual machines and web apps, Azure Monitor starts collecting data. 活动日志记录创建或修改资源的时间。Activity logs record when resources are created or modified. 指标告知资源的性能如何,以及该资源消耗的资源。Metrics tell you how the resource is performing and the resources that it's consuming.

通过启用诊断将代理添加到计算资源,将数据收集范围扩展到资源的实际操作。Extend the data you're collecting into the actual operation of the resources by enabling diagnostics and adding an agent to compute resources. 这会收集资源内部操作的遥测数据,并可让你配置不同的数据源用于从 Windows 和 Linux 来宾操作系统收集日志与指标。This will collect telemetry for the internal operation of the resource and allow you to configure different data sources to collect logs and metrics from Windows and Linux guest operating system.

启用对应用程序服务应用程序VM 和虚拟机规模集应用程序的监视,以使 Application Insights 能够收集有关应用程序的详细信息,包括页面视图、应用程序请求和异常。Enable monitoring for your App Services application or VM and virtual machine scale set application, to enable Application Insights to collect detailed information about your application including page views, application requests, and exceptions. 通过配置可用性测试来模拟用户流量,进一步验证应用程序的可用性。Further verify the availability of your application by configuring an availability test to simulate user traffic.

自定义来源Custom sources

Azure Monitor 可以使用数据收集器 API 从任何 REST 客户端收集日志数据。Azure Monitor can collect log data from any REST client using the Data Collector API. 这样,便可以创建自定义监视方案,并将监视范围扩展到不通过其他源公开遥测数据的资源。This allows you to create custom monitoring scenarios and extend monitoring to resources that don't expose telemetry through other sources.


仅当能够有利于洞察计算环境的操作时,监视数据才有作用。Monitoring data is only useful if it can increase your visibility into the operation of your computing environment. Azure Monitor 包含多种功能和工具,可以提供应用程序及其依赖的其他资源的有用见解。Azure Monitor includes several features and tools that provide valuable insights into your applications and other resources that they depend on. 监视解决方案Application Insights用于容器的 Azure Monitor 等功能在应用程序和特定 Azure 服务的不同方面提供深入见解。Monitoring solutions and features such as Application Insights and Azure Monitor for containers provide deep insights into different aspects of your application and specific Azure services.

Application InsightsApplication Insights

无论 Web 应用程序托管在云中还是本地,Application Insights 都可以监视其可用性、性能和使用情况。Application Insights monitors the availability, performance, and usage of your web applications whether they're hosted in the cloud or on-premises. 它利用 Azure Monitor 中的强大数据分析平台来提供应用程序操作的深入见解,并可以诊断错误,无需等到用户报告这些问题。It leverages the powerful data analysis platform in Azure Monitor to provide you with deep insights into your application's operations and diagnose errors without waiting for a user to report them. Application Insights 包含各种开发工具的连接点,并与 Visual Studio 集成以支持 DevOps 过程。Application Insights includes connection points to a variety of development tools and integrates with Visual Studio to support your DevOps processes.

App Insights

用于容器的 Azure MonitorAzure Monitor for containers

用于容器的 Azure Monitor 功能旨在监视部署到 Azure Kubernetes 服务 (AKS) 上托管的托管 Kubernetes 群集的容器工作负荷的性能。Azure Monitor for containers is a feature designed to monitor the performance of container workloads deployed to managed Kubernetes clusters hosted on Azure Kubernetes Service (AKS). 它通过指标 API 从 Kubernetes 中提供的控制器、节点和容器收集内存和处理器指标,来提供性能可见性。It gives you performance visibility by collecting memory and processor metrics from controllers, nodes, and containers that are available in Kubernetes through the Metrics API. 容器日志也会被收集。Container logs are also collected. 从 Kubernetes 群集启用监视后,将通过适用于 Linux 的 Log Analytics 代理的容器化版本自动收集这些指标和日志。After you enable monitoring from Kubernetes clusters, these metrics and logs are automatically collected for you through a containerized version of the Log Analytics agent for Linux.


用于 VM 的 Azure MonitorAzure Monitor for VMs

用于 VM 的 Azure Monitor 分析 Windows 和 Linux VM 的性能与运行状况,包括其不同的进程以及与其他资源和外部进程之间的相互依赖关系,可以大规模监视 Azure 虚拟机 (VM)。Azure Monitor for VMs monitors your Azure virtual machines (VM) at scale by analyzing the performance and health of your Windows and Linux VMs, including their different processes and interconnected dependencies on other resources and external processes. 该解决方案支持监视本地或其他云提供程序中托管的 VM 的性能和应用程序依赖项。The solution includes support for monitoring performance and application dependencies for VMs hosted on-premises or another cloud provider.

VM Insights

监视解决方案Monitoring solutions

Azure Monitor 中的监视解决方案是打包的逻辑集,提供有关特定应用程序或服务的见解。Monitoring solutions in Azure Monitor are packaged sets of logic that provide insights for a particular application or service. 它们包括了用于为应用或服务收集监视数据的逻辑、用于分析该数据的查询,以及用于提供可视化效果的视图They include logic for collecting monitoring data for the application or service, queries to analyze that data, and views for visualization. 监视解决方案由 Microsoft 或合作伙伴提供,可针对各种 Azure 服务和其他应用程序提供监视。Monitoring solutions are available from Microsoft and partners to provide monitoring for various Azure services and other applications.


应对关键状况Responding to critical situations

除了让你以交互方式分析监视数据以外,有效的监视解决方案必须能够主动应对所收集的数据中指出的关键状况。In addition to allowing you to interactively analyze monitoring data, an effective monitoring solution must be able to proactively respond to critical conditions identified in the data that it collects. 应对措施可以是向负责调查问题的管理员发送短信或邮件。This could be sending a text or mail to an administrator responsible for investigating an issue. 或者,可以启动自动化过程来尝试纠正错误状况。Or you could launch an automated process that attempts to correct an error condition.


Azure Monitor 中的警报会主动发送有关关键状况的通知,并可能尝试采取纠正措施。Alerts in Azure Monitor proactively notify you of critical conditions and potentially attempt to take corrective action. 基于指标的警报规则根据数值提供近实时的警报,而基于日志的规则允许对多个源中的数据采用复杂的逻辑。Alert rules based on metrics provide near real time alerting based on numeric values, while rules based on logs allow for complex logic across data from multiple sources.

Azure Monitor 中的警报规则使用操作组,其中包含可在多个规则之间共享的独特接收者和操作集。Alert rules in Azure Monitor use action groups, which contain unique sets of recipients and actions that can be shared across multiple rules. 操作组可根据要求执行多种操作,例如,使用 Webhook 来让警报启动外部操作,或者与 ITSM 工具集成。Based on your requirements, action groups can perform such actions as using webhooks to have alerts start external actions or to integrate with your ITSM tools.



自动缩放是指在处理应用程序负载时让适当数量的资源运行。Autoscale allows you to have the right amount of resources running to handle the load on your application. 自动缩放允许创建规则,这些规则使用 Azure Monitor 收集的指标来确定何时要自动添加资源来应对负载增大的情况,并在空闲期删除资源以节省成本。It allows you to create rules that use metrics collected by Azure Monitor to determine when to automatically add resources to handle increases in load and also save money by removing resources that are sitting idle. 可以指定最小和最大实例数,并创建逻辑来控制何时要增加或减少资源。You specify a minimum and maximum number of instances and the logic for when to increase or decrease resources.


可视化监视数据Visualizing monitoring data

图表和表等可视化效果是用于汇总监视数据并向不同的受众呈现这些数据的有效工具。Visualizations such as charts and tables are effective tools for summarizing monitoring data and presenting it to different audiences. Azure Monitor 具有自身的可视化监视数据的功能,并可利用其他 Azure 服务将这些数据发布到不同的受众。Azure Monitor has its own features for visualizing monitoring data and leverages other Azure services for publishing it to different audiences.


使用 Azure 仪表板可将不同类型的数据(包括指标和日志)合并到 Azure 门户的单个窗格中。Azure dashboards allow you to combine different kinds of data, including both metrics and logs, into a single pane in the Azure portal. 可以选择与其他 Azure 用户共享仪表板。You can optionally share the dashboard with other Azure users. 除了任何日志查询或指标图表的输出以外,还可将整个 Azure Monitor 中的元素添加到 Azure 仪表板。Elements throughout Azure Monitor can be added to an Azure dashboard in addition to the output of any log query or metrics chart. 例如,可以创建一个包含多个磁贴的仪表板,这些磁贴分别用于显示指标图、活动日志表、Application Insights 的使用情况图表,以及日志查询的输出。For example, you could create a dashboard that combines tiles that show a graph of metrics, a table of activity logs, a usage chart from Application Insights, and the output of a log query.



视图在 Azure Monitor 中直观显示日志数据。Views visually present log data in Azure Monitor. 每个视图包含单个磁贴,使用该磁贴可以向下钻取到各种可视化效果的组合,例如汇总了关键数据的列表,以及条形图和折线图。Each view includes a single tile that drills down to a combination of visualizations such as bar and line charts in addition to lists summarizing critical data. 监视解决方案包含的视图汇总了特定应用程序的数据。你可以创建自己的视图来显示来自任何日志查询的数据。Monitoring solutions include views that summarize data for a particular application, and you can create your own views to present data from any log query. 与 Azure Monitor 中的其他元素一样,可将视图添加到 Azure 仪表板。Like other elements in Azure Monitor, views can be added to Azure dashboards.


Power BIPower BI

Power BI 是一个业务分析服务,可针对各种数据源提供交互式可视化效果,并且是将数据提供给组织内部和外部的其他人的有效方式。Power BI is a business analytics service that provides interactive visualizations across a variety of data sources and is an effective means of making data available to others within and outside your organization. 可将 Power BI 配置为自动从 Azure Monitor 导入日志数据,以利用这些附加的可视化效果。You can configure Power BI to automatically import log data from Azure Monitor to take advantage of these additional visualizations.

Power BI

集成和导出数据Integrate and export data

通常,我们需要将 Azure Monitor 与其他系统集成,并生成使用监视数据的自定义解决方案。You'll often have the requirement to integrate Azure Monitor with other systems and to build custom solutions that use your monitoring data. 其他 Azure 服务使用 Azure Monitor 来提供这种集成。Other Azure services work with Azure Monitor to provide this integration.

事件中心Event Hub

Azure 事件中心是一个流式传输平台和事件引入服务,可以使用任何实时分析提供程序或批处理/存储适配器来转换和存储数据。Azure Event Hubs is a streaming platform and event ingestion service that can transform and store data using any real-time analytics provider or batching/storage adapters. 使用事件中心可将 Azure Monitor 数据流式传输到合作伙伴 SIEM 和监视工具。Use Event Hubs to stream Azure Monitor data to partner SIEM and monitoring tools.

逻辑应用Logic Apps

使用逻辑应用服务可以通过与不同系统和服务集成的工作流将任务和业务流程自动化。Logic Apps is a service that allows you to automate tasks and business processes using workflows that integrate with different systems and services. 其中提供了用于在 Azure Monitor 中读取和写入指标与日志的活动,使你能够生成与其他各种系统相集成的工作流。Activities are available that read and write metrics and logs in Azure Monitor, which allows you to build workflows integrating with a variety of other systems.


可以使用多个 API 从/向 Azure Monitor 读取和写入指标与日志,以及访问生成的警报。Multiple APIs are available to read and write metrics and logs to and from Azure Monitor in addition to accessing generated alerts. 还可以配置和检索警报。You can also configure and retrieve alerts. 这样,几乎可以不受限制地生成与 Azure Monitor 集成的自定义解决方案。This provides you with essentially unlimited possibilities to build custom solutions that integrate with Azure Monitor.

后续步骤Next steps

了解有关以下方面的详细信息:Learn more about: