I have one virtual machine . Now I want if my disk space showing very low I mean less than 2 gb. Then I want to trigger azure monitor alerts and want to get Email regarding this. is there any metrics azure monitor provide.
-
Not a specific answer to your question but we've found Azure Monitor painfully useless when it comes to sending alert emails. Both myself, and our Azure CSP (i.e. supposed MS-endorsed Azure experts) have been unable to find a way to include anything more useful that the ResourceID in the emailed alert. We've opted for a Free PRTG install instead which is far easier to install and configure. – Chris Butler Jul 22 '21 at 21:31
1 Answers
There are no predefined alerts for diskspace as of now . But you can create a new alert with custom log search to get the details and then trigger the email to you.
Step 1 : Go to Alerts on your Monitor Page and click on New alert rule .
Step 2: Then select the resource and by resource here you have to select the Log analytics workspace which you have enabled the VM monitoring for . In my case its TestLog.
Step 3: Now select the Custom Log Search .
Step 4: Then provide the Custom Query which I have provided below in the search query box and you can set the threshold value to “0” and period and frequency in mins as per your requirement for an example I have set it to 60mins.
Step 5: Now Select an existing Action group that you have or you can create a new one by clicking on create new and filling the details . After its Created click on the action group and add the notification type as Email or anything you want to specify.
Step 6: Fill rest details like email subject and severity of the alert you want to set it to and then create alert.
Custom Query:
let setgbvalue = 200;//Set the disk space you want to check for.
Perf
| where TimeGenerated > ago(1h)
| where ObjectName == "LogicalDisk" and CounterName == "Free Megabytes"
// exclude all others as we are checking for C: here
| where InstanceName != "D:"
| where InstanceName != "_Total"
| where InstanceName != "HarddiskVolume1"
| extend FreeSpaceGB = CounterValue/1024 // converting the counter value to GB
| summarize FreeSpace = min(FreeSpaceGB) by Computer, InstanceName
| where FreeSpace < setgbvalue //setting condition to check if the value is less than our set value .
Sample :
To test it I had set the value to 200GB and my disk space was 106GB. I received the mail as below.

- 9,705
- 2
- 10
- 27
-
1
-
I have followed all steps but I am not getting email. Also my Logs query returning me : "No results found from the specified time range" . My "C:" Drive space is 109 GB free of 126 GB. – DnyaneshSurya Jul 26 '21 at 06:14
-
Please enable guest agent metrics and add perf counters , if not added by default while creating.. – Ansuman Bal Jul 26 '21 at 10:00
-
1
-
I keep getting no records found and diagnostics are enabled and performance counters too? – itye1970 Aug 16 '21 at 11:29
-
Hello @itye1970, May I know what are specifications of your VM? if you have followed the above steps or not? – Ansuman Bal Aug 16 '21 at 11:51
-