For some time, I have been using the Log Analytics Windows Agent to collect data to trigger email alerts for Windows VMs when they are running low on disk space. I used the following custom alert rule to do this, which has worked very well for me:
Perf
| where CounterValue <= 25
| where CounterName == "% Free Space"
| where InstanceName == "C:"
I was made aware that Log Analytics Windows Agents is now legacy and won't be supported as of August 31, 2024 and I should transition to the new Azure Monitor Windows Agent.
I tried to do this, setting up an Azure Monitor "Data Collection Rule" with "Performance Counters" as the only Resource. However, I noticed that the log results from the new Azure Monitor agents no longer provides "% Free Space" records for specific disk drives. Now, all the records only have an "InstanceName" of "_Total" instead of also having records with "InstanceName" of "C:", for instance. So I have to change the custom log alert rule to this, in order to get any results:
Perf
| where CounterValue <= 25
| where CounterName == "% Free Space"
While this works fine for VMs with only one disk drive, this is useless for a VM with multiple disk drives, including the temporary storage disks that many VM sizes include. The "_Total" adds up the free space of all the drives combined, making it impossible to determine when any specific drive is low on space.
For example, if the C drive is at 1% free space and the temporary D drive is 99.9% free, the log results will show a Total % Free Space of somewhere in between, like 46% free space. This is useless as I need the alerts to tell me when a specific drive is running low on space so I can prevent the drive from running out of space by increasing the disk size.
Is it possible accomplish what I am trying to do with the new Azure Monitor feature?