in reply to Re: ^4 Parse backup log
in thread Parse backup log

Do you want to match all tapes, or just the frozen ones? It would appear you only want to match frozen tapes. A match function like this:

# # Go through each line of input and create entries for only tapes # matching the "FROZEN" status. # sub match { while (<IMAGES>) { next unless m/\(FROZEN\)/; # skip non-frozen tapes chomp; s/^\s+//; # remove any leading spaces create_entry(split(/\s+/)); } }
would match only the frozen tapes and then run the create_entry() function for each match.

Replies are listed 'Best First'.
Re: ^6 Parse backup log
by mrbbq (Sexton) on Apr 20, 2004 at 20:44 UTC
    I want to match all frozen tapes....let me play around with your code and Ill see what I get...oh and thanks a bunch for all your help.
Re: ^6 Parse backup log
by mrbbq (Sexton) on Apr 20, 2004 at 20:53 UTC
    That seemed to work ok but did not match all the frozens:
    bash-2.03$ more frozen.html <HTML><HEAD><TITLE>Netbackup Frozen Tape Report</TITLE><H1><CENTER>HEV +A-ATL Frozen Tape Report</H1></CENTER></HEAD><BR><CENTER><FONT SIZE=5>Last updated: 04/20/104 <BR>at 1:54:43 PM </FONT></CENTER><BOD +Y BGCOLOR=white><BR><BR><CENTER><TABLE BORDER=4 WIDTH=60%><TR ALIGN=CENTER><TD>Media ID</TD><TD>Expiration Date</TD><TD>Expiration T +ime</TD></TR> <TR ALIGN=CENTER><TD COLSPAN=3>No currently expired FROZEN tapes</TD>< +/TR> <TR ALIGN=CENTER><TD COLSPAN=3>The following are FROZEN but NOT yet ex +pired</TD></TR> <TR ALIGN=CENTER><TD>ST0026</TD><TD>07/20/2004</TD><TD>22:13 </TD></TR><TR ALIGN=CENTER><TD>ST1606</TD><TD>07/14/2004</TD><TD>22:43 </TD></TR><TR ALIGN=CENTER><TD>ST2838</TD><TD>07/09/2004</TD><TD>20:46 </TD></TR><TR ALIGN=CENTER><TD>ST3574</TD><TD>07/19/2004</TD><TD>22:43 </TD></TR><TR ALIGN=CENTER><TD>ST4173</TD><TD>07/10/2004</TD><TD>20:30 </TD></TR><TR ALIGN=CENTER><TD>ST4782</TD><TD>06/19/2004</TD><TD>22:00 </TD></TR></TABLE></CENTER></BODY></HTML>
    bash-2.03$ /usr/openv/netbackup/bin/admincmd/bpmedialist -summary | gr +ep -i frozen ACTIVE FULL SUSPENDED FROZEN IMPORTED ST0315 (FROZEN) ST0306 (FROZEN) ST0304 (FROZEN) ST0314 (FROZEN) ST0308 (FROZEN) ST0309 (FROZEN) ST0312 (FROZEN) ST4910 (FROZEN) ST4782 expires 06/19/2004 22:00 (FROZEN) ST2838 expires 07/09/2004 20:46 (FROZEN) ST4173 expires 07/10/2004 20:30 (FROZEN) ST1606 expires 07/14/2004 22:43 (FROZEN) ST3574 expires 07/19/2004 22:43 (FROZEN) ST0026 expires 07/20/2004 22:13 (FROZEN)

      I would suggest changing your create_entry function to look like this:

      sub create_entry { # If only two fields are present, the index must # be "expired" (rather than expiring.) $_[1] = 'expired' if @_ == 2; my ($tape_id, @rest) = @_; push (@{$tape_index{$tape_id}}, [$tape_id, @rest]); }

      The problem you're experiencing is that when you have a line like:

      ST4910 (FROZEN)
      you are only getting two fields in your hash. The tape_id, and "(FROZEN)" for the expired field. You then are searching on the "expired" key, which is not present. By changing your create_entry function to the above, both the "expired" and "expires" keys will be properly created.

        That works great! Thanks for all the help....bowing down to your monkdom....