Featured image of post Blog Series: Monitoring using PowerShell: Part Six – Monitoring CSV volumes for space and status

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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21

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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13

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

All blogs are posted under AGPL3.0 unless stated otherwise
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy