#!/usr/local/bin/perl -w # This script generates a report containing details for a specific tape in a # specific robot. die "Usage: all_tape_details \n" if ($#ARGV == -1); # Set variables $today1=`date +%m%d%y`; $today2=`date`; $nbbin="/usr/openv/netbackup/bin/admincmd"; $vmbin="/usr/openv/volmgr/bin"; $media=$ARGV[0]; open(AVAIL_MEDIA,"/usr/openv/netbackup/reports/avail_media"); open(REPORT,">/usr/openv/netbackup/reports/${media}_details.$today1"); # Store media id, slot number and status of all full tapes in robot while () { next if !/$media/; @fields=split; $slot=$fields[4]; $status=$fields[8]; } # Print report heading print REPORT " DETAILED MEDIA REPORT FOR $media\n"; print REPORT " $today2\n"; print REPORT "Media Id Slot Number Volume Pool Status Expiration Date\n"; print REPORT " ImageID Class Schedule Copy Fragment Kilobytes BackupDate Keyword\n"; print REPORT "---------------------------------------------------------------------------\n"; # Print the following information for tape: # Media id, slot location in robot, volume pool, status and expiration date chop($pool=`$vmbin/vmquery -m $media | grep "volume pool" | cut -d" " -f13`); chop($expire=`$nbbin/bpmedialist -L -ev $media | grep expiration | cut -d" " -f3,4`); printf REPORT "%-15s%-11s%-17s%-12s%s\n",$media,$slot,$pool,$status,$expire; # For each image on tape list: backup id, copy #, fragment #, kilobytes # of data, backup class, backup type, # of files and keyword (if applicable) @images=`$nbbin/bpimmedia -l -mediaid $media`; for (@images) { if (/^IMAGE/) { @fields=split /\s+/, $_, 8; ($id,$class,$type)=($fields[3],$fields[4],$fields[6]); } if (/^FRAG/) { @fields=split /\s+/, $_, 14; next if ($fields[8] ne $media); ($copy,$frag,$size,$time)=($fields[1],$fields[2],$fields[3],$fields[12]); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime($time); chop($keyword=`$nbbin/bpimagelist -L -backupid $id | grep Keyword | cut -d" " -f12,13`); print REPORT " $id $class $type $copy $frag $size $mon/$mday/$year $keyword\n"; } } close(AVAIL_MEDIA); close(REPORT); exit;