Video Screencast Help

BPIMAGELIST - Output desired fields from image DB (Windows)

Created: 19 Mar 2013 • Updated: 25 Mar 2013 | 13 comments
This issue has been solved. See solution.

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

Discussion Filed Under:

Comments 13 CommentsJump to latest comment

Mark_Solutions's picture

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 "Mark as Solution" if someones advice has solved your issue - and please bring back the Thumbs Up!!.

D.Flood's picture

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).

 

Mark_Solutions's picture

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

AttachmentSize
imagelist.txt 635 bytes
list.txt 99 bytes

Authorised Symantec Consultant

Don't forget to "Mark as Solution" if someones advice has solved your issue - and please bring back the Thumbs Up!!.

StefanosM's picture

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

-matt-'s picture

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

 

Nicolai's picture

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.

revaroo's picture

I did this by installing Cygwin, you get grep and awk. Perfect.

Mark_Solutions's picture

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 "Mark as Solution" if someones advice has solved your issue - and please bring back the Thumbs Up!!.

Mark_Solutions's picture

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 "Mark as Solution" if someones advice has solved your issue - and please bring back the Thumbs Up!!.

-matt-'s picture

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.

Mark_Solutions's picture

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 "Mark as Solution" if someones advice has solved your issue - and please bring back the Thumbs Up!!.

SOLUTION
-matt-'s picture

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! :-)

Vickie's picture

 

Please follow below steps,
 
1) First run below command.
 
C:\>bpimagelist -client client_name -hoursago 100 -l > imagelist.txt
 
2) Now run below command.
 
C:\>FOR /F "tokens=1,2,11,14,16,19" %G in (imagelist.txt) DO @echo %G    %H   %I    %J    %K    %L| findstr /B IMAGE
 
 
Out-put of the above 2nd mentioned command is as follows.
 
IMAGE    client_name Differential-Inc    1364180573    1365390173    614
IMAGE    client_name Differential-Inc    1364180410    1365390010    793
IMAGE    client_name Differential-Inc    1364094167    1365303767    465
IMAGE    client_name Differential-Inc    1364094005    1365303605    785
IMAGE    client_name Full    1364011372    1365220972    912626
IMAGE    client_name Full    1364011211    1365220811    54302
IMAGE    client_name Differential-Inc    1364007767    1365217367    10037
IMAGE    client_name Differential-Inc    1364007608    1365217208    1565
IMAGE    client_name Weekly-Full    1364004957    1372040157    1287292
IMAGE    client_name Weekly-Full    1364004636    1372039836    6598390
IMAGE    client_name Weekly-Full    1364004002    1372039202    8752255
IMAGE    client_name Differential-Inc    1363921360    1365130960    1464
IMAGE    client_name Differential-Inc    1363921205    1365130805    1573
IMAGE    client_name Daily-Incremental    1363910647    1365120247    1287151
IMAGE    client_name Daily-Incremental    1363910555    1365120155    492477
IMAGE    client_name Daily-Incremental    1363910402    1365120002    383047
 
Following are the fileds mentioned in above outcome
 
1) Record Header
2) Client Name
3) Schedule Label
4) Backup Time
5) Expiration
6) Kbytes Written
 
3) To get the time from 4th and 5th fields, you have to run below command. I used the 4th and 5th field from output given above.
 
C:\>bpdbm -ctime 1364180573
1364180573 = Sun Mar 24 23:02:53 2013
 
C:\>bpdbm -ctime 1365390173
1365390173 = Sun Apr 07 23:02:53 2013
 
This might give the desired information as you asked in your post. smiley
Please let us know if this is what you'r looking for.