Antonio Nicolin
Antonio Nicolin

Reputation: 1

Alerts with Azure Monitor Agent Metrics

I am using the Azure Monitor Agent (AMA) to monitor a virtual machine. I need to make an alert if the free disk is less than 10%. For this purpose i'm using the guest metric "disk/free_percent", with mean as type of data aggregation. On the graph, the values on the ordinate are the percentage of free disk? Because using df command on the virtual machine i have quite different values than the ones shown on the dashboard. I have to make an alert if free disk is below 10%. What query i have to make using "disk/free_percent" to accomplish that task?

I've tryed to use operator "lesset than", unit as "number" and thrshold value as 10.

Upvotes: 0

Views: 320

Answers (1)

Jahnavi
Jahnavi

Reputation: 8018

Disk Space will be computed in GB/MB units in general.

Instead of monitoring on a percentage basis, create an alert to check if the free disk space is less than 10gb. As discussed here in Microsoft Q&A, I tried in my environment with a few modifications accordingly and I got the expected output for disk space.

Query:

let setgbvalue = 10;
 Perf
 | where ObjectName == "LogicalDisk" and CounterName == "Free Megabytes"
 | where InstanceName !contains "C:"
 | where InstanceName  !contains "_Total" 
 | extend FreeSpaceGB = CounterValue/1024
 | summarize FreeSpace = max(FreeSpaceGB) by InstanceName
 | where FreeSpace < setgbvalue

Output:

enter image description here

If requirement is only with percentage, then you can use computing operations like countervalue/1024 multiplied by 100.

Upvotes: 0

Related Questions