A couple of weeks ago I was talking to someone in one of the many MSP discords, and he was struggling with disk space monitoring. His RMM system is designed in such a way that whenever he added a disk space monitor to a machine it adds an entirely new component to the monitoring list. He also could not filter out if the disk is present or not. So if the machine does not have a D:\ Drive that component would fail.
Of course this was easily solved by creating a monitor in his RMM system that said “For all drives available” but then he bumped into the next issue; he could not exclude disks such as a TempDB disks that are meant to be near capacity, or disks that are very large and thus 10% could be hundreds of GB or even a couple of TB. he also had to disable monitoring for all disks if he just didn’t want to alert on a single disk. Quite annoying of course, so I figured I’d create a quick and dirty blog to show how to monitor disk space, and build in some conditions in the monitoring component itself.
The Script
So the script has some variables to enter for your own settings, and the ones I’m giving are just an example. You can feed the “Excluded drives” from your monitoring system if it supports that. We’re also only grabbing disks that have a drive letter, change line 16 if you also want to include drives without.
|
|
So the benefits of approaching it this way are that he is able to have just 1 disk monitoring component in his RMM system, instead of a list of 10, he is able to make conditional changes, and the alerting even offers some more insights such as the friendly name.
As a final note, I wanted to let you all know that you can now buy me a cup of coffee on Github. Click that link if you feel like I helped you out at all once, it helps support the hosting of the blog, the CTF resources, but also Azure Functions I create and keep updated for you all. I won’t make a habit of putting this under my posts and my content will always remain free. 🙂
And that’s it! as always, Happy PowerShelling.