Introduction
Monitoring an Azure Linux virtual machine empowers teams to receive timely alerts on critical infrastructure changes and quickly address issues that could impact business operations.
Through Azure Monitor, Log Analytics, and other tools, you can set up an efficient monitoring system that includes alerts, diagnostics, and automation.
This article guides you through setting up Azure Monitor and Log Analytics for your virtual machine. It enables you to configure alerts, create action groups, and even simulate real-world scenarios. Whether you're just exploring or actively managing VMs, these skills are essential for keeping your cloud infrastructure running smoothly.
Architecture diagram
) lab files from https://github.com/MicrosoftLearning/AZ-104-MicrosoftAzureAdministrator/blob/master/Allfiles/Labs/11/az104-11-vm-template.json
https://portal.azure.com.Cancel the Welcome to Microsoft Azure splash screen.
Deploy a custom template.
Build your own template in the editor.
Load file.Open.
Take a moment to review the template. We are deploying a
virtual network with a Linux virtual machine
Save your changes.
Review + Create, then select Create.
###Configure VM Insights.
To enable Insights for a virtual machine.
Running.
Monitoring section, select Insights, and then Enable.
VM2Rule1.Create.
Configure.
Configure action groups
Steps to create an action group and configure a notification method.
- Continue working on your virtual machine. In the
Monitoringsection, selectAlerts. - Select
+ Createand thenAction group.

- On the
Basicstab, enter the following values for each setting.

- Select
Next: Notifications >. Notifications determine how the action group is alerted. We will be using email notifications. - Select Email, and in the Email box, enter your email address, and then select
OK.

- Complete the Notifications tab by adding a Name for the action group,
Help Desk. - Finish creating the action group by selecting
Review + Createand thenCreate.

Create alerts
Steps to create two alert rules.
- In the Monitor section, select Alerts.
- Select Create + and select Alert rule.

Create an alert rule based on CPU percentage usage
- In the Signal name drop-down select Percentage CPU.
- You want to be alerted when the CPU threshold is over 90%. So, change the Threshold value to
90. - You also need to adjust the When to evaluate settings. It is important to be reasonable about how often the alert is checked.

- Select the
Next: Actions>tab,Use action groups, then choose theHelp Deskaction group and click select .

- Move to the Details tab, and complete the required information.

- Select Review + create, then select Create.


Create an alert based on log activity
- Select Create + and select Alert rule.
- On the Condition tab select See all signals.

- Search for and select Create or Update Virtual Machine (Virtual Machines).
Applyyour changes.

- In the Alert logic area (scroll down) review the Event level selections. Leave the default of All selected.
- Review the Status drop-down selections. Leave the default of All selected.
- On the Actions tab,
Use action groups, then choose theHelp Deskaction group and clickSelect.

- Move to the Actions tab, Select action groups, then choose the
Help Deskaction group and clickSelect. - Move to the Details tab and enter the following values for each setting.

- Select Review + create, then select Create.

Trigger an alert by resizing the virtual machine
Steps to review performance data and resize a virtual machine.
- Continue working with your virtual machine.
- In the Monitoring section select the Metrics blade. Take a few minutes to explore features like the variety of Line charts, chart Metrics, New alert rule from your data. You can Save to the dashboard.

- In the Monitoring section select the Logs blade. If necessary, close the Welcome to Log Analytics page. Take a few minutes to explore the Topic drop-down select Resource type and then Virtual machines, the Count heartbeats or Virtual Machine available memory.

Take time to explore and Run any queries of interest.

- In the Availability + scale blade, select Size.
- Set the virtual machine size to DS2_v2 and click Resize. If prompted, confirm the change.

- Navigate to the Alerts blade. Resizing the virtual machine should have triggered your VM2Changed alert rule. If needed, Refresh the page.

- Select an alert and review the details. Edit the User response and ensure the status is Acknowledged. Save your changes.

- You should also receive an email notification that reads, Important notice: Azure Monitor alert VM was updated… If not, open your email program and look for an email from [email protected].
Configure an alert processing rule (optional)
To create an alert processing rule.
- Continue in the Alerts blade, select Alert processing rules and then + Create.

- Notice the alert scope is VM2.
- Select Next: Rule settings, then select Suppress notifications.

- Select Next: Scheduling.

- Define a rule to suppress notifications during overnight maintenance.

- Select Next: Details and enter these settings:

- Select Review + create to validate your input, then select Create.


SOCIAL SHARE CARD GENERATOR