Monitoring is a key area on any type of IT environment. It does not matter if we are using on-premises, cloud, or hybrid environments. The operations team must be able to see and be alerted how services and applications are performing and act when necessary. Microsoft Azure offers several services to help the IT operations team measure and analyze logs of any given resource within the Azure fabric. By default, we have Azure Monitor, which allows the management of metrics, activity logs, and alerts. However, we can take advantage of more advanced solutions such as Log Analytics/OMS, Application Insights, Network Watcher. These services are more focused on certain resources and areas that we may want to monitor.
In this article, we will explore Azure Monitor and how to take advantage of the Metrics and Alerts features. Azure Monitor is native to the Azure platform and it is a great help to monitor your resources in Microsoft Azure.
Using Azure Metrics
Azure Metrics allows the administrator to use almost real-time information from Azure Resources (one-minute frequency by default, unless stated otherwise in the resource documentation), and they are available to use by default (no configuration required).
By default, metrics are kept for 30 days, however, the cloud administrator is able to configure long-term archival of any given metrics and diagnostics logging.
If you have used Microsoft Azure and play around with VMs, you probably have already seen the core monitoring service. Click on any running VM using Microsoft Portal, click on Metrics (item 1 in the screenshot below). On the right blade we will see all available metrics (item 2). When selecting specific metrics from the list on the left, the graph on the right side will be automatically updated with the information selected. We can select time range and type of chart.
Note: When guest OS diagnostics is not enabled on the VM, the only metrics available are coming from the host.
The Metric component is in the process to be revamped. You may have noticed in the previous image the banner saying Launch the Preview of the new metrics experience. Click on it in case you haven’t done already.
The new Metrics (currently in preview) is easier on the eye. The administrator can start adding data (item 1, below) and then filter on the fly and use multidimensional (item 2). There are also several options to pick the time range of the information being displayed. We can add more than one graph to the same blade, we can add the graph defined here on the Azure Dashboard, clone the existent graph, and export to Excel (item 3).
Okay, we have checked the Metrics item from the VM perspective. Time to use the same from Monitor. You can search for Monitor or click on it on the left side (if you have it on your list of favorite services) in Azure Portal.
Click on Metrics (preview), and now we have a different view. Instead of having a focus on a specific resource, we need to start by selecting which resource we want from the Azure fabric. To mention a few: public IPs, storage accounts, VMs, automation accounts, NSGs, and so forth. The same features are available on the graphs created here (close, send to dashboard, and customization).
Managing Action Groups
Before diving into the Alerts world, we need to configure Actions Groups, which is located within the Azure Monitor under the Settings section on the left. A list of all existent Action Groups will be displayed on the blade located on the right. We can create a new one using Add Action Group button.
Actions Groups allows notification in several ways with end users and applications. Here are some of the possible ways to use Action Groups with Alerts:
- Message (email)
- Azure app push notification
- Logic app
- ITSM Connector (currently supported systems are System Center Service Manager, ServiceNow, Cherwell, Provance)
- Automation runbook
In the new blade, we can start creating actions by defining name, type, and edit the details. You can configure one Action Name for each person/resource that will receive the message when using Email/SMS/Push/Voice and use one or more methods to notify.
In the example below, we created an Action Group called Operations and we have three actions, and on each one, we configured accordingly to send either an SMS or email. We can see in detail the action name acct-email, where we enabled Email and configure the email of the operator and/or group.
Note: The Status column helps the cloud administrator to check if any given user is subscribed or not to the Action Group.
The member of the action group will receive a message, which will start coming as part of the Actions Groups. The example below shows an SMS welcome message. The user has the ability to stop receiving messages by replying STOP or Disable Support.
Alerts are also changing, and we will focus on the new Alerts feature. The previous alerts were renamed to Alerts (classic). At this point, the alerts rules are visible on both components, but we will focus on the Alerts because that is the direction in which Azure Monitor is going.
The Alerts feature has a simple and yet useful initial page from where the cloud administrator is able to check in a single glance all fired alerts, the number of alert rules (item 3, below), and to manage and or create new Alert Rules (item 2).
We can start creating an alert to inform when CPU utilization is higher than 75 percent. Click on New alert rule, and a new blade with three steps will be displayed.
In the Define Alert Condition, we will define the target, which could be a specific VM from our environment. In our case, we will use vmtest by using the button Select Target. We will also click on Add Criteria and on the new blade we can select from a list of available signal logic, select Percentage CPU, and on the next blade (still on the right side) we can define the threshold — a nice feature is that it uses historical data, so you can see at firsthand if the threshold being created would have triggered an alert in the past or not.
In the Define Alert Details section, we will define the alert name, description, and severity, and if we want to enable this Alert Rule upon creation.
In the Define Action Group section, we will select the previous Action Group created in the previous step.
Time to test our alert! Log on to the VM that we defined in the Alert creation. Download the SysInternals tool called CPU Stress and activate it to make sure that your CPU is above the threshold defined in the Alert rule.
Based on the configuration, we can see the alert being fired on the Alerts blade (item 2, below).
Azure Monitor: A powerful service
Azure Monitor helps the cloud administrator have a central location to monitor and operate the Azure environment. The tendency is for all new Azure resources to take advantage of Azure Monitor capabilities and in this article, we have just scratched the surface. There is a lot more to see and take advantage of with Azure Monitor service.
Photo credit: Shutterstock