# MCd3k.ctl:258: Collects Information from Local StorEdge 3000 Arrays # $Id: MCd3k.ctl,v 1.5 2013/10/30 07:18:25 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/EXPLORER/MCd3k.ctl,v 1.5 2013/10/30 07:18:25 RDA Exp $ # # Change History # 20130422 MSC Improve the validation. =head1 NAME EXPLORER:MCd3k - Collects Local StorEdge 3000 Disk Arrays Information =head1 DESCRIPTION Collects local StorEdge 3000 disk arrays information (in-band mode). The following reports can be generated and are regrouped under C: =cut use Mrc use Buffer # 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('se3k') #------------------------------------------------------------------------------ # XPLR_se3k section #------------------------------------------------------------------------------ section XPLR_se3k # Validate the execution context if !${B_GLOBAL:true} return call log_run('Processing D3K sections ...') pretoc '2: StorEdge 3000 Series local Information' =head2 Disk Partition Information For each available StorEdge 3000 disk, collects: =over 2 =item o C (for Solaris) =item o C (for Linux) =back =cut pretoc '3: Disk Partition Information' debug ' Inside D3K collection, gathering partition commands' var %dsk = () if ${OS.solaris} {if ?testFile('fr','/usr/sbin/format') {# Adjust environment to avoid format to trigger luflist commands var $env = setEnv('NOINUSE_CHECK',1) # Determine the disks loop $lin (command('/usr/sbin/format &1')) {var $buf = getLastBuffer() while $buf->grep('Inquiry','fr') {while ?$buf->get_line() {var $lin = chomp(last) break match($lin,'scsi>') write $lin } } } if isCreated(true) {call endBlock() write $TOP toc '4:[[',getFile(),'][rda_report][Partition: ',$dsk,']]' } } # Remove the format command file and restore the environment call unlinkTemp('FCF') call setEnv('NOINUSE_CHECK',$env) } } elsif ${OS.linux} {if and(testFile('f','/sbin/scsi_info'),\ testFile('f','/usr/sbin/fdisk')) {# Determine the disks loop $lin (grepCommand('/usr/sbin/fdisk -l 2>/dev/null','^Disk\s/')) var $dsk{replace(field('\s+',1,$lin),':')} = 1 # Generate the report for each disk found loop $dsk (keys(%dsk)) {report concat('d3k_part_',$dsk) title '---+!! Partition: ',$dsk title $TOC call do_exec(\ [concat('disks/se3k/scsi-inq/',replace($dsk,'\/','_',true)),\ '/sbin/scsi_info ',quote($dsk),\ '---+ SCSI Device Information']) if isCreated(true) toc '4:[[',getFile(),'][rda_report][Partition: ',$dsk,']]' } } } unpretoc =head2 d3k_diag - Diagnostic Reporter Agent Information Collects diagnostic agents information using command: =over 2 =item o C =back =cut if grepCommand('/usr/bin/ps -e','ssdgrptd','f') {# Determine the number of agents var $agt = 0 if grepCommand('/usr/sbin/ssdgrptd -l 2>/dev/null','Total SSCS','f') var ($agt) = match(last,'\s+(\d+)\s*$') # Generate the report if $agt {pretoc '3: Diagnostic Reporter Agent Information' debug ' Inside D3K collection, gathering diagnostic agent commands' var $tmp = getTemp('AGT') call system(join(' ','/usr/sbin/ssdgrptd -r -f',quote($tmp),\ '2>/dev/null')) if !status() {report d3k_diag title '---+!! Diagnostic Reporter Agent Information' title $TOC prefix {write '---## Locally attached arrays configuration' call beginBlock(true) call addBlock('E','D','disks/se3k/ssdgrptd.txt') } if loadString($tmp,'<.*') {loop $lin (getLines()) {next match($lin,'^<\/.*$') write replace(replace(replace($lin,'<\/.*$',' ',true),'<',''),'>',': ') } } if isCreated(true) {call endBlock() write $TOP toc '4:[[',getFile(),'][rda_report][Diagnostic Reporter Agent Information]]' } } unpretoc call unlinkTemp('AGT') } } =head2 Command-line Interface (SCCLI) Information For each 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 # Validate requirements to collect SCCLI commands 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) call log_info('Neither SUNWsccli nor SUNWsscs installed. \ No sccli output will be gathered.') else {var $SCCLI = '/usr/sbin/sccli' var $MRG = {err=>{fil=>'&1'}} 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','T'],\ ['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']) pretoc '3: Command-line Interface (SCCLI) Information' debug ' Inside D3K collection, gathering SCCLI commands for device :' var ($ver) = grepCommand(concat($SCCLI,' -v'),'\s+(\d+\.\d+\.?\d*)$','1') loop $lin (grepCommand(concat($SCCLI,' &1'),'StorEdge')) {# Get the device information var $lin = replace(replace($lin,'^.* /','/'),'\s+\(.*$') var ($dev) = match($lin,'^(\S+)') var $dvq = quote($dev) var ($arr) = match($lin,'\s(\S+)\]$') var ($typ) = match($lin,'\[\S+\s+\S+\s+(\S+)') var $pre = join(' ',$SCCLI,$dvq) 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 = ([concat($dir,'/version'),\ $SCCLI,concat($dvq,' version'),\ '---+ StorEdge 3000 Command Line Interface Version',$MRG]) var $pri = true if grepCommand(join(' ',$pre,'show cache-parameters &1'),\ 'operation is only supported on RAID primary controllers','f') var $pri = false var @chn = grepCommand(concat($pre,' show channels 2>&1'),\ '^\s*(\d+).+(Drive|DRV)','1') # Add diag error commands for 3510 and 3511 device types if or(compare('eq',$typ,'3510'),compare('eq',$typ,'3511')) {for $chn (0,5) call push(@cmd,\ [concat($dir,'/diag_error/chan-',$chn),\ $SCCLI,join(' ',$dvq,'diag error channel',$chn,'target all'),\ concat('---+ Diagnostic Error Status: Channel ',$chn),$MRG]) if compare('eq',$typ,'3511') {loop $chn (@chn) call push(@cmd,\ [concat($dir,'/diag_serror/chan-',$chn),\ $SCCLI,join(' ',$dvq,'diag serror channel',$chn,'target all'),\ concat('---+ SATA Units Diagnostic Error Status: Channel ',$chn),$MRG]) } } # 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(' ',$dvq,'show',$cmd)) # Treat all commands that do not need tweaks or specific controllers if !?$rec->[2] call push(@cmd,[$rpt,$SCCLI,$arg,$ttl,$MRG]) elsif compare('eq',$rec->[2],'P') {# Treat commands for all primary controllers if $pri call push(@cmd,[$rpt,$SCCLI,$arg,$ttl,$MRG]) } elsif compare('eq',$rec->[2],'T') {# Treat commands for all controllers but needing some tweaks if compare('eq',$cmd,'configuration') call push(@cmd,\ [$rpt,$SCCLI,$arg,$ttl,{req=>{inc=>4},err=>{fil=>'&1'}}]) elsif compare('eq',$cmd,'configuration -x') call push(@cmd,\ [concat($dir,'/show_configuration.xml'),$SCCLI,$arg,$ttl,\ {req=>{inc=>4},out=>{ext=>''},err=>{fil=>'&1'}}]) elsif compare('eq',$cmd,'events') {call push(@cmd,[$rpt,$SCCLI,$arg,$ttl,$MRG]) if compare('VALID',$ver,'2.1') call push(@cmd,\ [concat($rpt,'-v'),$SCCLI,join(' ',$arg,'-v'),\ concat('---+ Detailed Controller Events (-v)'),$MRG]) } elsif compare('eq',$cmd,'inter-controller-link') {loop $lin (grepCommand(concat($pre,' show channels 2>&1'),'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),$MRG],\ [concat($rpt,'_lower_channel_',$chn),\ $SCCLI,join(' ',$arg,'lower channel',$chn),\ join(' ',$ttl,'- Lower Channel:',$chn),$MRG]) } } elsif compare('eq',$cmd,'persistent-events') {if compare('OLDER',$ver,'2.5') {if grepCommand(concat($pre,' show access-mode &1'),\ 'inband','f') {var $suf = 'show ip-address /dev/null' if and(defined(($adr) = command(join(' ',$pre,$suf))),\ defined(($ret) = command(join(' ',$SCCLI,quote($adr),$suf))),\ compare('eq',$adr,$ret)) call push(@cmd,\ [$rpt,$SCCLI,join(' ',quote($ret),'show',$cmd),$ttl,$MRG]) } } } } elsif compare('eq',$rec->[2],'3310') {# Treat commands for 3310 type controllers if compare('eq',$typ,'3310') {if compare('eq',$cmd,'led-status') {loop $lin (grepCommand(concat($pre,' show disks &1'),\ '^(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,\ {out=>{mod=>true,cat=>'T'},err=>{fil=>'&1'}}]) } } elsif or(compare('eq',$cmd,'safte-devices'),\ compare('eq',$cmd,'enclosure-status')) call push(@cmd,[$rpt,$SCCLI,$arg,$ttl,$MRG]) } } 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,$MRG]) elsif compare('eq',$cmd,'bypass * ses-channel') {loop $chn (@chn) {loop $lop ('a','b') call push(@cmd,\ [concat($dir,'/show_bypass_device_ch',$chn,'_loop',$lop),$SCCLI,\ join(' ',$dvq,'show bypass device ses-channel',$chn,'loop',$lop),\ join(' ',$ttl,'SES Devices - Channel:',$chn,'Loop:',uc($lop)),\ $MRG],\ [concat($dir,'/show_bypass_sfp_ch',$chn,'_loop',$lop),$SCCLI,\ join(' ',$dvq,'show bypass sfp ses-channel',$chn,'loop',$lop),\ join(' ',$ttl,'SFP Transceivers - Channel:',$chn,'Loop:',uc($lop)),\ $MRG]) } } elsif compare('eq',$cmd,'loop-map channel') {loop $chn (@chn) call push(@cmd,\ [concat($rpt,'_',$chn),\ $SCCLI,join(' ',$arg,$chn),\ join(' ',$ttl,'- Channel:',$chn),$MRG]) } } } elsif compare('eq',$rec->[2],'3511') {# Treat commands for 3511 type controllers if compare('eq',$typ,'3511') call push(@cmd,[$rpt,$SCCLI,$arg,$ttl,$MRG]) } } # Generate the report report concat('d3k_sccli_',$dev) title '---+!! Device: ',$dev title $TOC call do_exec(@cmd) # 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')) call system(join(' ',$SCCLI,$dvq,'upload',$cfg,quote($fil),\ '/dev/null 2>&1')) 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 } =head2 d3k_cfg - Configuration Files Collects the following StorEdge 3000-related files: =over 2 =item o F =item o F =item o F =item o F<${BASE_DIR}/SUNWsscs/*> =back =cut if cond(${OS.solaris},grepCommand('/usr/bin/pkginfo','SUNWsc(sa|sd|su|ui)','f')) {debug ' Inside D3K collection, gathering configuration files' var @fil = (\ ['disks/se3k/hostinfo/etc/rs_binding', '/etc/rs_binding'],\ ['disks/se3k/hostinfo/etc/.ssagent_', '/etc/.ssagent',true],\ ['disks/se3k/hostinfo/var/opt/SUNWsscs','/var/opt/SUNWsscs',true]) # Define the exclusion criteria var $pat = '^\.+$|\ \.ssconsole\.policy|\ browser\.default|\ Console\.html|\ esm\.html|\ lang\.en|\ rst\_oid\.mib|\ ssagent\.msg|\ sccli\.1m' # Scan the installation base directory if grepFile('/var/sadm/install/contents','\/SUNWsscs ','f') {var ($dir) = split('\s+',last) loop $fil (grepDir(catDir($dir),$pat,'prv')) {next match($fil,'hlpfiles') if grepCommand(concat('/usr/bin/file ',quote($fil)),'text','f') {next match(last,'commands text') call push(@fil,[concat('disks/se3k/hostinfo',$fil),$fil]) } } } # Generate the report report d3k_cfg title '---+!! Configuration Files' title $TOC title $WRN prefix write '|*File Path*| *Size*|*Last Modified Date*|' call do_collect_fil(@fil) if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][Configuration Files]]' } } # Adjust the table of content unpretoc =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