Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.21 KB | None | 0 0
  1. 'Check status of NetBackup drive paths
  2.  
  3. '2/9/2009
  4.  
  5. 'Charles Schlesinger
  6.  
  7. 'MGP Ingredients, Inc.
  8.  
  9. set args = wscript.arguments
  10.  
  11.  
  12.  
  13. 'Set your Warning and Critical Thresholds
  14. Dim intWarning As Integer
  15. Dim intCritical As Integer
  16. intWarning = Int(args(0))
  17.  
  18. intCritical = Int(args(1))
  19. ' Which drive type to look for
  20. Dim strDriveType As String
  21. strDriveType = args(2)
  22.  
  23. 'set Path to tpconfig.exe executable file on server
  24.  
  25. 'strTpconfigPath = "C:\Program Files\Veritas\Volmgr\bin\tpconfig.exe"
  26. Dim strTpconfigPath as String
  27. strTpconfigPath = args(3)
  28.  
  29.  
  30.  
  31. Dim arrDown()
  32.  
  33. intSize = 0
  34.  
  35.  
  36.  
  37. Set objShell = WScript.CreateObject("WScript.Shell")
  38.  
  39. Set objExecObject = objShell.Exec(strTpconfigPath + " -l")
  40.  
  41.  
  42.  
  43. 'throw away the first three lines of headers
  44.  
  45. strJunk = objExecObject.StdOut.ReadLine()
  46.  
  47. strJunk = objExecObject.StdOut.ReadLine()
  48.  
  49. strJunk = objExecObject.StdOut.ReadLine()
  50.  
  51.  
  52.  
  53. Do Until objExecObject.StdOut.AtEndOfStream
  54.  
  55.     'Push data to array
  56.  
  57.     strWorkString = (objExecObject.StdOut.ReadLine())
  58.  
  59.     strWorkString = Trim(strWorkString)
  60.  
  61.     intWorkstr = Len(strWorkString)
  62.  
  63.     For i = intWorkStr to 2 Step -1
  64.  
  65.         strChars = Space(i)
  66.  
  67.         strWorkString = Replace(strWorkString, strChars, " ")
  68.  
  69.     Next
  70.  
  71.  
  72.  
  73.     arrValues = Split(strWorkString, " ")
  74.  
  75.  
  76.     If arrValues(3) = strDriveType Then
  77.  
  78.         If (arrValues(5) <> "UP") Then
  79.  
  80.             ReDim Preserve arrDown(intSize)
  81.  
  82.             arrDown(intSize) = arrValues(8)
  83.  
  84.             intSize = intSize + 1
  85.  
  86.         End If
  87.     End If
  88.  
  89.  
  90. Loop
  91.  
  92.  
  93.  
  94. strDown = ""
  95.  
  96. 'Compute the results
  97.  
  98. If (intSize > 0) Then
  99.  
  100.  For j = LBound(arrDown) to UBound(arrDown)
  101.  
  102.   If j = UBound(arrDown) Then
  103.  
  104.    strDown = strDown + arrDown(j)
  105.  
  106.   Else
  107.  
  108.    strDown = strDown + arrDown(j) + ", "
  109.  
  110.   End If
  111.  
  112.  
  113.  
  114.  Next
  115.  
  116. End If
  117.  
  118. 'WScript.Echo(strDown & intSize)
  119.  
  120. If (intSize >= intCritical) Then
  121.  
  122.  strResult = "CRITICAL - paths " + strDown + " are down!"
  123.  
  124.  intQuitCode = 2
  125.  
  126. ElseIf (intSize >= intWarning) Then
  127.  
  128.  strResult = "WARNING - path " + strDown + " is down!"
  129.  
  130.  intQuitCode = 1
  131.  
  132. Else
  133.  
  134.  strResult = "OK - All Paths are Up"
  135.  
  136.  intQuitCode = 0
  137.  
  138. End If
  139.  
  140.  
  141.  
  142.  
  143.  
  144. Wscript.Echo(strResult)
  145.  
  146. WScript.Quit(intQuitCode)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement