How can I set up alerts in Azure for SQL Managed Instance when storage exceeds 80% capacity?

170 views Asked by At

I'm working with Azure SQL Managed Instance and I'm looking to configure alerts to notify me when the storage usage reaches or exceeds 80% capacity. Could someone provide guidance or steps on how to achieve this within Azure's monitoring or alerting system?

I've explored Azure's monitoring options but haven't found a clear way to set up these specific alerts.

1

There are 1 answers

3
Bhavani On

According to this document, the available options to create alerts in SQL Managed Instance are shown below:

Available options for alerts

There is no direct way to create an alert when SQL MI storage is greater than 80%. However, you can follow the procedure below to get an alert:

  1. Enable diagnostic settings in SQL Managed Instance as shown below:

Diagnostic settings

  1. Create a log search alert in the Log Analytics workspace with the following 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
  1. Set up the alert as shown in the image below:

Log search alert

You will receive an alert when SQL MI storage is greater than 80%. For more information, refer to this SO thread.