'****************************************************************************** ' Script to check current status of Veritas through the event viewer ' If event is an error or job has been running for an excessive amount of time show in hobbit ' Created by Kevin Cooper Nov 08 2005 ' Property of Eclipse Technology Services Ltd http://www.ets.biz '****************************************************************************** '********* Declarations ********* ' Dim FSO, colDisks, objDisks, LogFile, EventCode, EventMessage, EventDate, objWMIService, Colour, Output Set FSO = CreateObject("Scripting.FileSystemObject") Const strComputer = "." Const LogDir = "C:\BB\tmp\" Const JobRedHours = 5 Const JobYellowHours = 3 CreateLog("veritas") '*********** Open log file for writing, call to subroutine ********** Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & _ "\root\cimv2") Set colDisks = objWMIService.ExecQuery _ ("SELECT * FROM Win32_NTLogEvent WHERE SourceName = ""Backup Exec""") For each objDisk in colDisks EventCode = objDisk.EventCode EventMsg = objDisk.Message EventDate = GetVBDate(objDisk.TimeGenerated) exit for Next select case EventCode '############### WARNINGS ############### case 34338 ' Catalog Error Colour = "red " case 57348 ' Database Maintenance Failure Colour = "red " case 58053 ' Device Error Colour = "red " case 57751 ' IDR Copy Failed Colour = "red " case 34114 ' Job Cancellation Colour = "red " case 34113 ' Job Failed Colour = "red " case 58057 ' Media Error Colour = "red " case 34578 ' Software Update Error Colour = "red " case 65314 ' Tape Alert Error Colour = "red " '###############QUESTIONS############### case 58056 ' Device Intervention Colour = "red " case 58064 ' Library Insert Colour = "red " case 58061 ' Media Insert Colour = "red " case 58060 ' Media Intervention Colour = "red " case 58062 ' Media Overwrite Colour = "red " case 58063 ' Media Remove Colour = "red " '###############ALERTS############### case 57753 ' Backup Job Contains No Data Colour = "red " case 58054 ' Device Warning Colour = "red " case 34580 ' Install Warning Colour = "red " case 57755 ' Job Completed with Exceptions Colour = "yellow " case 33919 ' Job Warning Colour = "red " case 58058 ' Media Warning Colour = "red " case 34577 ' Software Update Warning Colour = "red " case 65313 ' Tape Alert Warning Colour = "red " '############### INFO ############### case 57347 ' Database Maintenance Information Colour = "green " case 58055 ' Device Information Colour = "green " case 57345 ' General Information Colour = "green " case 57752 ' IDR Full Backup Success Colour = "green " case 34579 ' Install Information Colour = "green " case 57756 ' Job Start Dim JobLength JobLength = DateDiff("h", EventDate, Now) if JobLength <= JobYellowHours then Colour = "green " elseif JobLength <= JobRedHours then Colour = "yellow " else Colour = "red " end if case 34112 ' Job Success Colour = "green " case 57743 ' Job Success - Veritas 8.5 Colour = "green " case 58059 ' Media Information Colour = "green " case 57796 ' Service Start Colour = "green " case 57797 ' Service Stop Colour = "green " case 34576 ' Software Update Information Colour = "green " case 65312 ' Tape Alert Information Colour = "green " case else ' No Valid Findings Colour = "red " Output = "INVALID EVENT ID - " & EventCode & vbcrlf end select select case Colour case "red " Output = "&red " & EventDate & " " & Output & EventMsg case "yellow " Output = "&yellow " & EventDate & " " & Output & EventMsg case "green " Output = "&green " & EventDate & " " & Output & EventMsg end select ' '############### WRITE FINDINGS TO LOG '############### ' Output = Colour & WeekdayName(Weekday(Now),True) & " " & Mid(Now,1,InStr(Now," ")-1) & " " & TimeValue(Now) & " Veritas Status" & vbCrLf & Output Logfile.WriteLine Output LogFile.Close ' Close log file '############### Subroutines ############### Function GetVBDate(wd) GetVBDate = DateSerial(left(wd,4),mid(wd,5,2),mid(wd,7,2)) _ + TimeSerial(mid(wd,9,2),mid(wd,11,2),mid(wd,13,2)) End Function Sub CreateLog(txtlog) txtlog = LogDir & txtlog If FSO.FileExists(txtlog) Then Set Logfile = FSO.OpenTextFile(txtlog, 2) Else Set LogFile = FSO.CreateTextFile(txtlog, True) End If End Sub'