Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Anyone for a windows savegrp.log Daily reporter

Status
Not open for further replies.

bertieuk

IS-IT--Management
Jun 1, 2004
175
Hi

I have written a daily log reporter for Windows that strips out the savegrp.log file for a 24 hr period and sends it to an email address. This has been written in wsh/vbs. It simply informs on start and stop times for completed job but will expand all info relating to alerts. Anyone want a copy?
 
Hi,
i am very interested in this tool.
If its´s possible, let me have a copy of it.

Regards
Manfred
 
Why not put a FAQ together with an ftp link?
Last time a 'me too' thread started it lasted for ages.
 
All

I am sorry it has taken a while to reply to this. This is a script I wrote about 18 months ago when I was evaluating Legato.

This was writen in my early days of vbs scripting so take a look and try it out. A couple of things to note:

1) The script expects savegrp.log and the script to be in the save folder.

2) For email support you will need to add a smtp mail relay address (mine is 192.168.70.18 our internal exchange server). The sender and recipent addresses are define at the bottom of the script.....Change these.

3) The log cutoff is from 6am to 6am within each 24 hour period.

Code:
'******************************************************************
'*
'*	ParseStartgrpLog.vbs		by Si
'*
'*	
'*
'******************************************************************

'Option Explicit
'On Error Resume Next
Dim strOutputLog
Dim appLog
Dim SearchString
Dim objTextFile
Dim strNextLine
Dim intSize
Dim objSendMail
Dim objFSO
Dim i
Dim ErrorString
Dim newArray


appLog = ".\savegrp.log"
grpStart = "NetWorker savegroup:"
intSize = 0
strOutputLog = ""
Const ForReading = 1

' If Instr() returns 0 then "cscript.exe" is not the host,
'   alert the user and return

If Instr(1, WScript.FullName, "cscript.exe", vbTextCompare) = 0 then
    MsgBox " Host: " & WScript.FullName & vbCRLF & _
           "This script must be executed by cscript.exe", _
           vbCritical, _
           "Error: " & Wscript.ScriptFullName

    Wscript.Quit(1)                         ' return error code to caller
End If


' Send a email message with the extracted log file info
Sub SendMail(Sender, Recipient, Subject, Message)
	Set objSendMail = CreateObject("CDO.Message")
	  objSendMail.From = Sender
	  objSendMail.To = Recipient
	  objSendMail.Subject = Subject
	  objSendMail.TextBody = Message
	  objSendMail.Configuration.Fields.Item _
		("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2
	  objSendMail.Configuration.Fields.Item _
		("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = _
			"192.168.70.18"
	  objSendMail.Configuration.Fields.Item _
		("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25
	  objSendMail.Configuration.Fields.Update
	  objSendMail.Send
	set objSendMail = Nothing
End Sub

'Get the current DD/MM/YY as strings.
strDay = Right("00" & Cstr(Day(Date())-1),2)
strDay1 = Right("00" & Cstr(Day(Date())),2)
strMonth = Right("00" & Cstr(Month(Date())),2)
strYear  = Cstr(Year(Date()))

strDateFrom = strDay & "-" & strMonth & "-" & strYear
strDateTo = strDay1 & "-" & strMonth & "-" & strYear

strOutputLog = strOutputLog & "Running Report for 06:00 " & strDateFrom & " to 06:00 " & strDateTo & vbcrlf

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
	(appLog, ForReading)


Do Until objTextFile.AtEndofStream
	strNextLine = objTextFile.ReadLine
	If InStr (strNextLine, grpStart) Then
		If InStr (strNextLine, "(alert)") Then
			gpN = Split (strNextLine, ":")	'isolate the group save set
			grpName = Split (gpN(4), ",")
			strOutputLog = strOutputLog & vbcrlf & grpName(0) & vbcrlf

			strOutputLog = strOutputLog & "******************************************" &_
				"****************************" & vbcrlf & vbcrlf
			strNextLine = objTextFile.ReadLine
			Do Until InStr (strNextLine, grpStart)
				strOutputLog = strOutputLog & strNextLine & vbcrlf
				strNextLine = objTextFile.ReadLine
			Loop
			strOutputLog = strOutputLog & (vbcrlf & "************************************" &_
				"**********************************" & vbcrlf)
		Else
			gpN = Split (strNextLine, ":")	'isolate the group save set
			grpName = Split (gpN(4), ",")
			strOutputLog = strOutputLog & grpName(0) & vbcrlf
			strNextLine = objTextFile.ReadLine
			stTime = Split (strNextLine, ":")
			startTime = vbtab & stTime(3) & stTime(4) & ":" & stTime(5) & ":" & stTime(6)
			strOutputLog = strOutputLog & startTime & vbcrlf
			strNextLine = objTextFile.ReadLine
			spTime = Split (strNextLine, ":")
			stopTime = vbtab & spTime(3) & spTime(4) & ":" & spTime(5) & ":" & spTime(6)
			strOutputLog = strOutputLog & stopTime & vbcrlf			
		End If
	End If
Loop			

objTextFile.Close

strOutputLog = strOutputLog & "All Done"


SendMail "networker@mybackup.com", "si@myaddress.com", "Networker SaveGroup Log", strOutputLog
WScript.Echo(strOutputLog)

Copy the code and paste into a file ending with vbs. run using cscript or wscript.

The rest should be ok....not sure cus I haven't run it for such a long time.....let me know any problems I can help with.

Thanks si
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top