Can you monitor OSDisk freespace instead of OSDisk IOPs of Azure VM running windows?

Copper Contributor

Can you monitor OSDisk freespace instead of OSDisk IOPs of Azure VM running windows?

I have a VM with only OS Disk attached and want to monitor its freespace and send email alerts.

 

I am not having any luck running this query for OS Disk. 

let setgbvalue = 10;
Perf
| where ObjectName == "LogicalDisk"
| where InstanceName !contains "C:"
| where InstanceName !contains "_Total"
| extend FreeSpace = CounterValue/1024
| summarize FreeSpace = min(FreeSpace) by Computer, InstanceName
| where FreeSpace < setgbvalue

2 Replies

@cloudworxs 

you need to enable AzureMonitor Agent or GuestAgent

tommykneetz_0-1672829468876.png

 

Greetings @cloudworxs and @tommykneetz 

As per my understanding the Perf table is related to Log Analytics using MMA (Microsoft Monitoring Agent) and InsightMetrics is the table used by AMA (Azure Monitoring Agent).

 

I don't know if it is by design but I assume it is because by the moment I removed MMA and my queries stopped working the only way to have everything back using AMA was to use InsightMetrics table. I didn't find anywhere the accuracy of my assumption so I took it for granted. :lol:

 

That said, here it is something you can try to achieve your results:

  • Using FreeSpaceMB which returns the Free Space of your machines in MB

 

InsightsMetrics
| where Namespace == "LogicalDisk" and Name == "FreeSpaceMB"

 

 

  • Using FreeSpacePercentage which returns the free space in %

 

InsightsMetrics
| where Namespace == "LogicalDisk" and Name == "FreeSpacePercentage"

 

 

Cheers...