# MCdtx.ctl:258: Collects StorEdge T3/T4 Series Disk Arrays Information # $Id: MCdtx.ctl,v 1.7 2015/05/09 15:08:04 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/EXPLORER/MCdtx.ctl,v 1.7 2015/05/09 15:08:04 RDA Exp $ # # Change History # 20150509 MSC Change handle management. =head1 NAME EXPLORER:MCdtx - Collects StorEdge T3/T4 Series Disk Arrays Information =head1 DESCRIPTION This module collects T3/T4 disk arrays series information. =cut use Buffer use Mrc use Telnet # Initialization var $VALIDATE = true keep $VALIDATE section begin var $ERR = '---## Associated Errors' var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' var $WRN = ' * 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.' run EXPLORER:XPLRlib('t3extended') # Get the ping syntax var $PING = check(${RDA.T_OS},\ 'solaris',concat(${CMD.PING:'ping'},' %s'),\ 'linux', concat(${CMD.PING:'ping'},' -c 1 %s'),\ 'cygwin', concat(${CMD.PING:'ping'},' %s 64 1')) #------------------------------------------------------------------------------ # XPLR_dtx section #------------------------------------------------------------------------------ section XPLR_dtx # Validate the execution context if !${B_GLOBAL:true} return call log_run('Processing DTX sections ...') pretoc '2:T3/T4 Disk Arrays' =head2 StorEdge T3/T4 Disk Array Information Gathers the following commands from StorEdge T3/T4 disk arrays using Telnet. Information collected vary depending on firmware version. =head3 For all Firmware Versions =over 2 =item o C<.loop stat> =item o C<.set> =item o C<.sys list> =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =back For each available enclosure u{1-4}, =over =item o C<.disk gettune u{1|2|3|4}d1-{9|14}> =item o C<.disk linkstat u{1|2|3|4}d1-{9|14} path 0> =item o C<.disk linkstat u{1|2|3|4}d1-{9|14} path 1> =item o C<.disk pathstat u{1|2|3|4}d1-{9|14}> =item o C<.disk tmon_list u{1|2|3|4}d1-{9|14}> =item o C =item o C =item o C =item o C =item o C =item o C =item o C =back =head3 For Firmware 2.0 and Later Collects additionally: =over =item o C<.ep info> =back =head3 For Firmware 2.1 and Later Collects additionally: =over =item o C =item o C =item o C =item o C =back When volume slicing is enabled, =over =item o C =item o C =item o C =item o C =item o C =item o C =back =head3 For Firmware 2.1.3 and Later Collects additionally: =over =item o C =back =head3 For Firmware 3.0 and Later Collects additionally: =over =item o C<.ecc s> =item o C<.pgrdb> =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =item o C =back For each available enclosure u{1-4}, =over =item o C<.bat -s u{1|2|3|4}pcu1> =item o C<.bat -s u{1|2|3|4}pcu2> =item o C<.devtree u{1|2|3|4}> =item o C<.disk glist u{1|2|3|4}d1-{9|14}> =item o C<.disk harderr u{1|2|3|4}d1-{9|14}> =item o C<.disk plist u{1|2|3|4}d1-{9|14}> =item o C<.disk softerr u{1|2|3|4}d1-{9|14}> =item o C =back =cut loop $itm (@{MOD.DTX.T_HOST}) {next !?$itm # Validate the input parameters debug ' Inside DTX collection, validating ',$itm,' access' if !?$hst = isHost($itm,true) next log_info(concat('Bad T3/T4 host name or IP "',$itm,'".')) call command(sprintf($PING,$hst)) if status() next log_info(concat('Host ',$hst,' is not reachable.')) if !hasPassword('host',$hst,'root') call setPassword('host',$hst,'root',\ askPassword(concat('Enter root password for T3/T4 ',$hst,': '),'')) # Connect to the T3/T4 var $ctl = new('Telnet',hst=>$hst) if !?$ctl->open next log_warning($ctl->get_info('msg')) if !?$ctl->login('root',{dis=> 'exit',\ flg=> 1,\ lim=> 10,\ pat=> 'm/.+[:<\/].+>/'}) {# Report the login dialog in case of failure var $buf = $ctl->get_input call $buf->set_handle('eol',false) var $msg = $ctl->get_message report concat('dtx_info_',$hst) prefix {title '---++ ',$hst,' Login Dialog' call addBlock('E','D',concat('disks/t3/',$hst,'/','connect_dialog.out')) } call writeFile($buf,[]) write 'Return code: ',$msg if isCreated(true) toc '3:[[',getFile(),'][rda_report][',$hst,' Connect Dialog]]' call $buf->close call $ctl->close next log_warning($msg) } # Check T3/T4 version and type var @ver = $ctl->command('ver') var ($typ,undef,$ver) = split('\s+',first(reverse(grep(@ver,'Release'))),4) if match($typ,'^6') var $slo = 'd1-14' elsif match($typ,'^T') var $slo = 'd1-9' else next log_error(concat($hst,' is not a StorEdge T3/T4')) call log_info(concat('Collecting extended data for ',$hst,\ '. It may take several minutes'),\ concat(' Inside DTX collection, gathering ',$hst,' information')) # Get additional information to prepare commands var @fru = $ctl->command('fru stat') var @sys = $ctl->command('sys list') var $val = '3' if and(compare('SAME',$ver,'2.1'),\ grep(@sys,'enable_volslice : on','f')) var $val = '2.1' # Enable dot commands var $buf = new('Buffer','S') call $ctl->collect($buf,{\ awp => "arrayservice\012",\ cln => true,\ cmd => 'sun',\ nxt => 'm/Password:\s*$/',\ pat => 'm/.+[:<\/].+>/',\ skp => true}) call $buf->close # Push commands with its minimum required firmware version var @cmd = (\ {cmd => 'ARRAY',\ det => 'ver',\ nam => concat('disks/t3/',$hst,'/ver.out'),\ tbl => \@ver,\ ttl => '---++ Controller Firmware Version'},\ ['fru list', '---++ FRU Characteristics', '1'],\ ['fru myuid', '---++ Current Controller', '1'],\ {cmd => 'ARRAY',\ det => 'fru stat',\ nam => concat('disks/t3/',$hst,'/fru_stat.out'),\ tbl => \@fru,\ ttl => '---++ FRU Statuses and Roles'},\ ['fru stat sys', '---++ FRU Operational Status', '1'],\ ['fru statistic', '---++ FRU I/O Statistics', '1'],\ ['hwwn list', '---++ WWNs Listing', $val],\ ['hwwn listgrp', '---++ Registered Group Names', $val],\ ['lpc version', '---++ Interconnect Card Firmware Version', '1'],\ {cmd => 'TITLE',txt => '---++ File Listings'},\ ['ls -l /', '---+++ /', '1'],\ ['ls -l /etc', '---+++ /etc', '1'],\ ['ls -l /web', '---+++ /web', '1'],\ ['ls -l /web/snmp', '---+++ /web/snmp', '2.1.3'],\ {cmd => 'UNTITLE'},\ ['du -a', '---++ Disk Usage', '3'],\ ['du -s', '---++ Disk Usage Summary', '3'],\ ['lun map list', '---++ LUN and Slices Mapping', $val],\ ['lun perm list', '---++ LUN Permissions', $val],\ ['lun wwn list', '---++ Registered WWNs', $val],\ ['arp -a', '---++ Address Resolution Table Entries', '1'],\ ['netstat -airs', '---++ Network Status', '3'],\ ['route -r', '---++ IP Routing Table', '1'],\ ['ntp', '---++ NTP Settings', '2.1'],\ ['ntp -v', '---++ NTP Version', '2.1'],\ ['ntp stats', '---++ NTP Information', '2.1'],\ ['date', '---++ Date and Time', '1'],\ ['tzset', '---++ Time Zone', '1'],\ ['port list', '---++ List of Ports', '1'],\ ['port listmap', '---++ LUNs and Volume Mappings', '1'],\ ['proc list', '---++ Status of Outstanding Vol Processes', '1'],\ ['refresh -s', '---++ Battery Refresh Cycle Status', '1'],\ ['savecore list', '---++ Crash Dump Images', '3'],\ ['set', '---++ Boot Parameters Values', '1'],\ ['sys fc_topology', '---++ Fibre Channel Topology', '2.1'],\ {cmd => 'ARRAY',\ det => 'sys list',\ nam => concat('disks/t3/',$hst,'/sys_list.out'),\ tbl => \@sys,\ ttl => '---++ Controller Configuration'},\ ['sys stat', '---++ Controller Status', '1'],\ ['vol list', '---++ Volume Configuration', '1'],\ ['vol mode', '---++ Cache, Mirror and Mount Status', '1'],\ ['vol stat', '---++ Operational Volume Status', '1'],\ ['volslice list', '---++ Volume Slices', $val],\ ['logger -dmprstlog','---++ Dumps Reset Log and Crash Information','1'],\ {cmd => 'TITLE',txt => '---++ Dot Commands'},\ ['.ecc s', '---+++ ECC Errors', '3'],\ ['.ep info', '---+++ Firmware Versions', '2'],\ ['.loop stat', '---+++ Loop Configuration', '1'],\ ['.pgrdb', '---+++ Persistent Group Reservations', '3'],\ ['.set', '---+++ Boot Parameters Values', '1'],\ ['.sys list', '---+++ Controller Configuration', '1'],\ {cmd => 'UNTITLE'}) var $num = grep(@fru,'u.ctr') for $id (1,$num) {var $dev = concat('u',$id) call push(@cmd,\ {cmd => 'INFO',txt => concat('collecting data for enclosure ',$dev)},\ {cmd => 'TITLE',txt => concat('---++ Enclosure ',$dev)},\ [concat('disk version ',$dev,$slo),\ '---+++ Disk Firmware Version', '1'],\ [concat('id read ',$dev),\ '---+++ Array Midplanes Information', '1'],\ [concat('id read ',$dev,'c1'),\ '---+++ Array Controller Information', '1'],\ [concat('id read ',$dev,'l1'),\ '---+++ Array Interconnect Card 1 Information', '1'],\ [concat('id read ',$dev,'l2'),\ '---+++ Array Interconnect Card 2 Information', '1'],\ [concat('global_standby list ',$dev),\ '---+++ Global Standby Configuration', '3'],\ [concat('id read ',$dev,'pcu1'),\ '---+++ Power and Cooling Unit 1 Information', '1'],\ [concat('id read ',$dev,'pcu2'),\ '---+++ Power and Cooling Unit 2 Information', '1'],\ [concat('.bat -s u',$id,'pcu1'),\ '---+++ Power and Cooling Unit 1 Battery Information','3'],\ [concat('.bat -s u',$id,'pcu2'),\ '---+++ Power and Cooling Unit 2 Battery Information','3'],\ [concat('.devtree ',$id),\ '---+++ Device Tree Information', '3'],\ [concat('.disk gettune ',$dev,$slo),\ '---+++ Disk Tunable Parameters', '1'],\ [concat('.disk glist ',$dev,$slo),\ '---+++ Errors (glist)', '3'],\ [concat('.disk plist ',$dev,$slo),\ '---+++ Errors (plist)', '3'],\ [concat('.disk harderr ',$dev,$slo),\ '---+++ Errors (hard)', '3'],\ [concat('.disk softerr ',$dev,$slo),\ '---+++ Errors (soft)', '3'],\ [concat('.disk linkstat ',$dev,$slo,' path 0'),\ '---+++ Disk Link Status Path 0', '1'],\ [concat('.disk linkstat ',$dev,$slo,' path 1'),\ '---+++ Disk Link Status Path 1', '1'],\ [concat('.disk pathstat ',$dev,$slo),\ '---+++ Disk Path Logical Configuration', '1'],\ [concat('.disk tmon_list ',$dev,$slo),\ '---+++ Disk Temperature Monitor', '1'],\ {cmd => 'UNTITLE'}) } # Generate the report report concat('dtx_info_',$hst) title '---+!! StorEdge T3/T4 Disk Array' title '---## ',$hst,' Information' title $TOC loop $rec (@cmd) {if compare('eq',ref($rec),'HASH') {if compare('eq',$rec->{'cmd'},'INFO') call log_info(ucfirst($rec->{'txt'}),\ concat(' Inside DTX collection, ',$rec->{'txt'})) else call do_exec($rec) } else {next compare('OLDER',$ver,$rec->[2]) prefix {write $rec->[1] write '---## Using: ',encode($rec->[0]) call beginBlock(true) call addBlock('E','D',concat('disks/t3/',$hst,'/',\ translate($rec->[0],' /.','_@_'),'.out')) } if $ctl->collect(${CUR.O_REPORT},{cmd=>$rec->[0]}) call log_warning($ctl->get_info('msg')) if hasOutput(true) {call endBlock() write $TOP } } } if isCreated(true) toc '3:[[',getFile(),'][rda_report][',$hst,' Information]]' # Close the connection call $ctl->close =head2 T3/T4 Series Disk Arrays Files Collects the following files from the disk arrays using FTP, regardless the firmware version: =over 2 =item o F =item o F =item o F =item o F =item o F =back =cut report concat('dtx_fil_',$hst) title '---+!! StorEdge T3/T4 Disk Array' title '---## ',$hst,' Files' debug ' Inside DTX collection, gathering files from ',$hst,' thorough FTP' call createFtp('FTP',$hst) call ftpLogin('FTP','root') if isFtpSuccess('FTP') {call setFtpBinary('FTP') call ftpCd('FTP','/') prefix {write $WRN write '|*File Path*| *Size*|' } loop $grp ('cmdlog*','syslog*','etc/hosts','etc/*.log','etc/*.conf') {loop $fil (ftpLs('FTP',$grp)) {call ftpCollectFile('FTP',concat('disks/t3/',$hst,'/files/',$fil),$fil) write '|[[',last,'][_blank][/',$fil,']] | ',getFtpLength('FTP'),'|' } } if hasOutput(true) write $TOP call deleteFtp('FTP') } else log_info(concat('Cannot do a FTP login on ',$hst)) if isCreated(true) toc '3:[[',getFile(),'][rda_report][',$hst,' Files]]' } =head2 dtx_input - Input File Lists the characteristics of the specified input file. =cut if ?testFile('r',catFile(${MOD.DTX.F_CFG})) {debug ' Inside DTX collection, getting input file characteristics' report dtx_input call do_exec(\ [concat('disks/t3/ls_-l_',replace(lastFile(),'\/','@',true)),\ ${CMD.LS:'ls'},concat('-l ',quote(lastFile())),\ '---+ Explorer Input File']) if isCreated() toc '3:[[',getFile(),'][rda_report][Input File]]' } unpretoc #------------------------------------------------------------------------------ # Input file conversion section #------------------------------------------------------------------------------ section input # Define the input file parser macro macro parse_input {var ($fil,$flg) = @arg var @sta = getStat($fil) if !expr('&',$sta[2],077) {# Parse the input file var @hst = () loop $lin (grepFile($fil,'^\s*#','v')) {var ($hst,$pwd) = split('\s+',trim($lin),2) next !?$hst = isHost($hst,true) if ?$pwd call setPassword('host',$hst,'root',$pwd) call push(@hst,$hst) } # Save the parsing results if @hst {var ${RUN.EXPLORER.XPLR.DTX.F_CFG} = $fil var ${RUN.EXPLORER.XPLR.DTX.T_HOST} = [@hst] var ${RUN.EXPLORER.B_USE_DTX} = true } else var ${RUN.EXPLORER.B_USE_DTX} = $flg } } # Parse the input file if and(defined($fil = ${ENV.EXP_T3INPUT_CONFIG}),\ defined(testFile('frs',catFile($fil)))) call parse_input(lastTestFile(),true) elsif ?testFile('frs',catFile(${RUN.EXPLORER.D_ETC},'t3input.txt')) call parse_input(lastTestFile(),false) =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