SQL Server Azure SQL metric - Alert rule not working as expected

vatpfxk5  于 2023-10-15  发布在  其他
关注(0)|答案(1)|浏览(104)

Question: Based on the following storage space statistics of my Azure SQL Managed Instance:

  1. What does the "storage space used (avg) 51.76k" (shown at the bottom of the image1 below) represent
  2. the value 51.76k relates to which value in the stats table below?

Why the Question: I am asking it because whenever I create an alert with a condition: "When Storage space use is greater than x", then even if I set the value of x to be 52, 55, or even 50510, the alert gets triggered and sends me an email. But I am not making any changes in the databases in my Azure SQL managed instance.

I can see that my stats query is still returning the same values (shown in table below), and the matric view (shown in image 1 below) is also not changing. So, why the alert gets triggered 5 minutes after I create it. This happened all three times when I created an alert for threshold of 52,55, and 50510 respectively. There must be something I am not doing right because I thought the alert will only get triggered if the threshold exceeds, say, 50510.

In my Azure SQL Managed Instance, SSMS is showing my data statistics as follows:

|volume_mount_point| used_gb | available_gb  | total_gb |
|----------------------------|---------------|----------|
|        c:\       |   0.2   |    191.8      |  192.0   |
|       http://    |   50.5  |     333.5      |  384.0   |

And the Metric view is as follows:

Details:

I am following this tutorial from MS Azure team describes how to creates an Alert Rule to send an alert by using following values (also shown in image 1 below):

Metric: Storage Space used
Condition: When Space used is greater than 1840876 MB

Now item 7 of this section of the article states: "value of 1840876 MB is used representing a threshold value of 1.8 TB". And then a value "1.84M" is shown in the bottom section of the image 1.

of1yzvn4

of1yzvn41#

Short answers to your questions:

  1. Storage space used (avg) represents the average sum size of all the managed databases hosted on your Azure SQL Managed Instance over the time increment. The measuring unit for this metric is MB, as stated in the Microsoft documentation.
  2. The value of 51.76k seems to be the same as the value of 50.5 from your stats table in the used_gb column.
51.76K MB = 51.76 * 1000 MB = 51760 MB = 50,546 GB

It makes sense that the alerts you set for values 52, 55 and 50510 send emails as soon as you enable them, as all these values are smaller than your current used space of 51760 MB.

Assuming you need the alert to fire up when you're running out of space on the Managed Instance, you should base the alert value on the allocated size rather than on the currently used size.

For example, if the allocated size is 500 GB, and you need the alert to fire when the storage is 95% full (450 GB), the value you need to pass to the alert is 460800 (450 * 1024 [MB]).

相关问题