Azure Monitor Metrics overview
Azure Monitor Metrics is a feature of Azure Monitor that collects numeric data from monitored resources into a time series database. Metrics are numerical values that are collected at regular intervals and describe some aspect of a system at a particular time.
Metrics in Azure Monitor are lightweight and capable of supporting near real-time scenarios, so they're useful for alerting and fast detection of issues. You can analyze them interactively by using Metrics Explorer, be proactively notified with an alert when a value crosses a threshold, or visualize them in a workbook or dashboard.
Azure Monitor Metrics is one half of the data platform that supports Azure Monitor. The other is Azure Monitor Logs, which collects and organizes log and performance data and allows that data to be analyzed with a rich query language.
The Metrics feature can only store numeric data in a particular structure, whereas the Logs feature can store a variety of datatypes (each with its own structure). You can also perform complex analysis on log data by using log queries, which you can't use for analysis of metric data.
What can you do with Azure Monitor Metrics?
The following table lists the ways that you can use the Metrics feature in Azure Monitor.
|Analyze||Use Metrics Explorer to analyze collected metrics on a chart and compare metrics from various resources.|
|Alert||Configure a metric alert rule that sends a notification or takes automated action when the metric value crosses a threshold.|
|Visualize||Pin a chart from Metrics Explorer to an Azure dashboard.
Create a workbook to combine with multiple sets of data in an interactive report. Export the results of a query to Grafana to use its dashboarding and combine with other data sources.
|Automate||Use Autoscale to increase or decrease resources based on a metric value crossing a threshold.|
|Retrieve||Access metric values from a:|
|Export||Route metrics to logs to analyze data in Azure Monitor Metrics together with data in Azure Monitor Logs and to store metric values for longer than 93 days.
Stream metrics to an event hub to route them to external systems.
|Archive||Archive the performance or health history of your resource for compliance, auditing, or offline reporting purposes.|
Azure Monitor collects metrics from the following sources. After these metrics are collected in the Azure Monitor metric database, they can be evaluated together regardless of their source.
Azure resources. Platform metrics are created by Azure resources and give you visibility into their health and performance. Each type of resource creates a distinct set of metrics without any configuration required. Platform metrics are collected from Azure resources at one-minute frequency unless specified otherwise in the metric's definition.
Applications. Application Insights creates metrics for your monitored applications to help you detect performance issues and track trends in how your application is being used. Values include Server response time and Browser exceptions.
Virtual machine agents. Metrics are collected from the guest operating system of a virtual machine. You can enable guest OS metrics for Windows virtual machines by using the Windows diagnostic extension and for Linux virtual machines by using the InfluxData Telegraf agent.
Custom metrics. You can define metrics in addition to the standard metrics that are automatically available. You can define custom metrics in your application that's monitored by Application Insights or create custom metrics for an Azure service by using the custom metrics API.
For a complete list of data sources that can send data to Azure Monitor Metrics, see What is monitored by Azure Monitor?.
Use Metrics Explorer to interactively analyze the data in your metric database and chart the values of multiple metrics over time. You can pin the charts to a dashboard to view them with other visualizations. You can also retrieve metrics by using the Azure monitoring REST API.
For more information, see Getting started with Azure Monitor Metrics Explorer.
Data that Azure Monitor Metrics collects is stored in a time-series database that's optimized for analyzing time-stamped data. Each set of metric values is a time series with the following properties:
- The time that the value was collected.
- The resource that the value is associated with.
- A namespace that acts like a category for the metric.
- A metric name.
- The value itself.
- Multiple dimensions when they're present. Note that custom metrics are limited to 10 dimensions.
One of the challenges to metric data is that it often has limited information to provide context for collected values. Azure Monitor addresses this challenge with multi-dimensional metrics.
Dimensions of a metric are name/value pairs that carry additional data to describe the metric value. For example, a metric called Available disk space might have a dimension called Drive with values C: and D:. That dimension would allow viewing available disk space across all drives or for each drive individually.
The following example illustrates two datasets for a hypothetical metric called Network throughput. The first dataset has no dimensions. The second dataset shows the values with two dimensions, IP and Direction.
|8/9/2017 8:14||1,331.8 Kbps|
|8/9/2017 8:15||1,141.4 Kbps|
|8/9/2017 8:16||1,110.2 Kbps|
This nondimensional metric can only answer a basic question like "What was my network throughput at a given time?"
Network throughput and two dimensions ("IP" and "Direction")
|Timestamp||Dimension "IP"||Dimension "Direction"||Metric Value|
|8/9/2017 8:14||IP="192.168.5.2"||Direction="Send"||646.5 Kbps|
|8/9/2017 8:14||IP="192.168.5.2"||Direction="Receive"||420.1 Kbps|
|8/9/2017 8:14||IP="10.24.2.15"||Direction="Send"||150.0 Kbps|
|8/9/2017 8:14||IP="10.24.2.15"||Direction="Receive"||115.2 Kbps|
|8/9/2017 8:15||IP="192.168.5.2"||Direction="Send"||515.2 Kbps|
|8/9/2017 8:15||IP="192.168.5.2"||Direction="Receive"||371.1 Kbps|
|8/9/2017 8:15||IP="10.24.2.15"||Direction="Send"||155.0 Kbps|
|8/9/2017 8:15||IP="10.24.2.15"||Direction="Receive"||100.1 Kbps|
This metric can answer questions such as "What was the network throughput for each IP address?" and "How much data was sent versus received?" Multi-dimensional metrics carry additional analytical and diagnostic value compared to nondimensional metrics.
Viewing multi-dimensional performance counter metrics in Metrics Explorer
It's not possible to send performance counter metrics that contain an asterisk (*) to Azure Monitor via the Classic Guest Metrics API. This API can't display metrics that contain an asterisk because it's a multi-dimensional metric, which classic metrics don't support.
To configure and view multi-dimensional guest OS performance counter metrics by using the Azure Diagnostic extension:
Go to the Diagnostic settings page for your virtual machine.
Select the Performance counters tab.
Select Custom to configure the performance counters that you want to collect.
Select Sinks. Then select Enabled to send your data to Azure Monitor.
To view your metric in Azure Monitor, select Virtual Machine Guest in the Metric Namespace dropdown list.
Select Apply splitting and fill in the details to split the metric by instance. You can then see the metric broken down by each of the possible values represented by the asterisk in the configuration. In this example, the asterisk represents the logical disk volumes plus the total.
Retention of metrics
For most resources in Azure, platform metrics are stored for 93 days. There are some exceptions:
Classic guest OS metrics: These are performance counters collected by the Windows diagnostic extension or the Linux diagnostic extension and routed to an Azure storage account. Retention for these metrics is guaranteed to be at least 14 days, though no expiration date is written to the storage account.
For performance reasons, the portal limits how much data it displays based on volume. Therefore, the actual number of days that the portal retrieves can be longer than 14 days if the volume of data being written is not large.
Guest OS metrics sent to Azure Monitor Metrics: These are performance counters collected by the Windows diagnostic extension and sent to the Azure Monitor data sink, or the InfluxData Telegraf agent on Linux machines, or the newer Azure Monitor agent via data-collection rules. Retention for these metrics is 93 days.
Guest OS metrics collected by the Log Analytics agent: These are performance counters collected by the Log Analytics agent and sent to a Log Analytics workspace. Retention for these metrics is 31 days and can be extended up to 2 years.
Application Insights log-based metrics. Behind the scenes, log-based metrics translate into log queries. Their retention is variable and matches the retention of events in underlying logs (31 days to 2 years). For Application Insights resources, logs are stored for 90 days.
You can send platform metrics for Azure Monitor resources to a Log Analytics workspace for long-term trending.
As mentioned earlier, for most resources in Azure, platform metrics are stored for 93 days. However, you can only query (in the Metrics tile) for a maximum of 30 days worth of data on any single chart. This limitation doesn't apply to log-based metrics.
If you see a blank chart or your chart displays only part of metric data, verify that the difference between start and end dates in the time picker doesn't exceed the 30-day interval. After you've selected a 30-day interval, you can pan the chart to view the full retention window.
Подаване и преглед на обратна връзка за