Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PixelRobots/6f11c6752e06ec544ad126c6152f295e to your computer and use it in GitHub Desktop.
Save PixelRobots/6f11c6752e06ec544ad126c6152f295e to your computer and use it in GitHub Desktop.
// Chart disk if its under nnGB over the past nn days
let setGBValue = 20;
// enter a GB value to check
let startDate = ago(2d);
// enter how many days to look back on
Perf
| where InstanceName != "D:" and InstanceName contains ":"
| where TimeGenerated > startDate
| where ObjectName == "LogicalDisk" and CounterName == "Free Megabytes"
| extend FreeSpaceGB = CounterValue/1024
| extend compDrive = strcat( tostring( Computer ), "/", tostring( InstanceName ) )
| summarize FreeSpace = min( FreeSpaceGB ) by compDrive
| where FreeSpace < setGBValue
| summarize max(FreeSpace) by compDrive
| join
(
Perf
| where TimeGenerated > startDate
| where ObjectName == "LogicalDisk" and CounterName == "Free Megabytes"
| extend FreeSpaceGB = CounterValue/1024
| extend compDrive = strcat( tostring( Computer ), "/", tostring( InstanceName ) )
)
on compDrive
| make-series FreeSpace = min( FreeSpaceGB ) on TimeGenerated from startDate to now() step 4h by compDrive
| render timechart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment