Blog Series: Monitoring using PowerShell: Part Six – Monitoring CSV volumes for space and status

Hi All,

My next couple of blogs will be a series of blogs where I will be explaining on how to use PowerShell for the monitoring of critical infrastructure. I will be releasing a blog every day that will touch on how to monitor specific software components, but also network devices from Ubiquity, third-party API’s and Office365. I will also be showing how you can integrate this monitoring in current RMM packages such as Solarwinds N-Central, Solarwinds RMM MSP and even include the required files to import the monitoring set directly into your system.

Requirements:

  • Cluster Shared Volume
  • PowerShell v3 or higher

Creating the monitoring sets:

We have a few clients that have shared storage, this shared storage needs to be monitored for size and usage but as Microsoft decided to make the mount points on C:\ClusterStorage its not always easy to do this from your RMM or without logging into the server. To make sure we can monitor the CSV state regarding storage used we use the following script:

Size Monioring:


param(
[string]$MonitorPercent = 5
)
try {
$CSV = Get-ClusterSharedVolume
}catch{
$ScriptError = "Query Failed: $($_.Exception.Message)"
}
foreach($volume in $CSV.SharedVolumeInfo){
$Path        = $volume.FriendlyVolumeName
$Size        = [math]::truncate($volume.Partition.Size / 1024MB)
$FreeSpace   = [math]::truncate($volume.Partition.FreeSpace/ 1024MB)
$UsedSpace   = [math]::truncate($volume.Partition.UsedSpace/ 1024MB)
$PercentFree = [math]::truncate($volume.Partition.PercentFree)
if($PercentFree -le $MonitorPercent){
$Status +=  "$name at path $path is at $percentfree% free`n$UsedSpace GB used of $Size GB"
}
}
if (!$Status) { $Status = Healthy }
if (!$ScriptError) { $ScriptError = Healthy }

Status Monitoring:


try {
$CSV = Get-ClusterSharedVolume
}catch{
$ScriptError = "Query Failed: $($_.Exception.Message)"
}
foreach($volumes in $CSV){
$Name   = $volumes.name
if($volumes.State -ne "Online"){
$Status += "$name is $($volumes.State)"
}
if (!$Status) { $Status = Healthy }
if (!$ScriptError) { $ScriptError = Healthy }

And thats how you can monitor the CSV volume state when you’re using shared storage. 🙂

Downloads for RMM packages:

N-Central 11.0+ – CSV Monitoring

Recent Articles

The return of CyberDrain CTF

CyberDrain CTF returns! (and so do I!)

It’s been since september that I actually picked up a digital pen equivalent and wrote anything down. This was due to me being busy with life but also my side projects like CIPP. I’m trying to get back into the game of scripting and blogging about these scripts. There’s still so much to automate and so little time, right? ;)

Monitoring with PowerShell: Monitoring Acronis Backups

Intro

This is a monitoring script requested via Reddit, One of the reddit r/msp users wondered how they can monitor Acronis a little bit easier. I jumped on this because it happened pretty much at the same time that I was asked to speak at the Acronis CyberSummit so it kinda made sense to script this so I have something to demonstrate at my session there.

Monitoring with PowerShell: Monitoring VSS Snapshots

Intro

Wow! It’s been a while since I’ve blogged. I’ve just been so swamped with CIPP that I’ve just let the blogging go entirely. It’s a shame because I think out of all my hobbies it’s one I enjoy the most. It’s always nice helping others achieve their scripting target. I even got a couple of LinkedIn questions asking if I was done with blogging but I’m not. Writing always gives me some more piece of mind so I’ll try to catch up again. I know I’ve said that before but this time I’ll follow through. I’m sitting down right now and scheduling the release of 5 blogs in one go. No more whining and no more waiting.