# MCraid.ctl:255: Collects RAID Manager Software Information # $Id: MCraid.ctl,v 1.9 2015/01/22 09:11:14 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/EXPLORER/MCraid.ctl,v 1.9 2015/01/22 09:11:14 RDA Exp $ # # Change History # 20150119 PRA Improve portability. =head1 NAME EXPLORER:MCraid - Collects RAID Manager Software Information =head1 DESCRIPTION This module collects RAID Manager software information. =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('RAIDmanager') #------------------------------------------------------------------------------ # XPLR_raid section #------------------------------------------------------------------------------ section XPLR_RAIDmanager # Validate the execution context if !${B_GLOBAL:true} return call log_run('Processing RAID sections ...') pretoc '2:RAID Manager Software' debug ' Inside RAID collection, gathering MegaRAID information' =head2 raid_megaraid_cmd - MegaRAID SAS Controllers Gathers MegaRAID serial attached SCSI controllers information using 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 =back It collects the event files produced by the execution of the C requests. =cut if ?$pgm = testFile('x','/opt/MegaRAID/CLI/MegaCli') {# Define a macro to produce the Short Physical Drive report macro write_short {var ($rpt,$wrk) = @arg var ($cnt,@dev,@nam,@slt,@sta) = (0) while ?$lin = $wrk->get_line {if match($lin,'Slot Number') var $slt[incr($cnt)] = field('\s+',2,$lin) elsif match($lin,'Device Id') var $dev[$cnt] = field('\s+',2,$lin) elsif match($lin,'Firmware state') var $sta[$cnt] = field('\s+',2,$lin) elsif match($lin,'Inquiry') {var @tbl = split('\s+',$lin,7) var $nam[$cnt] = join(' ',splice(@tbl,2,4)) } } if $cnt {for $off (1,$cnt) write {$rpt} sprintf('Slot %02d Device %02d (%s) status is: %s',\ $slt[$off],$dev[$off],$nam[$off],$sta[$off]) } } # Collect the commands report raid_megaraid_cmd title '---+!! MegaRAID SAS Controllers' title $TOC var $box = cleanBox() call do_exec(\ ['RAIDmanager/MegaCli/ShowSummary-aALL',\ $pgm,'-ShowSummary -aALL',\ '---+ Summary Information'],\ ['RAIDmanager/MegaCli/AdpAllInfo-aALL',\ $pgm,'-AdpAllInfo -aALL',\ '---+ Adapter Information'],\ ['RAIDmanager/MegaCli/AdpBbuCmd-aALL',\ $pgm,'-AdpBbuCmd -aALL',\ '---+ Battery Backup Information'],\ ['RAIDmanager/MegaCli/GetEvents-aALL',\ $pgm,concat('-AdpEventLog -GetEvents -f ',\ catCommand($box,'GetEvents-aALL_file.out'),' -aALL'),\ '---+ Controller Events Information'],\ ['RAIDmanager/MegaCli/GetSinceShutdown-aALL',\ $pgm,concat('-AdpEventLog -GetSinceShutdown -f ',\ catCommand($box,'GetSinceShutdown-aALL_file.out'),' -aALL'),\ '---+ Controller Events Since Shutdown Information'],\ ['RAIDmanager/MegaCli/CfgDsply-aALL',\ $pgm,'-CfgDsply -aALL',\ '---+ Display Configuration'],\ ['RAIDmanager/MegaCli/LDPDInfo-aALL',\ $pgm,'-LDPDInfo -aALL',\ '---+ Logical and Physical Disks for all Adapters'],\ ['RAIDmanager/MegaCli/PDList-aALL',\ $pgm,'-PDList -aALL',\ '---+ Physical Drive Information'],\ ['RAIDmanager/MegaCli/PhyErrorCounters-aALL',\ $pgm,'-PhyErrorCounters -aALL',\ '---+ Physical Error Counters'],\ ['RAIDmanager/MegaCli/PDList-aALL_short',\ $pgm,'-PDList -aALL',\ '---+ Short Physical Drive Information',\ {out=>{fct=>'write_short'}}],\ ['RAIDmanager/MegaCli/FwTermLog-dsply-aALL',\ $pgm,'-FwTermLog -dsply -aALL',\ '---+ TTY Firmware Terminal Log Entries for all Adapters'],\ ['RAIDmanager/MegaCli/LDInfo-LALL-aALL',\ $pgm,'-LDInfo -LALL -aALL',\ '---+ Virtual Drive Information']) # Collect generated event log files prefix {write '---+ Produced Event Files' write $WRN write '|*File*|' } loop $fil (grepDir($box,'_file\.out$','n')) {if collectFile(concat('RAIDmanager/MegaCli/',$fil),catFile($box,$fil),\ ['C',concat('EventLog (',$fil,')')]) write '|[[../',last,'][_blank][EventLog (',$fil,')]]|' } if hasOutput(true) write $TOP if isCreated(true) toc '3:[[',getFile(),'][rda_report][MegaRAID SAS Controllers]]' } else call log_info('MegaCli not available. Skipping MegaRAID section') =head2 raid_storman_cmd - StorMan Adaptec Controllers Gathers StorMan controllers information using the following commands: =over 2 =item o C<${STORMAN}/arcconf GETCONFIG> =item o C<${STORMAN}/arcconf GETSTATUS> =item o C<${STORMAN}/arcconf GETLOGS ${CTLR_NUM} uart> =item o C<${STORMAN}/arcconf GETLOGS ${CTLR_NUM} device> =item o C<${STORMAN}/arcconf GETLOGS ${CTLR_NUM} dead> =item o C<${STORMAN}/arcconf GETLOGS ${CTLR_NUM} event> =back The StorMan directory could be F or F depending on the StorMan version. =cut # Check if Storage Manager is available debug ' Inside RAID collection, gathering StorMan information' var $ver = nvl(get_pkg_version('StorMan'),'0.0 (0)') var ($maj,$min) = match($ver,'^(\d+)\.(\d+)') var (undef,$mic)=split('\s',replace(replace($ver,'\('),'\)')) var $top = cond(compare('valid',join('.',$maj,$min,$mic),'5.20.17435'),\ '/opt/StorMan','/usr/StorMan') if ?$pgm = testFile('x',catFile($top,'arcconf')) {report raid_storman_cmd title '---+!! StorMan Adaptec Controllers' title $TOC # Collect all controller version information call do_exec(\ ['RAIDmanager/getversion',\ $pgm,'GETVERSION',\ '---+ Version Information for all Controllers']) # Collect Storage Manager information if grepCommand(concat(lastCommand(),' GETVERSION 2>/dev/null'),\ '^Controllers\s+\S+\s(\d+)','f1') {for $num (1,last) call do_exec(\ concat('---+ Controller #',$num),\ [concat('RAIDmanager/getstatus_',$num),\ $pgm,concat('GETSTATUS ',$num),\ '---++ Background Commands Currently Running Status'],\ [concat('RAIDmanager/getconfig_',$num),\ $pgm,concat('GETCONFIG ',$num),\ '---++ Controller Information'],\ [concat('RAIDmanager/dead_',$num),\ $pgm,concat('GETLOGS ',$num,' dead'),\ '---++ Defunct Devices Log Information'],\ [concat('RAIDmanager/device_',$num),\ $pgm,concat('GETLOGS ',$num,' device'),\ '---++ Device Errors Log Information'],\ [concat('RAIDmanager/uart_',$num),\ $pgm,concat('GETLOGS ',$num,' uart'),\ '---++ Low Level Debug and Trace Information'],\ [concat('RAIDmanager/event_',$num),\ $pgm,concat('GETLOGS ',$num,' event'),\ '---++ Special Events Log Information']) } if isCreated(true) toc '3:[[',getFile(),'][rda_report][StorMan Adaptec Controllers]]' =head2 raid_storman_fil - StorMan Software Files Collects the following StorMan related files: =over 2 =item o F<${STORMAN}/arcconfig.xml> =item o F<${STORMAN}/arcerror.txt> =item o F<${STORMAN}/RaidDP.log> =item o F<${STORMAN}/RaidErr.log> =item o F<${STORMAN}/RaidErrA.log> =item o F<${STORMAN}/RaidEvt.log> =item o F<${STORMAN}/RaidEvtA.log> =item o F<${STORMAN}/Support.zip> =item o F<${STORMAN}/SystemID> =item o F<${STORMAN}/UcliEvt.log> =back The StorMan directory could be F or F depending on the StorMan version. =cut report raid_storman_fil prefix {write '---+!! StorMan Software Files' write $WRN write '|*File Path*| *Size*|*Last Modified Date*|' } call do_collect_fil(\ ['RAIDmanager/RaidDP.log', catFile($top,'RaidDP.log')],\ ['RAIDmanager/RaidErr.log', catFile($top,'RaidErr.log')],\ ['RAIDmanager/RaidErrA.log', catFile($top,'RaidErrA.log')],\ ['RAIDmanager/RaidEvt.log', catFile($top,'RaidEvt.log')],\ ['RAIDmanager/RaidEvtA.log', catFile($top,'RaidEvtA.log')],\ ['RAIDmanager/SMTPErr.log', catFile($top,'SMTPErr.log')],\ ['RAIDmanager/Support.zip', catFile($top,'Support.zip'),true],\ ['RAIDmanager/SystemID', catFile($top,'SystemID')],\ ['RAIDmanager/UcliEvt.log', catFile($top,'UcliEvt.log')],\ ['RAIDmanager/arcconfig.xml',catFile($top,'arcconfig.xml')],\ ['RAIDmanager/arcerror.txt', catFile($top,'arcerror.txt')]) if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][StorMan Software Files]]' } } else call log_info('Storage Manager not installed') # 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