# M255RAID.def: Collects RAID Manager Software Information # $Id: M255RAID.def,v 1.3 2012/08/30 16:25:15 mschenke Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/M255RAID.def,v 1.3 2012/08/30 16:25:15 mschenke Exp $ # # Change History # 20120830 JGS Fix macro calling method. =head1 NAME M255RAID - 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]]' run XPLRlib('RAIDmanager') #------------------------------------------------------------------------------ # XPLR_raid section #------------------------------------------------------------------------------ section XPLR_raid # Validate the execution context if !${XPLR_GLOBAL:true} return call log_run('Processing RAID sections ...') =head2 raid_cmd - Commands Gathers the RAID Manager software 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 =item o C =item o C =item o C =back =cut pretoc '2:RAID Manager Software' debug ' Inside RAID collection, gathering RAID information' # Describe the commands to collect var @cmd = () if testFile('x',$pgm = '/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]) } } # Add the commands call push(@cmd,\ ['RAIDmanager/MegaCli/AdpAllInfo-aALL',\ $pgm,'-AdpAllInfo -aALL',\ '---+ Adapter Information'],\ ['RAIDmanager/MegaCli/AdpBbuCmd-aALL',\ $pgm,'-AdpBbuCmd -aALL',\ '---+ Battery Backup Information'],\ ['RAIDmanager/MegaCli/GetEvents-aALL',\ $pgm,'-AdpEventLog -GetEvents -aALL',\ '---+ Controller Events 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/PDList-aALL_short',\ $pgm,'-PDList -aALL',\ '---+ Short Physical Drive Information',\ {out=>{fct=>'caller: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']) } else call log_info('MegaCli not available. Skipping LSI RAID section') # Check if Storage Manager is available 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 testFile('x',$pgm = catFile($top,'arcconf')) {# Collect all controller version information call push(@cmd,\ ['RAIDmanager/getversion',\ $pgm,'GETVERSION',\ '---+ Version Information for all Controllers']) # Collect Storage Manager information if grepCommand(concat(lastCommand(),' GETVERSION'),\ '^Controllers\s+\S+\s(\d+)','f1') {for $num (1,last) call push(@cmd,\ 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']) } } else call log_info('Storage Manager not installed') # Generate the report report raid_cmd title '---+!! RAID Manager Software Commands' title $TOC call do_exec(@cmd) if isCreated(true) toc '3:[[',getFile(),'][rda_report][Commands]]' =head2 raid_files - Key Files Collects the following 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 =cut debug ' Inside RAID collection, collecting key files' report raid_files prefix {write '---+!! RAID Manager Software Files' write ' * 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.' 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][Key Files]]' } # Adjust the table of content 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