azureazure-sql-managed-instanceazure-alertssql-azure-alerts

Azure SQL MI storage space alert


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

Image is attached for reference available options

  1. How can I set an alert on Azure SQLMI on storage used more thn 80%

  2. The value 250.48 k relates to which value in the stats table below what is this metrics is showing enter image description here


Solution

  • As per this document below are the available options to create alerts in SQL managed instance.

    enter image description here

    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:

    enter image description here

    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:

    enter image description here

    You will be able to get alert when SQL MI storage is greater than 80%. For more information you can refer this SO thread.