Wednesday, February 17, 2016

Monitor DPM Storage Pool

Hi,

I've created a small PowerShell-script that is ready to be used as a Performance Rule in System Center Operations Manager to monitor the amount of freespace in the storage pool on your DPM-server.

I will post a complete guide later on how to create the rule in SCOM!



-----------------------------------

#Load the MOMScript API and the PropertBag provider
$API = New-Object -comObject "MOM.ScriptAPI"
$bag = $api.CreatePropertyBag()

#Log an event at script-start
$api.LogScriptEvent("FreeDiskSpace.ps1",3280,0,"Collect FreeSpace in DPM-storagepool Script is starting")

#Main PowerShell-script
$FS = get-dpmdisk | where {$_.DiskTypeLabel -ne "Basic"} | Select UnallocatedSpaceLabel | ft -HideTableHeaders| Out-String -Stream
$FS = $FS | ForEach-Object {$_ -replace "GB", ""} 
$FreeSpace = ($FS | Measure-Object -Sum | select sum | ft -HideTableHeaders | Out-String).trim()

$TS = get-dpmdisk | where {$_.DiskTypeLabel -ne "Basic"} | Select TotalCapacityLabel | ft -HideTableHeaders| Out-String -Stream
$TS = $TS | ForEach-Object {$_ -replace "GB", ""} 
$TotalSpace = ($TS | Measure-Object -Sum | select sum | ft -HideTableHeaders | Out-String).trim()

#Add the data into the PropertyBag
$bag.AddValue("FreeSpace",$FreeSpace)
$bag.AddValue("TotalSpace",$TotalSpace)

#Log an event that our script is complete
$api.LogScriptEvent("FreeDiskSpace.ps1",3281,0,"Collect FreeSpace in DPM-storagepool Script is complete.  
$FreeSpace GB of $TotalSpace GB free in diskpool on $env:computername")

#Output the PropertyBag data for SCOM consumption
$bag

-----------------------------------


Kind Regards
Markus Eliasson

5 comments :

  1. I am interested in this. Have you had a chance to write up how to create that rule in SCOM? Thanks for posting this and all of the many other great tips, etc.

    ReplyDelete
    Replies
    1. Hi,
      Thank you for the kind words!
      Unfortunately I haven't had time to create a Step-by-step guide how to import the script as a rule in SCOM yet. Hopefully I will post it around easter!

      Delete
    2. Any chance you may have found time to create this? We are super interested.

      Delete
  2. Any updates for the guide please ?

    ReplyDelete