Monitoring an app is important and understanding when it's not performing correctly is critical. Find out how to configure notifications, metric value alerts, and activity log events for when an app's performance isn't as expected.
- [Instructor] As with any service, we should be notified of possible issues with that service. We can turn on alerts for our Azure apps to let us know something's not going as planned. Let's go ahead and show you how to turn on alerts. As you can see, I have already logged into Azure. I'm in the Web Deploy Apps Resource Group. And I'm going to open up the Prodwebapp plate. This is a web app that we created earlier in the course.
You will find alerts way down under monitoring. You may have to scroll down quite a bit. Click on alerts. As you can see, we do not have any alerts created yet. Go ahead and add alert. We'll start off with our resource. Even though we selected alerts from within the web app itself, we do have the option to apply the alert to the dev app service plan.
For our demo, we're going to apply it to just the app. We're going to provide a name for the alert. And I would recommend entering in a detailed description. That way others will know what this alert is for, as well. As you can see, we can choose an alert based on metrics or events. Let's start with metrics first. My drop down list of metrics you'll see that we have many options we can choose from.
But for our demo, I'm going to go ahead and choose the average response time. And this is the average response time that the app takes to respond to the request, measured in milliseconds. I'm going to scroll down a little bit. Next, we're going to set our condition. And we have a couple of options for our conditions, greater than, or less than, or equal to. I'm going to do greater than. And right now, we're set at one second.
I'm going to bump that up to 10 seconds. And how long does this have to last before we're alerted? We can go ahead and change that period, over the last five minutes, over the last 10, over the last hour, or we can do several hours. I'm going to do five minutes. And finally, what good is an alert if nobody knows about it? I'm going to go ahead and turn on email owners, contributors, and readers. That way, if we do have an issue, we are immediately notified of it.
You can add additional administrators or you can add in webhook if you're going to use a third-party monitoring system. One thing to keep in mind, the minute metrics are kept for 48 hours, the hour metrics are kept for 30 days, and the day metrics are kept for 90 days. I can go ahead and click okay. And we can see our alert has been added. Let's go ahead and add in another alert, but this one will be for an event.
I run through the same process, add alert, change my resource, provide a name, and again a description, and now I'm going to click on events. Scroll down a little bit. First we have our operation name. So we can select on all events, deletes, starts, or stops. We're going to go with all here.
Our status is failed or succeeded. Let me change this to succeeded. Next is our aggregation. We have none, so alert on every event or we can do it on a count. In this example, I'm going to go ahead and use the condition of greater than and let's say five. So five succeeds over the last, let's say, four hours.
I would like to be notified. And as before, I'm going to go ahead and select the email owners and contributors. Click okay. That's all there is to creating alerts in your apps. As you're developing your apps, I would highly recommend creating alerts until you have a really good feel of how that app is going to behave and the resources that are required for it.
- Deploying Web Apps
- Creating App Service plans
- Deploying and moving apps
- Configuring app settings
- Managing Web Apps using PowerShell and CLI
- Configuring alerts
- Enabling diagnostic logs
- Retrieving and streaming logs
- Configuring Web Apps for scale and resilience