#!/usr/local/bin/perl -w # This script is generates a summary report of all media in a specific robot die "Usage: all_tape_summary \n" if ($#ARGV == -1); # Set variables $today1=`date +%m%d%y`; $today2=`date`; $nbbin="/usr/openv/netbackup/bin/admincmd"; $vmbin="/usr/openv/volmgr/bin"; $robot=$ARGV[0]; $robot_num=`$nbbin/bpstulist | grep $robot | cut -d" " -f5 | sort -u`; open(AVAIL_MEDIA,"/usr/openv/netbackup/reports/avail_media"); open(REPORT,">/usr/openv/netbackup/reports/${robot}_all_summary.$today1"); # Store media id, slot number and status of all tapes in robot while () { next if !/^[A-Z,0-9]{6}/; @fields=split; if ( $fields[2] eq "TLD" && $fields[3] == $robot_num ) { $media_info{$fields[0]}=[ $fields[4], $fields[8] ]; } } # Print report heading print REPORT " SUMMARY REPORT OF ALL MEDIA ON $robot\n"; print REPORT " $today2\n"; print REPORT "Media Id Slot Number Volume Pool Status Expiration Date\n"; print REPORT "-------- ----------- ----------- ------ ---------------\n"; # Print the following information for each tape in robot: # Media id, slot location in robot, volume pool, status and expiration date foreach $media (keys %media_info) { $pool=`$vmbin/vmquery -m $media | grep "volume pool" | cut -d" " -f13`; $expire=`$nbbin/bpmedialist -L -ev $media | grep expiration | cut -d" " -f3,4`; chop($pool); chop($expire); printf REPORT "%-15s%-11s%-17s%-12s%s\n",$media,$media_info{$media}[0],$pool,$media_info{$media}[1],$expire; } close(AVAIL_MEDIA); close(REPORT); exit;