'Check status of NetBackup drive paths
'2/9/2009
'Charles Schlesinger
'MGP Ingredients, Inc.
set args = wscript.arguments
'Set your Warning and Critical Thresholds
Dim intWarning As Integer
Dim intCritical As Integer
intWarning = Int(args(0))
intCritical = Int(args(1))
' Which drive type to look for
Dim strDriveType As String
strDriveType = args(2)
'set Path to tpconfig.exe executable file on server
'strTpconfigPath = "C:\Program Files\Veritas\Volmgr\bin\tpconfig.exe"
Dim strTpconfigPath as String
strTpconfigPath = args(3)
Dim arrDown()
intSize = 0
Set objShell = WScript.CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec(strTpconfigPath + " -l")
'throw away the first three lines of headers
strJunk = objExecObject.StdOut.ReadLine()
strJunk = objExecObject.StdOut.ReadLine()
strJunk = objExecObject.StdOut.ReadLine()
Do Until objExecObject.StdOut.AtEndOfStream
'Push data to array
strWorkString = (objExecObject.StdOut.ReadLine())
strWorkString = Trim(strWorkString)
intWorkstr = Len(strWorkString)
For i = intWorkStr to 2 Step -1
strChars = Space(i)
strWorkString = Replace(strWorkString, strChars, " ")
Next
arrValues = Split(strWorkString, " ")
If arrValues(3) = strDriveType Then
If (arrValues(5) <> "UP") Then
ReDim Preserve arrDown(intSize)
arrDown(intSize) = arrValues(8)
intSize = intSize + 1
End If
End If
Loop
strDown = ""
'Compute the results
If (intSize > 0) Then
For j = LBound(arrDown) to UBound(arrDown)
If j = UBound(arrDown) Then
strDown = strDown + arrDown(j)
Else
strDown = strDown + arrDown(j) + ", "
End If
Next
End If
'WScript.Echo(strDown & intSize)
If (intSize >= intCritical) Then
strResult = "CRITICAL - paths " + strDown + " are down!"
intQuitCode = 2
ElseIf (intSize >= intWarning) Then
strResult = "WARNING - path " + strDown + " is down!"
intQuitCode = 1
Else
strResult = "OK - All Paths are Up"
intQuitCode = 0
End If
Wscript.Echo(strResult)
WScript.Quit(intQuitCode)