BPIMAGELIST - Output desired fields from image DB (Windows)
NBU 7.5.0.4
W2K8R2
Hi all,
I saw a great artical from Andy Welburn advising how best to use bpimagelist with awk to output the desiered fields from the image database on UNIX;
DOCUMENTATION: What are the different fields in "bpimagelist -l" output?
http://www.symantec.com/business/support/index?pag...
Elapsed time is one of the output fields....
Also, bpimagelist -L will give these fields in a more readable form.
You could be looking at a lot of output so may want to "filter" your results somehow!
e.g.
bpimagelist -l -d 06/07/2011 00:00:00 -e 06/08/2011 00:00:00 -client client | awk '/^IMAGE/ {print $2, $7, $15}'
will produce output only of client name, policy & elapsed time (seconds) for backups between those times.
I'm looking for the equivilent tool to manipulate the output on Windows and found the nearest option is FINDSTR, but it doesn't quite cut it. It filters the output like grep but theres no controlling what fields from the image database to display.
I need to output client name, backup date, schedule, copy number, expiration date and byte count for a number of clients. I find this simple task frustratingly difficult in the unlicensed (currently) version of Ops Centre.
Any help appreciated.
Matt
Comments 13 Comments • Jump to latest comment
Two options here ..
One is to use a batch file (.bat) that first runs the command and outputs the result and then runs a vb script that reads this output and reads the appropriate fields - arrFields - and outputs just what you want
See if you can find someone good at that to assist
The second is to download grep for Windows - just google it - you can then use the same commands as in Andys excellent thread
Hope this helps
Authorised Symantec Consultant
Don't forget to give a "Thumbs Up" or mark as "Solution" if someones advice has helped you.
Since you're running Win 2k8 R2 you could install the Services for Unix subsystem. But just installing the role doesn't give you any tools. You also have to download and install the SDK for Services for Unix and set your path correctly. Then things like SED and AWK are there and have about 98% of the usual functionality (the syntax can be a little different).
Ok - done a little work for you ...
Rename list.txt to list.bat and imagelist.txt to imagelist.vbs and put both in the root of the C drive on the Master
Edit list.bat so that the path for bpimagelist is correct
Run list.bat and it should produce imagelist.csv in the root of the C drive
Haven't tested it so it may need some work but give it a go
Hope this helps
Authorised Symantec Consultant
Don't forget to give a "Thumbs Up" or mark as "Solution" if someones advice has helped you.
you can use msysgit.
I tried almost all UNIX alternatives and I found that msysgit is probably the best.
I'm installing it on every windows installation I have.
http://code.google http://code.google.com/p/msysgit/downloads/liste
Hi all,
Just checking posts whist back at home.
Thanks to everyone for your replies, espescially Mark_Solutions for actaully coding up a solution!
Will look at them all tomorrow.
Much appreciated,
Matt
Glad to hear.
Please consider to mark one of the post as a soloution.
Assumption is the mother of all mess ups.
If this post answered your'e qustion - Please mark as a soloution.
I did this by installing Cygwin, you get grep and awk. Perfect.
Due to the output of the command will need to do more work on this one .. will get back to you later
Authorised Symantec Consultant
Don't forget to give a "Thumbs Up" or mark as "Solution" if someones advice has helped you.
Ok - needs lots of work!! - but sure you get the idea and maybe can play with it a bit.
Latest attempt uses the following for the first 3 fiedls needed - trouble is that dates and times are in unix
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\imagelist.txt", ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
arrFields = Split(strLine, " ")
If InStr(arrFields(0), "IMAGE") Then
strContents = strContents & arrFields(1) & "," & arrFields(6) & "," & arrFields(10) & "," & vbCrlf
End If
Loop
objFile.Close
strContentsa = "Client Name,Policy,Schedule," & vbCrlf
Set objFile = objFSO.CreateTextFile("C:\imagelist.csv")
objFile.Write strContentsa
objFile.Write strContents
objFile.Close
.....................................
One thought here, it is not exactly what you need but not far off, have you tried this:
bpcatlist -since-days 7 -client clientname
or for everything just bpcatlist ( a few day /week / month options etc for this command too)
Is that near enough?
Authorised Symantec Consultant
Don't forget to give a "Thumbs Up" or mark as "Solution" if someones advice has helped you.
Spoiled for choice here, but I've had some help with the scripting.
Mark, I had errors running your script. I think bpimagelist with the -L parameter produces the output in a nice list, but not sure if your code accounts for that and is expecting one long line of output? Anyway, it bombed out.
I've got this slighted modified version which appears to do the trick;
Const ForReading = 1
Dim arrOutput(7)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\imagelist.txt", ForReading)
Set objOutput = objFSO.CreateTextFile("C:\imagelist.csv")
objOutput.WriteLine "Client Name,Policy,Schedule Label,Backup Date,Expiry Date,Backup Size(KB),Schedule Type,Copies"
Do Until objFile.AtEndOfStream
boolEmpty = TRUE
arrFields = Split(objFile.ReadLine, ": ")
If UBound(arrFields) => 1 then
If arrFields(0) = "Client" Then arrOutput(0) = Trim(arrFields(1))
If arrFields(0) = "Policy" Then arrOutput(1) = Trim(arrFields(1))
If arrFields(0) = "Sched Label" Then arrOutput(2) = Trim(arrFields(1))
If arrFields(0) = "Backup Time" Then arrOutput(3) = Trim(Left(arrFields(1), Instr(arrFields(1), " (")))
If arrFields(0) = "Expiration Time" Then arrOutput(4) = Trim(Left(arrFields(1), Instr(arrFields(1), " (")))
If arrFields(0) = "Kilobytes" Then arrOutput(5) = Trim(arrFields(1))
If arrFields(0) = "Schedule Type" Then arrOutput(6) = Trim(Left(arrFields(1), Instr(arrFields(1), " (")))
If arrFields(0) = "Number of Copies" Then arrOutput(7) = Trim(arrFields(1))
End If
For Each strElemenent in arrOutput
If strElemenent = vbEmpty Then
boolEmpty = TRUE
Exit For
End If
boolEmpty = FALSE
Next
If Not boolEmpty Then
For intCount = LBound(arrOutput) To UBound(arrOutput)
If intCount = UBound(arrOutput) Then
strOutput = strOutput & arrOutput(intCount)
Else
strOutput = strOutput & arrOutput(intCount) & ","
End If
arrOutput(intCount) = vbEmpty
Next
objOutput.WriteLine strOutput
strOutput = ""
End If
Loop
objFile.Close
objOutput.Close
Work is still required but its coming along nicely thanks to you.
Good stuff - i did put my amended script above but having said that i think i altered it to use either -l or maybe even bpmedialist!
Keep us updated on the progress!
Authorised Symantec Consultant
Don't forget to give a "Thumbs Up" or mark as "Solution" if someones advice has helped you.
Hi Mark et all,
Loads more progress with the script and I'm happy that this has formed a solution. The lowercase -l allowed a better way delimit the the txt in the output file. Just tweaking it a bit to get the desired output.
Points to Mark for his hard work on the script but a big thanks to all who contributed.
...I am a Windows man! :-)
Would you like to reply?
Login or Register to post your comment.