简体   繁体   中英

Disk query in Log Analytics on Azure

I was wondering if I could get some help with Log analytics. New to this so bear with me.

I'm trying to create a query that will provide informtaion on disk utilisation in Azure. I've gottwo commands (below), however I'm not able to merge them as I would like one query which gives me % free space, overall size of disk, name of vm and name of disk. Anything else I can get in terms of disk usage would be great, not overly concerned with IOPs at the moment.

The commands are:

This command below proivides info on free space:

search ObjectName == "LogicalDisk" and CounterName == "% Free Space"

This command below provides information on free Mb remaining.

search ObjectName == "LogicalDisk" and CounterName == "Free Megabytes"

I have tried this which helps, but again information is quite limited

search ObjectName == "LogicalDisk" and CounterName == "Free Megabytes" and TimeGenerated > ago(1d) 
| summarize FreeSpace = min(CounterValue) by Computer, InstanceName
| where strlen(InstanceName) ==2 and InstanceName contains ":"

Thanks in advance :)

You can use the below script to query the Azure log database:

// % Disk free space
Perf | where ObjectName == "LogicalDisk" and CounterName == "% Free Space" and InstanceName != "_Total"
| summarize CounterValue = min(CounterValue) by Computer, InstanceName, CounterName
| order by CounterValue asc nulls first

To limit output to disks with less than 20% free space just add an extra condition:

| where CounterValue < 20

You could use the following command

Perf | where (ObjectName == "LogicalDisk" and CounterName == "Free Megabytes") | summarize arg_max(TimeGenerated, *) by Computer | sort by TimeGenerated desc

More information about this you could check this link .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM