How can i setup azure alert when a Data Disk Space is 90% for a windows VM

ZM-3283 65 Reputation points
2024-09-24T21:46:21.55+00:00

Hi, I'm trying to add an alert for a data disk in Azure for my Windows VM.

How to set a warning alert mail in azure when the disk capacity reaches more than 90, I want to set this warning in each disk (C:,D:,E:.F: ) separately.

Im using these recommended alerts below but for some reason im not getting any mail when my F drive for example is full and needs more spaceScreenshot 2024-09-24 224444

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,645 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,016 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. hossein jalilian 10,825 Reputation points Volunteer Moderator
    2024-09-24T23:43:17.4333333+00:00

    Thanks for posting your question in the Microsoft Q&A forum.

    To set up Azure alerts:

    Go to your Log Analytics workspace and navigate to Agents > Data Collection Rules and create a new rule or modify an existing one. Then add a Performance Counter data source and under Custom, add these counters:

    \LogicalDisk(*)\Free Megabytes
    \LogicalDisk(*)\% Free Space
    
    

    Go to your VM in the Azure portal and navigate to Monitoring > Alerts then click New alert rule.

    For the signal, choose Custom log search and use this KQL query

    Perf
    | where ObjectName == "LogicalDisk"
    | where CounterName == "% Free Space"
    | where InstanceName in ("C:", "D:", "E:", "F:")
    | summarize arg_max(TimeGenerated, *) by InstanceName
    | where CounterValue <= 10
    
    

    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.