Yes, you can configure an Azure Monitor alert to trigger when a specific condition persists for more than one hour. To achieve this, you can follow these steps
- Azure portal > Search for "Monitor" in the search bar and select "Monitor" from the results. > Click on "Alerts," then click on the "+ New alert rule" button.
- In the "Create rule" panel, select the subscription and resource for which you want to create the alert.
- Under "Condition," click on "Add" to define the alert condition.
- Choose the signal type (Metric or Log) based on the data you want to monitor.
For Metric signals, configure the following settings:
- Aggregation type: Select the aggregation type you want to use (e.g., Average, Count, Minimum, Maximum, or Total).
- Aggregation granularity (Period): Set this to 1 hour (PT1H).
- Frequency of evaluation: Set this to 1 hour (PT1H) or more, depending on how often you want to evaluate the condition.
- Threshold: Set the threshold for the condition that, if met or exceeded for 1 hour, will trigger the alert.
For Log signals, write a Kusto query that checks for the specific condition over a 1-hour time window. Make sure to use the summarize function to aggregate the results by a 1-hour time window. For example:
scssCopy code
YourLogTable
| where TimeGenerated > ago(1h)
| summarize count() by bin(TimeGenerated, 1h)
| where count_ > YourThreshold
Replace YourLogTable with the name of the log table you want to monitor and YourThreshold with the threshold value that should trigger the alert.
After configuring the condition, click "Done."
Under "Action Group," create a new action group or select an existing one that specifies the actions to be taken when the alert is triggered.
Set the "Alert rule name" and "Description" and choose the "Severity" level for the alert.
Click "Create alert rule" to save and enable the alert.