# MCtape.ctl:256: Collects Tape Information # $Id: MCtape.ctl,v 1.5 2013/11/26 11:04:33 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/EXPLORER/MCtape.ctl,v 1.5 2013/11/26 11:04:33 RDA Exp $ # # Change History # 20131126 MSC Improve documentation. =head1 NAME EXPLORER:MCtape - Collects Tape Information =head1 DESCRIPTION This module collects information from tape devices on the system. It uses the Explorer F tool to collect tape drive information. =cut use Mrc # Initialization var $VALIDATE = true keep $VALIDATE section begin var $ERR = '---## Associated Errors' var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' run EXPLORER:XPLRlib('tape') #------------------------------------------------------------------------------ # XPLR_tape section #------------------------------------------------------------------------------ section XPLR_tape # Validate the execution context if !${B_GLOBAL:true} return if expr('<',get_osv(),8) return log_info('The OS version must be 5.8 or higher') call log_run('Processing TAPE sections ...') =head2 tape - Tape Device information Gathers tape information using the following commands: =over 2 =item o C =item o C =item o C =back =cut debug ' Inside TAPE collection, gathering tape devices information' pretoc '2:Tape Devices' report tape title '---+!! Tape Device Information' title $TOC # Validate settings var (@log,%skp) = () loop $dev (@{MOD.TAPE.N_EXCLUDED}) {if !match($dev,'^\d+$') next log_info(concat('Device identifier "',$dev,'" is not valid.')) elsif expr('>',$dev,19) next log_info(concat('Device number "',$dev,'" is out of range.')) else var $skp{$dev} = 1 } # Collect diagnostic when st_diag is found if get_bin_tool('st_diag') {var $cmd = lastCommand() if grepDir('/dev/rmt','^\.+$','nv') {for $dev (0,19) {next $skp{$dev} next !?testFile('e',$pth = concat('/dev/rmt/',$dev,'cbn')) call loadCommand(concat('/usr/bin/mt -f ',$pth,' status 2>&1')) if grepLastFile('No such file or directory','f') next push(@log,\ concat('Tape device for ',$pth,' is not attached.')) if grepLastFile('(Device busy)|(protected) | (reserved)','if') next push(@log,\ concat('Tape device for ',$pth,' is busy. No data collected.')) # Do a sleep to allow certain devices to be ready sleep 2 call loadCommand(concat($cmd,' -f ',$pth,' -c 00 2>&1')) # Ensure uniqueness of page number var %pag = () loop $uid (grepLastFile('^(\d+) \([A-Fa-f0-9]{2}\):','1')) var $pag{$id} = 1 # Get page information call do_exec({cmd => 'TITLE',txt => concat('---+ Device /dev/rmt/',$dev)}) loop $uid (keys(%pag)) call do_exec(\ [concat('tapes/rmt_',$dev,'/ModePage_',$uid),\ $cmd,concat('-f ',$pth,' -c ',$uid),\ concat('---++ Mode Page ',$uid)]) # Get LTO media attributes if and(${MOD.TAPE.B_LTO},grepLastFile('LTO','f')) call do_exec(\ [concat('tapes/rmt_',$dev,'/LTOMedia'),\ $cmd,concat('-f ',$pth,' -M'),\ '---++ LTO Media Attributes']) call do_exec({cmd => 'UNTITLE'}) } } else call push(@log,'No tape devices attached to this system') } # Collect extra information call do_exec(\ ['tapes/iostat-En',\ '/usr/bin/iostat','-En',\ '---+ I/O Statistics']) if @log call do_exec(\ ['tapes/log.out',\ undef,join("\012\012",@log),\ '---+ Tape Collection Logfile']) # Add the report to the table of content if isCreated(true) toc '3:[[',getFile(),'][rda_report][Tape Device Information]]' unpretoc #------------------------------------------------------------------------------ # Input section #------------------------------------------------------------------------------ section input var @dev = () if ?testFile('fr',catFile(${RUN.EXPLORER.D_ETC},'tapeinput.txt')) {# Parse input lines, each with one or more device numbers enclosed by [] loop $lin (grepFile(last,'^\s*#','v')) {while match($lin,'^\s*\[(\d+)\](.*)$') {var ($dev,$lin) = last call push(@dev,$dev) } } } var ${RUN.EXPLORER.XPLR.TAPE.N_EXCLUDED} = [@dev] var ${RUN.EXPLORER.XPLR.TAPE.B_LTO} = ${ENV.EXP_STDIAG_LTOMEDIA:false} var ${RUN.EXPLORER.B_USE_TAPE} = true =head1 SEE ALSO L, L =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. =head1 TRADEMARK NOTICE Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. =cut