Fire Azure Monitor Alert when the condition persists for more than one hour

Reiko Watanabe 25 Reputation points
2023-04-26T01:24:38.3233333+00:00

I am looking for a way to trigger an alert if the condition persists for more than one hour. Is there a way to implement this? I greatly appreciate your help.

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,587 questions
{count} votes

Accepted answer
  1. Sedat SALMAN 14,165 Reputation points MVP
    2023-04-28T06:36:09.42+00:00

    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.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.