How to use azure monitor agent to send alert when ANY disk on a WINDOWS VM is below certain %?

Famous Amos 21 Reputation points
2023-06-26T15:47:14.5033333+00:00

Need to migrate to new azure monitor agent from legacy Log analytics agent.

I want to create the simple alert: any time ANY disk is below 10% fire off an email. I am testing this on one VM to start and would like to go at scale afterwards.

The documentation has conflicting information whether this would be collected at host level or whether diagnostic settings is required to be configured to collect this information? Also the built in queries are on a PER MB basis not percentage. This does not work in a large environment with many machines of varying disk sizes

If anybody can tell me how to configure my azure windows VM to collect the proper information on how full its disks are, and then how to configure the alert in montior to notify me when it gets below 10% that would be extremely helpful.

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,627 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,948 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Luke Murray 11,436 Reputation points MVP Volunteer Moderator
    2023-06-27T05:03:23.39+00:00

    Hi, Famous

    You should be able to use a Log Analytics/KQL query for that - there's few examples here: https://techcommunity.microsoft.com/t5/azure-observability/i-want-see-an-alert-when-my-disk-space-less-than-5gb-in-virtual/m-p/2210373

    If you scroll down in the comments - there's a KQL query based on Percentage:

    It should do it without needing VM insights installed, at the Azure level, let me know how you get on.

    let PercentSpace = 20;
    Perf
    | where ObjectName == "Logical Disk" // the object name used in Linux records
    | where CounterName == "% Free Space"
    | where TimeGenerated > ago(1h)
    | where InstanceName <> "_Total" and InstanceName !contains "HarddiskVolume"
    | summarize FreeSpace = avg(CounterValue) by Computer, InstanceName
    | where FreeSpace < PercentSpace
    | order by FreeSpace asc
    
    0 comments No comments

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.