Solution for Monitoring with Metric Alerts
In this tutorial, we will learn about creating and monitoring metric alerts based on the completion status of runbooks.
Creating alert
Alerts gives access to define a condition for monitoring for and an action to take when that condition is met.
- Firstly, in the Azure portal, navigate to your Automation account.
- Then, Under Monitoring, select Alerts and click + New Alert Rule. As the scope for the target is already defined to your Automation account.
Configuring alert criteria
- Firstly, click + Add criteria. Select Metrics for the Signal type, and choose TotalJobs from the table.
- Then, the Configure signal logic page is where you define the logic that triggers the alert. Under the historical graph, you are given with two dimensions, Runbook Name and Status. However, the dimensions are different properties for a metric that can be used to filter results. And, for Runbook Name, select the runbook you want to alert on or leave blank to alert on all runbooks. Lastly, for Status, select a status from the drop-down you want to monitor.
- Then, if you want to alert on a status or runbook that isn’t shown in the dropdown, click the + next to the dimension. However, this action opens a dialog that allows you to enter in a custom value, which hasn’t emitted for that dimension recently. If you enter a value that doesn’t exist for a property your alert won’t be triggered.
- After that, under Alert logic, define the condition and threshold for your alert.
- Lastly, under Evaluated based on, select the timespan for the query and how often you want that query run. And after finishing click done.
Defining alert details
- Firstly, under 2. define the alert details, by giving the alert a friendly name and description. Set the Severity to match your alert condition. As there are five severities ranging from 0 to 5. The alerts are treated the same independent of the severity, so that you can match the severity to match your business logic.
- Then, at the bottom of the section, there is a button that allows you to enable the rule upon completion. By default rules are enabled at creation. If you select No, you can create the alert and it’s created in a Disabled state.
Defining the action to take
- Firstly, under 3. Define action group, click + New action group. However, an action group is a group of actions that you can use across more than one alert.
- Secondly, in the Action group name box, give it a friendly name and short name. However, the short name is used in place of a full action group name when notifications are sent using this group.
- Then, in the Actions section under ACTION TYPE, select Email/SMS/Push/Voice.
- Fourthly, on the Email/SMS/Push/Voice page, give it a name. Check the Email checkbox and enter in a valid email address to be used.
- Then, click OK on the Email/SMS/Push/Voice page to close it and click OK to close the Add action group page. The Name specified in this page is saved as the ACTION NAME.
- Lastly, when complete, click Save. This action creates the rule that alerts you when a runbook has completed with a certain status.
Receiving notification
When the alert criteria is met, the action group runs the action that is defined. And, once the metric is no longer outside of the threshold defined, the alert is deactivated and the action group runs the action defined. If an email action type is selected, a resolution email is sent stating it has been resolved.
Reference: Microsoft Documentation
Are you preparing for Microsoft Azure Architect Design AZ-304 exam?Take a Quiz