2

Is there a way to monitor the number of times a runbook has been called and then report on it (send email, text)? When I try to create an alert rule I only see an option for activity log not metrics. The runbook is getting called from event grid via webhook.

user9360564
  • 355
  • 1
  • 4
  • 13
  • Does this answer your question? [Azure monitoring alert not working to detect Azure runbook failure](https://stackoverflow.com/questions/68546775/azure-monitoring-alert-not-working-to-detect-azure-runbook-failure) – Michael Freidgeim May 04 '23 at 14:14

4 Answers4

0

You can use automation runbooks with three alert types:

  1. Classic metric alerts - Sends a notification when any platform-level metric meets a specific condition. For example, when the value for CPU % on a VM is greater than 90 for the past 5 minutes.
  2. Activity log alerts
  3. Near real-time metric alerts - Sends a notification faster than metric alerts when one or more platform-level metrics meet specified conditions. For example, when the value for CPU % on a VM is greater than 90, and the value for Network In is greater than 500 MB for the past 5 minutes.

When an alert calls a runbook, the actual call is an HTTP POST request to the webhook. The body of the POST request contains a JSON-formated object that has useful properties that are related to the alert.

This Microsoft documentation link might help for metrics alerts for runbook : https://learn.microsoft.com/en-us/azure/automation/automation-create-alert-triggered-runbook

  • This is not what i asked. I know you can create an alert that calls a runbook but I'm look for an option to monitor a runbook or automation account and then report on it. – user9360564 Mar 19 '18 at 19:13
0

You can send your Azure Automation runbook status data to Log Analytics. From there, you can alert on the different states. This documentation should help you with this process: https://azure.microsoft.com/en-us/updates/send-your-runbook-job-status-and-job-streams-from-automation-to-log-analytics-oms/

Jenny Hunter
  • 196
  • 4
0

There are multiple answers to this question although none of them are a perfect solution. What I ended up doing was putting a logic app in front of the runbook that then calls the runbook. This allows me to alert on the metrics of my logic app.

user9360564
  • 355
  • 1
  • 4
  • 13
0

We have just added support for Monitoring runbooks and having Alerts on it. Please go to the Alerts experience in Azure Monitor where you should be able to choose an Automation Account and then a Runbook as a dimension and then perform actions based on number of jobs of the Runbook etc.

anirudhgarg
  • 238
  • 3
  • 7