Share via

Alert rule

salilsingh-9961 351 Reputation points
2022-08-07T14:04:53.657+00:00

Hi Team,
On Azure portal, I need to create an alert when storage utilization percentage on SQL Managed Instance is greater than 90%.
I am planning to use below query -

let storage_percentage_threshold = 90;
AzureDiagnostics
| where Category =="ResourceUsageStats"
| summarize (TimeGenerated, calculated_storage_percentage) = arg_max(TimeGenerated, todouble(storage_space_used_mb_s) *100 / todouble (reserved_storage_mb_s))
by ResourceId
| where calculated_storage_percentage > storage_percentage_threshold

but how to use above query when using it inside an alert rule. As per my understanding, in case storage utilization percentage of SQL MI is greater than 90%, above query will give 1 row, but i need to create an alert when average storage utilization percentage of SQL MI is greater than 90% for a duration of 5 minutes, how to use above query when creating an alert rule?

Thanks,
Salil

Azure Monitor
Azure Monitor

An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Vinodh247-1375 43,181 Reputation points Volunteer Moderator
    2022-08-07T17:36:06.65+00:00

    Hi salilsingh,

    Thanks for reaching out to Microsoft Q&A.

    In the below query I have added 'alert run interval' parameter and i believe this would work for your requirement, but make sure to tweak it accordingly when running this. Test this and let me know.

    let storage_percentage_threshold = 90;
    let alert_run_interval = 5m;
    AzureDiagnostics
    | where Category =="ResourceUsageStats"
    | where TimeGenerated > ago(alert_run_interval)
    | summarize (TimeGenerated, calculated_storage_percentage) = arg_max(TimeGenerated, todouble(storage_space_used_mb_s) *100 / todouble (reserved_storage_mb_s))
    by ResourceId
    | where calculated_storage_percentage > storage_percentage_threshold

    Please Upvote and Accept as answer if the reply was helpful.

    Was this answer helpful?

    0 comments No comments

Your answer

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