I want to create an alert on azure SQL MI if storage space is used more than 80%.But not found any condition on storage space used percentage. Image is attched that shows available options to set alert
Asked
Active
Viewed 70 times
1 Answers
0
As per this document below are the available options to create alerts in SQL managed instance.
So, there is no direct way to create alert to when SQL MI storage is greater than 80%. You can follow below procedure to get alert:
Enable diagnostic settings in SQL managed instance as mentioned below:
Create log search alert in log analytics workspace with below query:
AzureMetrics
| extend p = pack(MetricName, Average)
| summarize bag = make_bag(p) by TimeGenerated
| evaluate bag_unpack(bag)
| extend reserved_storage = reserved_storage_mb
| extend used_storage = storage_space_used_mb
| extend storage_used_percentage = round(100.0 * used_storage / reserved_storage)
| project TimeGenerated, storage_used_percentage, reserved_storage, used_storage
| where storage_used_percentage >= 80
As mentioned in below image:
You will be able to get alert when SQL MI storage is greater than 80%. For more information you can refer this SO thread.

Bhavani
- 1,725
- 1
- 3
- 6
-
when I create a log search alert with the above provided query it gives error : 'extend' operator: Failed to resolve scalar expression named 'reserved_storage_mb' Request id: 427bfdbe-0b57-48ed-a224-39a16545a72e https://ibb.co/VLCdLW9 @Bhavani – Tahami Rizwan Aug 21 '23 at 11:24
-
Once try with values instead of 'reserved_storage_mb' and 'storage_space_used_mb' like mentioned in above image. – Bhavani Aug 21 '23 at 11:28
-
https://ibb.co/SsKsv7h No result found – Tahami Rizwan Aug 21 '23 at 11:30