# MCfsc.ctl:240: Collects Extended Serengeti System Controller Information # $Id: MCfsc.ctl,v 1.7 2015/05/09 15:08:04 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/EXPLORER/MCfsc.ctl,v 1.7 2015/05/09 15:08:04 RDA Exp $ # # Change History # 20150509 MSC Change handle management. =head1 NAME EXPLORER:MCfsc - Collects Extended Serengeti System Controller Information =head1 DESCRIPTION This module collects extended Serengeti System Controller information. =cut use Buffer use Mrc use Remote use Telnet # Initialization var $VALIDATE = true keep $VALIDATE section begin var $ERR = '---## Associated Errors' var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' run EXPLORER:XPLRlib('scextended') # 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_fsc_section #------------------------------------------------------------------------------ section XPLR_fsc # Validate the execution context if !${B_GLOBAL:true} return call log_run('Processing FSC sections ...') pretoc '2:Serengeti System Controller' =head2 Extended Serengeti System Controller Information Gathers the following Serengeti System Controller commands through SSH (requires a working Java environment) or Telnet: =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 =back ${BOARD} represents each online board returned by the C command. Except when fru is disabled, collects the following command: =over 2 =item o C =back ${SC_NAME} represents the Serengeti system controller host name or IP address. =cut loop $itm (@{MOD.FSC.T_HOST}) {next !?$itm var ($ses,@cmd,@out) = () var $usr = '[input]' # Validate the input parameters debug ' Inside FSC collection, validating ',$itm,' access' if !?$hst = isHost($itm,true) next log_info(concat('Bad SC 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,$usr) call setPassword('host',$hst,$usr,\ askPassword(concat('Enter Platform Shell password for SC ',$hst,': '),'')) # Connect to the service controller var $ctl = new('Telnet',bin=>true,hst=>$hst,prt=>5000) if !$ctl->open {# Try SSH when not possible with Telnet var $ctl = addRemoteSession('SC',$hst,$usr) if and($ctl->set_type('da'),$ctl->set_type('jsch')) next log_warning(concat('Unable to connect to ',$hst,' using Telnet or SSH')) if !$ctl->open next log_warning($ctl->get_message) } if !?$ctl->choose({chk=>'m/Platform Shell/',\ dis=>'disconnect',\ flg=>1,\ lim=>10,\ pat=>'m/:sc> $/i'}) {# Check for valid prompt when the last line contains an alert message var $buf = $ctl->get_input call $buf->set_handle('eol',false) var ($msg,$pre) = reverse($buf->get_lines(true)) if !and(match($msg,'^SC Alert:'),match($pre,':sc> $',true)) {# Report the login dialog in case of failure var $msg = $ctl->get_message report concat('sc_info_',$hst) prefix {title '---++ ',$hst,' Login Dialog' call addBlock('E','D',concat('sc/',$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) } # Clear the input buffer and perform the collection call $buf->close call $ctl->empty_buffer } # Collect boards and system controller information for later use var $buf = new('Buffer','S') call $buf->set_handle('eol',false) call $ctl->collect($buf,{\ pat=>'m/:sc> $/i',\ nxt=>['m/^.*?--pause--.*?continue.*?$/i',"\012"],\ skp=>true,\ cln=>true,\ cmd=>'showboards -e'}) var @brd = $buf->get_lines(true) call $buf->truncate call $ctl->collect($buf,{\ pat=>'m/:sc> $/i',\ nxt=>['m/^.*?--pause--.*?continue.*?$/i',"\012"],\ skp=>true,\ cln=>true,\ cmd=>'showsc -v'}) var @scv = $buf->get_lines(true) call $buf->close # Prepare the Serengeti System Controller commands var $ver = field(':?\s+',2,grep(@scv,'ScApp version','f')) if compare('valid',$ver,'5.17.0') call push(@cmd,\ ['showerrorbuffer_-p.out',\ 'showerrorbuffer -p',\ '---+ Error Messages Stored in the Persistent Error Buffer'],\ ['showfru_-r_manr.out',\ 'showfru -r manr',\ '---+ Field-Replaceable Units (FRUs) Manufacturing Records']) if compare('valid',$ver,'5.20.2') call push(@cmd,\ ['showchs_-b.out',\ 'showchs -b',\ '---+ Faulty Components']) call push(@cmd,\ ['showcodlog_-v.out',\ 'showcodlog -v',\ '---+ Capacity on Demand (COD) Resources Log History'],\ ['showcodusage_-v.out',\ 'showcodusage -v',\ '---+ Capacity on Demand (COD) Resources Usage Statistics'],\ ['showcodlicense_-v.out',\ 'showcodlicense -v',\ '---+ Capacity on Demand (COD) RTU Licenses Stored in COD License \ Database'],\ ['showcomponent_-d_a.out',\ 'showcomponent -d a',\ '---+ Components Status for Domain A'],\ ['showcomponent_-d_b.out',\ 'showcomponent -d b',\ '---+ Components Status for Domain B'],\ ['showcomponent_-d_c.out',\ 'showcomponent -d c',\ '---+ Components Status for Domain C'],\ ['showcomponent_-d_d.out',\ 'showcomponent -d d',\ '---+ Components Status for Domain D'],\ ['showdate_-v.out',\ 'showdate -v',\ '---+ Date and Time'],\ ['showdate_-v_-d_a.out',\ 'showdate -v -d a',\ '---+ Date and Time for Domain A'],\ ['showdate_-v_-d_b.out',\ 'showdate -v -d b',\ '---+ Date and Time for Domain B'],\ ['showdate_-v_-d_c.out',\ 'showdate -v -d c',\ '---+ Date and Time for Domain C'],\ ['showdate_-v_-d_d.out',\ 'showdate -v -d d',\ '---+ Date and Time for Domain D'],\ ['showplatform_-d_a.out',\ 'showplatform -d a',\ '---+ Domain A Status'],\ ['showplatform_-d_b.out',\ 'showplatform -d b',\ '---+ Domain B Status'],\ ['showplatform_-d_c.out',\ 'showplatform -d c',\ '---+ Domain C Status'],\ ['showplatform_-d_d.out',\ 'showplatform -d d',\ '---+ Domain D Status'],\ ['showenvironment_-tv.out',\ 'showenvironment -tv',\ '---+ Environmental Status'],\ ['showerrorbuffer.out',\ 'showerrorbuffer',\ '---+ Error Buffer Contents'],\ ['showplatform_-p_frame.out',\ 'showplatform -p frame',\ '---+ FrameManager Information'],\ ['showplatform_-v.out',\ 'showplatform -v',\ '---+ Platform and Domain Status']) # Collect boards information loop $brd (@brd) {next !match($brd,'^(.*?)\s+.*On') var ($brd) = last call push(@cmd,\ [concat('showcomponent_',$brd,'.out'),\ concat('showcomponent ',$brd),\ concat('---+ System Board ',$brd,' Status and POST Information')]) } call push(@cmd,\ ['showboards_-v_-p_clock.out',\ 'showboards -v -p clock',\ '---+ System Boards Clock Status'],\ ['showboards_-v_-p_cpu.out',\ 'showboards -v -p cpu',\ '---+ System Boards CPU Information'],\ ['showboards_-p_proms.out',\ 'showboards -p proms',\ '---+ System Boards Firmware Version'],\ ['showboards_-v_-p_power.out',\ 'showboards -v -p power',\ '---+ System Boards Grid Information'],\ ['showboards_-v_-p_io.out',\ 'showboards -v -p io',\ '---+ System Boards I/O Information'],\ ['showboards_-v.out',\ 'showboards -v',\ '---+ System Boards Information'],\ ['showboards_-v_-d_a.out',\ 'showboards -v -d a',\ '---+ System Boards Information for Domain A'],\ ['showboards_-v_-d_b.out',\ 'showboards -v -d b',\ '---+ System Boards Information for Domain B'],\ ['showboards_-v_-d_c.out',\ 'showboards -v -d c',\ '---+ System Boards Information for Domain C'],\ ['showboards_-v_-d_d.out',\ 'showboards -v -d d',\ '---+ System Boards Information for Domain D'],\ ['showboards_-v_-p_memory.out',\ 'showboards -v -p memory',\ '---+ System Boards Memory Information'],\ ['showboards_-v_-p_board.out',\ 'showboards -v -p board',\ '---+ System Boards Status'],\ ['showboards_-v_-p_version.out',\ 'showboards -v -p version',\ '---+ System Boards Version Information'],\ ['showlogs_-v.out',\ 'showlogs -v',\ '---+ System Controller Logged Events'],\ ['showlogs_-v_-d_a.out',\ 'showlogs -v -d a',\ '---+ System Controller Logged Events for Domain A'],\ ['showlogs_-v_-d_b.out',\ 'showlogs -v -d b',\ '---+ System Controller Logged Events for Domain B'],\ ['showlogs_-v_-d_c.out',\ 'showlogs -v -d c',\ '---+ System Controller Logged Events for Domain C'],\ ['showlogs_-v_-d_d.out',\ 'showlogs -v -d d',\ '---+ System Controller Logged Events for Domain D']) # Genererate the report debug ' Inside FSC collection, gathering ',$hst,' information (can take time)' report concat('sc_info_',$hst) title '---+!! Serengeti System Controller' title '---## ',$hst,' Information' title $TOC loop $rec (@cmd) {if ref($rec) {prefix {write $rec->[2] write '---## Using: ',encode($rec->[1]) call beginBlock(true) call addBlock('E','D',concat('sc/',$hst,'/',$rec->[0])) } if $ctl->collect(${CUR.O_REPORT},{\ pat=>'m/:sc> $/i',\ nxt=>['m/^.*?--pause--.*?continue.*?$/i',"\012"],\ skp=>true,\ cln=>true,\ max=>60,\ cmd=>$rec->[1]}) call log_warning($ctl->get_message) if hasOutput(true) {call endBlock() write $TOP } } else write $rec } # Close the connection call $ctl->close # Add boards information previously collected call do_exec(\ {cmd => 'ARRAY',\ det => 'showboards -e',\ nam => concat('sc/',$hst,'/showboards_-e.out'),\ tbl => \@brd,\ ttl => '---+ System Boards Status (Including Empty Slots)'}) # Collect Field Replaceable Units (FRUs) in XLM Format if !is_rejected('fru') {if $bin = get_bin_tool('rprtfru') call do_exec(\ [join('/','sc',$hst,'prtfru_-x'),\ $bin,concat('-b ',$hst,':XXXXXX -x'),\ '---+ System Controller Field Replaceable Units (FRUs) in XLM Format']) } # Add system controller information previously collected call do_exec(\ {cmd => 'ARRAY',\ det => 'showsc -v',\ nam => concat('sc/',$hst,'/showsc_-v.out'),\ tbl => \@scv,\ ttl => '---+ System Controller Status, Version and Uptime'}) if isCreated(true) toc '3:[[',getFile(),'][rda_report][',$hst,' Information]]' } =head2 sc_input - Input File Lists the characteristics of the specified input file. =cut if ?testFile('r',catFile(${MOD.FSC.F_CFG})) {debug ' Inside FSC collection, getting input file characteristics' report sc_input title '---+ Input File Details' call do_exec(\ [concat('sc/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,'[input]',$pwd) call push(@hst,$hst) } # Save the parsing results if @hst {var ${RUN.EXPLORER.XPLR.FSC.F_CFG} = $fil var ${RUN.EXPLORER.XPLR.FSC.T_HOST} = [@hst] var ${RUN.EXPLORER.B_USE_FSC} = true } else var ${RUN.EXPLORER.B_USE_FSC} = $flg } } # Parse the input file if and(defined($fil = ${ENV.EXP_SCINPUT_CONFIG}),\ defined(testFile('frs',catFile($fil)))) call parse_input(lastTestFile(),true) elsif ?testFile('frs',catFile(${RUN.EXPLORER.D_ETC},'scinput.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