Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Dirty script to check Failed backups from Commvault 9.00
- ' Author: Vicente Dominguez - contact via Twitter @vicendominguez ;)
- ' Require: qlist from qcommands (Commvault 9.00)
- ' Save as check_commvaulthistory.vbs in server with commvault sw install
- ' Command line to execute: cscript //nologo check_commvaulthistory.vbs
- ' Remember to execute 'qlogin' to validate the user/pass
- Option Explicit
- ' On Error Resume Next
- Function getCommandOutput(theCommand)
- Dim objShell, objCmdExec
- Set objShell = CreateObject("WScript.Shell")
- Set objCmdExec = objshell.exec(thecommand)
- getCommandOutput = objCmdExec.StdOut.ReadAll
- end Function
- ' Formatting output from qlist command (if qlist output changes... be careful here)
- Function CreateArrayClient()
- Dim ClientList(), ClientAux, ClientArray, ClientName, NumList
- ClientArray = split (getCommandOutput ("qlist client"), vbNewLine)
- NumList = 0
- For Each ClientAux in ClientArray
- ' Dynamic array resize
- redim preserve ClientList (NumList)
- ' Output 'qlist' validation, min two chars in name to be ok
- If Len (ClientAux) > 2 Then
- ClientName = Split (ClientAux, " ")
- ' Client must be "ACTIVE"
- If InStr (Mid(ClientAux,47), "Yes") Then
- ClientList(NumList) = ClientName(0)
- NumList = NumList + 1
- End If
- End If
- Next
- CreateArrayClient = ClientList
- End Function
- Function GetHostHistory (Hostname)
- Dim HostHistory
- HostHistory = getCommandOutput("qlist jobhistory -c '" & Hostname & "'")
- GetHostHistory = HostHistory
- End Function
- Function GetHostFailedHistory (Hostname)
- Dim HostHistory
- HostHistory = getCommandOutput("qlist jobhistory -js Failed -c '" & Hostname & "'")
- If InStr (HostHistory, "No jobs to display") Then
- GetHostFailedHistory = 0
- Else
- GetHostFailedHistory = 1
- End If
- End Function
- Sub BackupAudit ()
- Dim Hostname
- For Each Hostname in CreateArrayclient
- If Len (HostName) > 1 Then
- If GetHostFailedHistory (Hostname) Then
- Wscript.Echo Hostname & " FAIL: " & GetHostHistory (Hostname)
- Else
- Wscript.Echo Hostname & " OK "
- End If
- End If
- Next
- End Sub
- BackupAudit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement