Hope doing good!
To set up alerts for Azure Application Gateway backend health that trigger multiple times until the issue is resolved, you can use Azure Monitor Alerts with a combination of Log Analytics and an action group. Here are the steps to achieve this:
- Create a Log Analytics Workspace:
- If you don't already have one, create a Log Analytics Workspace in the Azure portal and if you have one you can use existing workspace
Configure Diagnostic Settings:
- Configure Diagnostic Settings for your Application Gateway to send health probe status data to the Log Analytics Workspace.
- You can do this by going to your Application Gateway settings, selecting "Diagnostics settings," and then configuring the appropriate diagnostics settings to send data to the Log Analytics Workspace.
Create a Log Analytics Query Alert:
- In the Log Analytics Workspace, create a query that checks the health probe status. For example, you can use a query like this to detect unhealthy backend instances:
sqlCopy code Heartbeat | where ResourceType == "APPLICATIONGATEWAYS" and Resource == "YourApplicationGatewayName" | where ResourceId contains "/backendhealth/" | where Status_s != "Healthy"
- Save the query.
Create an Action Group:
- In the Azure portal, go to "Monitor" -> "Alerts" -> "Manage actions groups."
- Create a new action group, and configure it to send email notifications to your team members.
- Add this action group to your Application Gateway alerts.
Create an Alert Rule:
- Go to "Monitor" -> "Alerts" -> "New alert rule."
- Configure the alert rule with the following settings:
- Resource: Your Application Gateway
- Condition: Use the Log Analytics query you created in step 3.
- Action group: Select the action group you created in step 4.
- Evaluation frequency: Set it to your desired frequency (e.g., every 5 minutes).
- Severity: Set the appropriate severity.
- Enable the alert rule.
Set Alert Suppression (Optional):
- If you don't want to receive alerts continuously for the same issue within a short timeframe, you can set up alert suppression. This prevents multiple alerts for the same issue within a specified period.
With these steps, Azure Monitor Alerts will continuously evaluate the query you created in Log Analytics and trigger email notifications to your team whenever the backend health condition matches the criteria defined in your query. The alerts will continue to trigger until the issue is resolved or the alert suppression period expires.