@Mahadev, Rakesh [HAEA] Greetings!
The "Disk Space Used Percentage
" metric is not available in the Virtual Machine or Disks metric namespaces in Azure Monitor. Instead, you can achieve this by using a different approach. You can use Azure Monitor Logs and Kusto Query Language (KQL) to create a custom alert for disk space usage.
First thing, you need to enable diagnostics for your VM to send data to a Log Analytics workspace.
Create a Log Analytics workspace if you don't have one.
Configure your VM to send performance counters to the Log Analytics workspace. You can do this by navigating to the VM's "Diagnostics settings" and selecting the appropriate performance counters (e.g., LogicalDisk(*)% Free Space).
Use the following KQL query to calculate the disk space used percentage:
In the Azure portal, navigate to "Monitor" > "Alerts" > "+ New alert rule". Set the scope to your Log Analytics workspace, and for the condition, use the custom log search with the KQL query above. Set the threshold to trigger the alert when the disk space used percentage exceeds 80%.
If you prefer using built-in metrics, you might need to use the "Free Space" metric and calculate the used space percentage manually.
Useful resources:
- Create Azure Monitor metric alert rules provides detailed steps on creating and editing metric alert rules1.
- Avoid Downtime with Azure VM Disk Space Alerts offers best practices for setting up disk space alerts
Hope this helps. If you have any further questions or need additional assistance, feel free to ask.
If the response helped, do "Accept Answer" and up-vote it