# M259STO4.def: Collects StorTools 4.x Information # $Id: M259STO4.def,v 1.3 2012/05/08 04:36:04 mschenke Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/M259STO4.def,v 1.3 2012/05/08 04:36:04 mschenke Exp $ # # Change History # 20120507 MSC Apply naming conventions. =head1 NAME M259STO4 - Collects StorTools 4.x Information =head1 DESCRIPTION Collects StorTools 4.x 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('vtsst') # ----------------------------------------------------------------------------- # XPLR_vtsst section # ----------------------------------------------------------------------------- section XPLR_vtsst # Validate the execution context if !${XPLR_GLOBAL:true} return call log_run('Processing STO4 sections ...') if !is_pkg_installed('SUNWvtsst') return log_info('StorTools Diagnostics not installed') pretoc '2: StoreTools 4.x' =head2 sto4_cmd - StorTools 4.x Information Collects StorTools 4.x information using one of the following commands: =over 2 =item o C<${VTSPATH}/discman -c> =item o C<${VTSPATH}/discman -v> =back The ${VTSPATH} directory is determined from where the package has been installed and from the host processor architecture. =cut # Determine the command directory if testFile('x','/usr/bin/pkg') # IPS is installed {if grepCommand('/usr/bin/pkg contents SUNWvtsst',\ '^(.*)/SUNWvtsst/bin/discman','f1') var $dir = concat('/',last) } else # IPS is not installed var ($dir) = command('/usr/bin/pkginfo -r SUNWvtsst') if grepCommand('/usr/bin/isainfo -k','sparcv9','f') var $dir = catDir($dir,'SUNWvtsst','bin','sparcv9') else var $dir = catDir($dir,'SUNWvtsst','bin') # Check OS version var $osv = get_osv() if and(expr('==',$osv,8),grepFile('/etc/release','Solaris 8 (6/00)? s28','f')) var $osv = 0 # Perform the collection if and($dir,expr('>=',$osv,8),testFile('x',catFile($dir,'discman'))) {# Determine the command to execute if or(testFile('f','/var/opt/SUNWvtsst/logs/SnapShot.log'),\ testFile('f','/var/opt/SUNWvtsst/logs/snapshot.log')) var ($nam,$cmd) = ('vtsst/discman_-v',concat(lastCommand(),' -v')) else var ($nam,$cmd) = ('vtsst/discman_-c',concat(lastCommand(),' -c')) # Perform the collection report sto4_cmd prefix {write '---+!! Snapshot Information' write '---## Using: ',encode($cmd) } call collectCommand({nam=>$nam,\ out=>{blk=>true,flt=>true,idx=>true,rpt=>${CUR.REPORT}},\ err=>{blk=>true,flt=>true,hdr=>$ERR,rpt=>${CUR.REPORT}}\ },$cmd) if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][Snapshot Information]]' } } =head2 sto4_files - Log and Snapshot Files Collects the following log and snapshot files: =over 2 =item o F =item o F =item o F =item o F =item o F =back =cut report sto4_files title '---+!! Log and Snapshot Files' title $TOC title ' * Links point to files that have been collected in their original \ format. Opening them directly in your browser can present risks. \ To prevent them, access the file outside the browser or use the \ link to save them and use an adequate viewer.' var $dir = '/var/opt/SUNWvtsst/logs' # Collect the log files prefix {write '---+!! Log Files' write '|*File Path*| *Size*|*Last Modified Date*|' } loop $fil ('activity.log',\ 'sunvts.err',\ grepDir($dir,'\.errlog$','n')) {var $nam = concat('vtsst/',$fil) var $fil = catFile($dir,$fil) if collectFile($nam,$fil) write '|[[',last,'][_blank][',$fil,']] | ',getSize($fil),'|',\ getLastModify($fil,'%d-%b-%Y %H:%M:%S'),' |' } if hasOutput(true) write $TOP # Collect the snapshot files prefix {write '---+!! Log and Snapshot Files' write '|*File Path*| *Size*|*Last Modified Date*|' } loop $fil (grepDir($dir,'^[Ss]nap[Ss]hot\.(log|diffs)$','n')) {var $nam = concat('vtsst/',$fil) var $fil = catFile($dir,$fil) if collectFile($nam,$fil) write '|[[',last,'][_blank][',$fil,']] | ',getSize($fil),'|',\ getLastModify($fil,'%d-%b-%Y %H:%M:%S'),' |' } if hasOutput(true) write $TOP # Add the report in the table of content if isCreated() toc '3:[[',getFile(),'][rda_report][Log and Snapshot Files]]' unpretoc =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