Learn how to configure a dynamic alert to monitor an Azure virtual machine.
- [Instructor] Have you had to set up alerts on your virtual machines to alert you when the CPU has exceeded a set amount? And then you get all these alerts first thing in the morning when everyone logs in? Don't you wish that could be fine tuned? Well, in this week's weekly insight we're going to look at dynamic threshold alerts which allow you to fine tune those settings. Before we jump in to how to create a threshold alert, let's review how we normally create an alert for an Azure virtual machine.
I'm monitoring the Azure monitor and I'm going to go ahead and set up an alert. To start with, we need a resource. And I'm going to select VM1. Now we'll add the condition. In my example we're going to use percentage CPU. And as you can see by our chart, we do have a spike this morning.
We can go ahead and set our condition to greater than, greater than or equal to, less than, or less than and equal to. We're going to use greater than. We'll use average. And let's make our threshold let's say 60%. So now the condition is whenever the percentage CPU is greater than 60% we will be alerted. We're going to evaluate this based on the period. So over the last let's say 30 minutes. And the frequency that we'll run this query will be every five minutes.
And again you can fine tune these. That's it. We would now click done. And that is all we need to do for that alert. This is great, but what about the times when the load will exceed 60% due to normal operations or seasonal changes? You could increase from 60% to 80% but then you may miss some critical alerts that are outside the normal operations. And this is where dynamic alerts comes in. And please note that as of this recording in late December 2018, dynamic alerts are in limited private preview.
Dynamic alerts use machine learning to evaluate if the alert is from normal operations or if it's a true alert. The service itself will create a baseline for the alert. Right now we have it set for over the last six hours but I'm going to select to over the last week. In our example we can see the dynamic threshold in red. It's set to about 80%. And the other spikes in blue will not trigger the alert because now these are now the new normal.
And the nicest thing about dynamic alerts is once you've set it up, the machine learning in the back end will continue to learn the thresholds as the virtual machine continues to run. Now we can go ahead and set the condition based on our threshold. And you'll notice that it looks very similar to what we had in a static alert. Our condition is greater or less than. We can specify the aggregation. We're going to leave it as average. And then the alert sensitivity will be at medium. You can set it to high which will trigger more alerts and low will trigger not as many.
Now we need to set the number of violations that will trigger the alert. In our example here we need at least four violations in the past four periods, which equals two hours. And the condition is whenever the percentage CPU is greater or less than the dynamic threshold in four out of four periods then we'll be alerted. And finally we need to set the time span and the frequency to run this condition.
That's it. You would now click done. And finish configuring the alert as you normally would. Before you run and request the limited preview, this is preview meaning it could and probably will change. You may also want to monitor your resources to be sure the service is reporting correctly. I can't wait to see what else the dynamic alerts will be able to offer us in the future.
Note: Because this is an ongoing series, viewers will not receive a certificate of completion.