' This Script is used to check if Storage lun capacity is healthy
' If the capacity usage percentage is greater than or equal to 80% and less than 90%, output Warning
' If the capacity usage percentage is greater than or equal to 90%, output Critical
' If the capacity usage percentage is less than 80%, output healthy
Dim oArgs, oBag, oAPI, TotalCapacity, RemainingCapacity, UsedCapacity, WarningThreshold, CriticalThreshold, UsagePercentage, ThinlyProvisioned
Set oAPI = CreateObject("MOM.ScriptAPI")
' There are 4 arguments, they are the following values.
' (1) Target Property - TotalCapacity
' (2) Target Property - UsedCapacity
' (3) Target Property - WarningThreshold
' (4) Target Property - CriticalThreshold
' (5) Target Property - ThinlyProvisioned
Set oArgs = Wscript.Arguments
' Check to see if the required script arguments are there
' 5 argument are requried
' If 5 argument do not exist, log a script event
If oArgs.Count = 5 Then
Set oBag = oAPI.CreatePropertyBag()
TotalCapacity = oArgs(0)
RemainingCapacity = oArgs(1)
WarningThreshold = oArgs(2)
CriticalThreshold = oArgs(3)
ThinlyProvisioned = oArgs(4)
'For Fixed LUNs don't raise the alert , set UsedCapacity explicitly to 0
If (ThinlyProvisioned = "false" OR ThinlyProvisioned = "False") Then
UsedCapacity = 0
Else
UsedCapacity = TotalCapacity - RemainingCapacity
End If
If TotalCapacity > 0 Then
UsagePercentage = CLng((UsedCapacity/TotalCapacity) * 100)
Call oBag.AddValue("StorageLUNCapacity", CInt(UsagePercentage))
Call oBag.AddValue("WarningThreshold", WarningThreshold)
Call oBag.AddValue("CriticalThreshold", CriticalThreshold)
Else
Call oAPI.LogScriptEvent("StorageLUNUsage.vbs", 108, 0, "TotalCapacity invalid." & TotalCapacity)
End If