# MCd3kr.ctl:258: Collects Information from Remote StorEdge 3000 Arrays # $Id: MCd3kr.ctl,v 1.7 2015/02/25 19:11:36 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/EXPLORER/MCd3kr.ctl,v 1.7 2015/02/25 19:11:36 RDA Exp $ # # Change History # 20150225 PRA Improve compliance on symbols and abbreviations. =head1 NAME EXPLORER:MCd3kr - Collects Remote StorEdge 3000 Disk Arrays Information =head1 DESCRIPTION Collects remote StorEdge 3000 disk arrays information (out-of-band mode). The following reports can be generated and are regrouped under C: =cut use Buffer use Mrc # 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('se3kextended') # 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_se3kextended section #------------------------------------------------------------------------------ section XPLR_se3kextended # Validate the execution context if !${B_GLOBAL:true} return call log_run('Processing D3KR sections ...') if !cond(${OS.solaris},\ or(is_pkg_installed('SUNWsccli'),\ is_pkg_installed('SUNWsscs')),\ ${OS.linux},\ or(command('/bin/rpm -q SUNWsscs >/dev/null 2>&1'),\ command('/bin/rpm -q SUNWsccli >/dev/null 2>&1')),\ false) return log_info('Neither SUNWsccli nor SUNWsscs installed. \ No sccli output will be gathered.') pretoc '2: StorEdge 3000 Series Remote Information' =head2 Command-line Interface (SCCLI) Information For each remote StorEdge 3000 device, collects the following commands: =over 2 =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 =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 It includes the configuration files produced by the execution of the following C commands: =over 2 =item o C =item o C =back For C<3510> device type, collects also: =over 2 =item o C =item o C =back For C<3511> device type, collects also: =over 2 =item o C =item o C =item o C. =back =cut var $SCCLI = '/usr/sbin/sccli' var ($ver) = grepCommand(concat($SCCLI,' -v 2>/dev/null'),\ '\s+(\d+\.\d+\.?\d*)$','1') if compare('OLDER',$ver,'1.2.2') return log_error('sccli minimum version must be 1.2.2 to gather remote \ information.') var $FLG = compare('VALID',$ver,'2.5') var @SHW = (\ ['access-mode', '---+ Communication Mode'],\ ['auto-write-through-trigger', '---+ Event Trigger Configuration'],\ ['battery-status', '---+ Battery Modules Information',\ '3510|3511'],\ ['bypass raid', '---+ Bypass Status: Loop A and Loop B',\ '3510|3511'],\ ['bypass * ses-channel', '---+ Bypass Status: ','3510|3511'],\ ['cache-parameters', '---+ Read/Write Cache Information','P'],\ ['channels', '---+ Host, Drive, and RCCOM Channels'],\ ['clone', '---+ Disk Cloning Progress'],\ ['configuration', '---+ Array Configuration','T'],\ ['configuration -x', '---+ Array Configuration in XML','T'],\ ['controller-date', '---+ Controller Boot Time and Date','P'],\ ['controller-name', '---+ Controller Name','P'],\ ['disks', '---+ Disk Drive Information'],\ ['disk-array', '---+ Disk Array Parameters'],\ ['drive-parameters', '---+ Disk Drive Parameters'],\ ['enclosure-status', '---+ Chassis Components Status','3310'],\ ['events', '---+ Controller Events','T'],\ ['inquiry-data', '---+ Inquiry Information','P'],\ ['frus', '---+ FRU Information'],\ ['host-parameters', '---+ Host Parameters'],\ ['host-wwn-names', '---+ Registered Host Bus Adapter Entries'],\ ['ip-address', '---+ IP Address'],\ ['inter-controller-link', '---+ Port Bypass Circuit Status','T'],\ ['led-status', '---+ Led Status','3310'],\ ['logical-drives', '---+ Logical Drive Information'],\ ['logical-drives expanding', '---+ Logical Drive Expansion Progress'],\ ['logical-drives initializing','---+ Initialization Status'],\ ['logical-drives parity-check','---+ Parity Check Status'],\ ['logical-drives rebuilding', '---+ Rebuild Status'],\ ['logical-volumes', '---+ Logical Volumes Information'],\ ['loop-map channel', '---+ Fiber Channel Loop Positional Map',\ '3510|3511'],\ ['lun-maps', '---+ Partitions Mapped to Channel'],\ ['media-check', '---+ Media Check Progress'],\ ['network-parameters', '---+ Network Management Port Information'],\ ['partitions', '---+ Disk Partition Information'],\ ['peripheral-device-status', '---+ Environmental Sensors Status'],\ ['persistent-events', '---+ Controller Persistent Events'],\ ['port-wwns', '---+ Worldwide Name Entries'],\ ['protocol', '---+ Protocols Information'],\ ['redundancy-mode', '---+ Redundant Pair Information','P'],\ ['redundant-controller-configuration',\ '---+ Redundant-Controller Information','P'],\ ['rs232-configuration', '---+ RS-232 Connection Configuration'],\ ['safte-devices', '---+ SCSI Accessed Fault-Tolerant','3310'],\ ['sata-mux', '---+ SATA Multiplexer Board Information',\ '3511'],\ ['sata-router', '---+ SATA Router Information','3511'],\ ['ses-devices', '---+ SCSI Enclosure Services Devices',\ '3510|3511'],\ ['shutdown-status', '---+ Shutdown Status','P'],\ ['stripe-size-list', '---+ Stripe Block Size List'],\ ['unique-identifier', '---+ Unique Identifier','P']) # Process and validate input loop $itm (@{MOD.D3KR.T_HOST}) {next !?$itm # Validate the input parameters debug ' Inside D3KR collection, validating ',$itm,' access' if !?$hst = isHost($itm,true) next log_info(concat('Bad Storage 3000 array host name or IP "',$itm,'".')) call command(sprintf($PING,$hst)) if status() next log_info(concat('StorEdge 3000 Array ',$hst,' is not reachable.')) var $pwd = ['host',$hst,'[d3kr]',\ concat('Enter password for StorEdge 3000 Array ',$hst,': '),''] # Validate the communication with the array var $cmd = join(' ',$SCCLI,cond($FLG,'-w %s'),concat('se3000://',$hst),\ '&1') var ($lin) = grepCommand({cmd=>$cmd,pwd=>$pwd},'selected se3000','f') if !$lin next log_info(concat('Unable to connect to ',$hst,' by using sccli.')) # Run report for each valid host debug ' Inside D3KR collection, gathering commands for device(s) on ',$hst pretoc '3: Command-line Interface (SCCLI) Information - ',$hst # Get the device information var $lin = replace(replace($lin,'^.* se3000:','se3000:'),'\s+\(.*$') var ($dev) = match($lin,'^(\S+)') var ($arr) = match($lin,'\s(\S+)\]$') var ($typ) = match($lin,'\[\S+\s+\S+\s+(\S+)') var $pre = join(' ',$SCCLI,cond($FLG,'-w %s'),$dev) var $dir = concat('disks/se3k/sccli/',$arr) debug ' - ',$dev if and(compare('eq',$typ,'3511'),compare('OLDER',$ver,'1.6.1')) next log_info('sccli version 1.6.1 or later is needed to gather sccli \ information from StorEdge 3511 disk arrays.') var $cmd = join(' ',$SCCLI,'-w %s',$dev,'show cache-parameters 2>&1') var $pri = not(grepCommand({cmd=>$cmd,pwd=>$pwd},\ 'operation is only supported on RAID primary','f')) var $cmd = join(' ',$pre,'show channels 2>&1') var @chn = grepCommand({cmd=>$cmd,pwd=>$pwd},'^\s*\d+.+(Drive|DRV|Host)') var @cmd = ([concat($dir,'/version'),\ $SCCLI,'version',\ '---+ StorEdge 3000 Command Line Interface Version']) # Add show commands loop $rec (@SHW) {var ($cmd,$ttl,$nam) = ($rec->[0],$rec->[1],replace($rec->[0],' ','_',1)) var ($rpt,$arg) = (concat($dir,'/show_',$nam),join(' ','show',$cmd)) # Treat all commands that do not need tweaks or specific controllers if !?$rec->[2] call push(@cmd,[$rpt,$SCCLI,$arg,$ttl]) elsif compare('eq',$rec->[2],'P') {# Treat commands for all primary controllers if $pri call push(@cmd,[$rpt,$SCCLI,$arg,$ttl]) } elsif compare('eq',$rec->[2],'T') {# Treat commands for all controllers but needing some tweaks if compare('eq',$cmd,'configuration') call push(@cmd,\ [concat($dir,'/show_configuration.out'),$SCCLI,$arg,$ttl,{ext=>''},15]) elsif compare('eq',$cmd,'configuration -x') call push(@cmd,\ [concat($dir,'/show_configuration.xml'),$SCCLI,$arg,$ttl,{ext=>''},15]) elsif compare('eq',$cmd,'events') {call push(@cmd,[$rpt,$SCCLI,$arg,$ttl]) if compare('VALID',$ver,'2.1') call push(@cmd,\ [concat($rpt,'-v'),$SCCLI,join(' ',$arg,'-v'),\ concat('---+ Detailed Controller Events (-v)')]) } elsif compare('eq',$cmd,'inter-controller-link') {loop $lin (grep(@chn,'Host')) {next !match($lin,'FC') var ($chn) = match($lin,'^\s*(\d+)') call push(@cmd,\ [concat($rpt,'_upper_channel_',$chn),\ $SCCLI,join(' ',$arg,'upper channel',$chn),\ join(' ',$ttl,'- Upper Channel:',$chn)],\ [concat($rpt,'_lower_channel_',$chn),\ $SCCLI,join(' ',$arg,'lower channel',$chn),\ join(' ',$ttl,'- Lower Channel:',$chn)]) } } } elsif compare('eq',$rec->[2],'3310') {# Treat commands for 3310 type controllers if compare('eq',$typ,'3310') {if compare('eq',$cmd,'led-status') {var $cmd = join(' ',$pre,'show disks 2>&1') loop $lin (grepCommand({cmd=>$cmd,pwd=>$pwd},\ '^(Ch|\-|sccli\:|.*(S/N)).*$','v')) {var @fld = split('\s+',$lin) var $dsk = quote(join('.',$fld[1],$fld[2])) call push(@cmd,\ [$rpt,$SCCLI,join(' ',$arg,'disk',$dsk),$ttl,{mod=>true,cat=>'T'}]) } } elsif or(compare('eq',$cmd,'safte-devices'),\ compare('eq',$cmd,'enclosure-status')) call push(@cmd,[$rpt,$SCCLI,$arg,$ttl]) } } elsif compare('eq',$rec->[2],'3510|3511') {# Treat commands for 3510/3511 type controllers if or(compare('eq',$typ,'3510'),\ compare('eq',$typ,'3511')) {if or(compare('eq',$cmd,'battery-status'),\ compare('eq',$cmd,'bypass raid'),\ compare('eq',$cmd,'ses-devices')) call push(@cmd,[$rpt,$SCCLI,$arg,$ttl]) elsif compare('eq',$cmd,'bypass * ses-channel') {loop $chn (grep(@chn,'(Drive|DRV)')) {var ($chn) = match($chn,'^\s*(\d+)') loop $lop ('a','b') call push(@cmd,\ [concat($dir,'/show_bypass_device_ch',$chn,'_loop',$lop),$SCCLI,\ join(' ','show bypass device ses-channel',$chn,'loop',$lop),\ join(' ',$ttl,'SES Devices - Channel:',$chn,'Loop:',uc($lop))],\ [concat($dir,'/show_bypass_sfp_ch',$chn,'_loop',$lop),$SCCLI,\ join(' ','show bypass sfp ses-channel',$chn,'loop',$lop),\ join(' ',$ttl,'SFP Transceivers - Channel:',$chn,'Loop:',uc($lop))]) } } elsif compare('eq',$cmd,'loop-map channel') {loop $chn (grep(@chn,'(Drive|DRV)')) {var ($chn) = match($chn,'^\s*(\d+)') call push(@cmd,\ [concat($rpt,'_',$chn),\ $SCCLI,join(' ',$arg,$chn),\ join(' ',$ttl,'- Channel:',$chn)]) } } } } elsif compare('eq',$rec->[2],'3511') {# Treat commands for 3511 type controllers if compare('eq',$typ,'3511') call push(@cmd,[$rpt,$SCCLI,$arg,$ttl]) } } # Generate the report report concat('d3kr_sccli_',$hst,'_',$dev) title '---+!! Device: ',$dev title $TOC loop $rec (@cmd) {prefix {write $rec->[3] write '---## Using: ',encode($rec->[1]),' ',$dev,' ',encode($rec->[2]) } # Use command line arguments when sccli version >= 2.5 if $FLG call collectCommand({\ nam=>$rec->[0],\ inc=>nvl($rec->[5],4),\ out=>{blk=>true,flt=>true,idx=>true,rpt=>${CUR.O_REPORT},\ cond(ref($rec->[4]),%{$rec->[4]},list())},\ err=>{blk=>true,flt=>true,hdr=>$ERR,fil=>'&1',rpt=>${CUR.O_REPORT}}\ },{cmd=>[$rec->[1],'-w %s',$dev,$rec->[2]],pwd=>$pwd}) else {var $inp = join("\012",'password %s',$rec->[2],'quit') call collectCommand({\ inp=>[$inp,@{$pwd}],\ inc=>nvl($rec->[5],4),\ nam=>$rec->[0],\ out=>{blk=>true,flt=>true,idx=>true,rpt=>${CUR.O_REPORT},\ cond(ref($rec->[4]),%{$rec->[4]},list())},\ err=>{blk=>true,flt=>true,hdr=>$ERR,fil=>'&1',rpt=>${CUR.O_REPORT}}\ },join(' ',$rec->[1],$dev)) } if hasOutput(true) write $TOP } # Add binary files generated by the 'upload' commands prefix {write '---+ Generated Array Files' write $WRN write '|*File*|' } var $box = cleanBox() loop $cfg ('nvram',cond($pri,'controller-configuration',list())) {var $fil = catFile($box,$nam = concat($cfg,'.cfg')) var $cmd = join(' ',$SCCLI,'-w %s',$dev,'upload',$cfg,quote($fil),'2>&1') call loadCommand({cmd=>$cmd,pwd=>$pwd},false,15) if ?testFile('fs',$fil) {if collectData(concat($dir,'/',$nam),$fil,['C',$nam]) write '|[[../',last,'][_blank][',$nam,']]|' } } if hasOutput(true) write $TOP if isCreated(true) toc '4:[[',getFile(),'][rda_report][Device: ',$dev,']]' unpretoc call log_info(concat('Data gathering complete for ',$hst)) } # Adjust the table of contents 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,'[d3kr]',$pwd) call push(@hst,$hst) } # Save the parsing results if @hst {var ${RUN.EXPLORER.XPLR.D3KR.F_CFG} = $fil var ${RUN.EXPLORER.XPLR.D3KR.T_HOST} = [@hst] var ${RUN.EXPLORER.B_USE_D3KR} = true } else var ${RUN.EXPLORER.B_USE_D3KR} = $flg } } # Parse the input file if and(defined($fil = ${ENV.EXP_SE3KINPUT_CONFIG}),\ defined(testFile('frs',catFile($fil)))) call parse_input(lastTestFile(),true) elsif ?testFile('frs',catFile(${RUN.EXPLORER.D_ETC},'se3kinput.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