# M256TAPE.def: Collects Tape Information # $Id: M256TAPE.def,v 1.2 2012/08/11 07:43:27 mschenke Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/M256TAPE.def,v 1.2 2012/08/11 07:43:27 mschenke Exp $ # # Change History # 20120811 MSC Suppress the README. =head1 NAME M256TAPE - 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 XPLRlib('tape') #------------------------------------------------------------------------------ # XPLR_tape section #------------------------------------------------------------------------------ section XPLR_tape # Validate the execution context if !${XPLR_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 follwing 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) = () var $lto = getSetting('XPLR_TAPE_LTO') loop $dev (split('\|',getSetting('XPLR_TAPE_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($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 2 #------------------------------------------------------------------------------ # Input section #------------------------------------------------------------------------------ section input var @dev = () if testFile('fr',$fil = catFile(${XPLR_ETC},'tapeinput.txt')) {# Parse input lines, each with one or more device numbers enclosed by [] loop $lin (grepFile($fil,'^\s*#','v')) {while match($lin,'^\s*\[(\d+)\](.*)$') {var ($dev,$lin) = last call push(@dev,$dev) } } } call setTempSetting('XPLR_TAPE_EXCLUDED',join('|',@dev)) call setTempSetting('XPLR_TAPE_LTO',getEnv('EXP_STDIAG_LTOMEDIA',false)) call setTempSetting('xplr_tape_accept',true) =head1 SEE ALSO L, L =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2012, 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