# M120EXLR.def: Performs Oracle Exalogic Multi-run Collections (Rack Part) # $Id: M120EXLR.def,v 1.9 2012/05/24 15:36:39 mschenke Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/M120EXLR.def,v 1.9 2012/05/24 15:36:39 mschenke Exp $ # # Change History # 20120524 KRA Improve functionality. =head1 NAME M120EXLR - Performs Oracle Exalogic Multi-run Collections (Rack Part) =head1 DESCRIPTION This module regroups multi-run collections specific to the Oracle Exalogic rack. =cut use Buffer use Mrc use Remote # Initialization var @COMMON_SECTIONS = ('EXLR_cfg_rdmadev') var @ROOT_SECTIONS = ('EXLR_cfg_biosboot','EXLR_cfg_hardware',\ 'EXLR_cfg_ib_cmds','EXLR_cfg_ib_ping_test',\ 'EXLR_cfg_ilom_cmds','EXLR_cfg_imagehist',\ 'EXLR_cfg_imageinfo','EXLR_cfg_image_pchver',\ 'EXLR_cfg_noderesult','EXLR_cfg_package','EXLR_cfg_port',\ 'EXLR_cfg_rackresult','EXLR_cfg_racserial',\ 'EXLR_cfg_topology','EXLR_log_logs','EXLR_switches') keep @COMMON_SECTIONS,@ROOT_SECTIONS var $TAIL = ${EXL_TAIL:1000} var $TIMEOUT = ${RDA_TIMEOUT:0} var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' # Load the common macros run library() keep $TAIL,$TIMEOUT,$TOC,$TOP # Load the common variables and define common macros section begin var $TYPE = ${EXL_TYPE:'_All_'} macro do_collect {var ($typ,$ttl,$dbg,$tbl,$lvl) = @arg import $TOP,$TYPE if !?$lvl var $lvl = 4 if match($TYPE,$typ) {debug ' Inside EXL module, gathering ',$dbg,' information' var $flg = true loop $key (keys($tbl)) {var $rec = $tbl->{$key} call $[OUT]->add_report('C',$key,0) prefix {write '---+ ',$rec->[-1] write '---## Using: ',encode($rec->[0]) } call writeCommand($rec->[0]) if hasOutput(true) {if $flg {call validate(true) if length($ttl) toc $ttl var $flg = false } write $TOP toc $lvl,':[[',getFile(),'][rda_report][',$rec->[1],']]' } } } else call validate(true) } =head1 EXALOGIC MULTI-RUN COLLECTIONS =head2 biosboot - BIOS Boot Order Collects the output of the F command. =cut section EXLR_cfg_biosboot if match($TYPE,'^_All_') {debug ' Inside EXL module, gathering bios boot order' report biosboot var $cmd = '/usr/sbin/biosbootorder' prefix {write '---+ BIOS Boot Order Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) {call validate(true) write $TOP toc '3:[[',getFile(),'][rda_report][BIOS Boot Order]]' } } else call validate(true) =head2 hardware - Hardware and Firmware Information Collects the output of the F command (applicable for C collection). =cut section EXLR_cfg_hardware if match($TYPE,'^_(All|HealthHwSw)_') {debug ' Inside EXL module, gathering hardware and firmware information' report hardware var $cmd = '/opt/exalogic.tools/tools/CheckHWnFWProfile' prefix {write '---+ Hardware and Firmware Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) {call validate(true) write $TOP toc '3:[[',getFile(),'][rda_report][Hardware and Firmware Information]]' } } else call validate(true) =head2 InfiniBand Information Collects the output of the following commands (applicable for C and C collections): =head3 ibcheckerrors - Errors Gets the F information. =head3 ibchecknet - Subnet Gets the F information. =head3 ibdiagnet - Diagnet Details Gets the C information. =head3 ibhosts - Hosts Gets the F information. =head3 iblinkinfo - Link Gets the F information. =head3 ibnetdiscover - Netdiscover Gets the F information. =head3 ibstat - Device Details Gets the F information. =head3 ibstatus - Device Overview Gets the F information. =head3 ibswitches - Switches Gets the F information. =cut section EXLR_cfg_ib_cmds call do_collect('^_(All|HealthNetwork|IbFabric)_',\ '3:InfiniBand Information','InfiniBand',\ {ibcheckerrors => ['/usr/sbin/ibcheckerrors','Errors'],\ ibchecknet => ['/usr/sbin/ibchecknet','Subnet','Subnet Information'],\ ibdiagnet => ['/usr/bin/ibdiagnet -c 1000 -r','Diagnet Details'],\ ibhosts => ['/usr/sbin/ibhosts','Hosts','Hosts Information'],\ iblinkinfo => ['/usr/sbin/iblinkinfo','Link','Link Information'],\ ibnetdiscover => ['/usr/sbin/ibnetdiscover',\ 'Netdiscover','Netdiscover Information'],\ ibstat => ['/usr/sbin/ibstat','Device Details'],\ ibstatus => ['/usr/sbin/ibstatus','Device Overview'],\ ibswitches => ['/usr/sbin/ibswitches',\ 'Switches','Switches Information']}) =head2 ib_ping_test - InfiniBand Ping Test Results Collects the output of the F command (applicable for C collection). =cut section EXLR_cfg_ib_ping_test if match($TYPE,'^_(All|HealthNetwork)_') {debug ' Inside EXL module, gathering infiniband ping test results' report ib_ping_test var $cmd = '/opt/exalogic.tools/tools/ibping_test' prefix {write '---+ InfiniBand Ping Test Results Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) {call validate(true) write $TOP toc '3:[[',getFile(),'][rda_report][InfiniBand Ping Test Results]]' } } else call validate(true) =head2 dns - Name Server Information Gets the Integrated Lights Out Manager (ILOM)-related name server information using the C command (applicable for C collection). =head2 event - Events Information Gets the Integrated Lights Out Manager (ILOM)-related events information using the C command (applicable for C collection). =head2 lan - LAN Information Gets the Integrated Lights Out Manager (ILOM)-related LAN information using the C command (applicable for C collection). =head2 mac - Machine Details Gets the Integrated Lights Out Manager (ILOM)-related machine details using the C command (applicable for C collection). =head2 network - Network Information Gets the Integrated Lights Out Manager (ILOM)-related network information using the C command (applicable for C collection). =head2 sdr - SDR Information Gets the Integrated Lights Out Manager (ILOM)-related SDR information using the C command (applicable for C collection). =head2 sensor - Sensor Information Gets the Integrated Lights Out Manager (ILOM)-related sensor information using the C command (applicable for C collection). =head2 sysinfo - System Information Gets the Integrated Lights Out Manager (ILOM)-related system information using the C command (applicable for C collection). =cut section EXLR_cfg_ilom_cmds var $cmd = cond(${OS.linux}, '/usr/bin/ipmitool',\ ${OS.solaris},'/opt/ipmitool/bin/ipmitool',\ 'ipmitool') call do_collect('^_(All|Ilom)_','3:ILOM Information','ILOM',\ {dns => [concat($cmd," sunoem cli 'show /SP/clients/dns'"),\ 'Name Server','Name Server Information'],\ event => [concat($cmd,' sel list'),'Events','Events Information'],\ lan => [concat($cmd,' lan print'),'LAN','LAN Information'],\ mac => [concat($cmd,' mc info'),'Machine','Machine Details'],\ network => [concat($cmd," sunoem cli 'show /SP/network'"),\ 'Network','Network Information'],\ sdr => [concat($cmd,' sdr'),'SDR','SDR Information'],\ sensor => [concat($cmd,' sensor'),'Sensor','Sensor Information'],\ sysinfo => [concat($cmd," sunoem cli 'show /SYS'"),\ 'System','System Information']}) =head2 imagehist - Image History Gets the image history information using the F command (applicable for C collection). =cut section EXLR_cfg_imagehist if match($TYPE,'^_(All|Patch)_') {debug ' Inside EXL module, getting image history information' report imagehist var $cmd = '/usr/sbin/imagehistory' prefix {write '---+ Image History Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) {call validate(true) write $TOP toc '3:[[',getFile(),'][rda_report][Image History]]' } } else call validate(true) =head2 imageinfo - Image Information Gets the image information using the F command (applicable for C collection). =cut section EXLR_cfg_imageinfo if match($TYPE,'^_(All|Patch)_') {debug ' Inside EXL module, getting image information' report imageinfo var $cmd = '/usr/sbin/imageinfo' prefix {write '---+ Image Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) {call validate(true) write $TOP toc '3:[[',getFile(),'][rda_report][Image Information]]' } } else call validate(true) =head2 image_pchver - Image Patch Version Collects the image patch version information (applicable for C collection). =cut section EXLR_cfg_image_pchver if match($TYPE,'^_(All|Patch)_') {debug ' Inside EXL module, getting image patch version information' report image_pchver var $cmd = '/opt/MegaRAID/MegaCli/MegaCli64 -adpallinfo -a0' prefix {write '---+ Image Patch Version Information' write '---## Using: ',encode($cmd) write '' } if grepCommand($cmd,'FW\sVersion') {loop $lin (last) write $lin } if hasOutput(true) {call validate(true) write '' write $TOP toc '3:[[',getFile(),'][rda_report][Image Patch Version]]' } } else call validate(true) =head2 noderesult - Node Network Connectivity Results Collects the output of the F command. =cut section EXLR_cfg_noderesult if match($TYPE,'^_All_') {debug ' Inside EXL module, gathering node network connectivity results' report noderesult var $cmd = '/opt/exalogic.tools/tools/infinicheck-node' prefix {write '---+ Node Network Connectivity Results Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) {call validate(true) write $TOP toc '3:[[',getFile(),'][rda_report][Node Network Connectivity Results]]' } } else call validate(true) =head2 package - Package Information Collects the output of the F command (applicable for C collection). =cut section EXLR_cfg_package if match($TYPE,'^_(All|HealthHwSw)_') {debug ' Inside EXL module, gathering package information' report package var $cmd = '/opt/exalogic.tools/tools/CheckSWProfile' prefix {write '---+ Package Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) {call validate(true) write $TOP toc '3:[[',getFile(),'][rda_report][Package Information]]' } } else call validate(true) =head2 port - Port Information Collects the output of the F command (applicable for C collection). =cut section EXLR_cfg_port if match($TYPE,'^_(All|HealthNetwork)_') {debug ' Inside EXL module, gathering port information' report port var $cmd = '/opt/exalogic.tools/tools/check_ibports' prefix {write '---+ Port Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) {call validate(true) write $TOP toc '3:[[',getFile(),'][rda_report][Port Information]]' } } else call validate(true) =head2 rackresult - Rack Network Connectivity Results Collects the output of the F command (applicable for C, C, and C collections). =cut section EXLR_cfg_rackresult if match($TYPE,'^_(All|(Health)?Network|IbFabric)_') {debug ' Inside EXL module, gathering rack network connectivity results' report rackresult var $cmd = '/opt/exalogic.tools/tools/infinicheck' prefix {write '---+ Rack Network Connectivity Results Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) {call validate(true) write $TOP toc '3:[[',getFile(),'][rda_report][Rack Network Connectivity Results]]' } } else call validate(true) =head2 rackserial - Rack Serial Number Collects the rack serial number using the C command. =cut section EXLR_cfg_racserial if match($TYPE,'^_All_') {debug ' Inside EXL module, getting rack serial number' report rackserial var $cmd = concat(cond(${OS.linux}, '/usr/bin/ipmitool',\ ${OS.solaris},'/opt/ipmitool/bin/ipmitool',\ 'ipmitool'),\ " sunoem cli 'show /SP system_identifier'") prefix {write '---+ Rack Serial Number' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) {call validate(true) write $TOP toc '3:[[',getFile(),'][rda_report][Rack Serial Number]]' } } else call validate(true) =head2 rdmadev - RDMA Devices Collects the output of the F command. =cut section EXLR_cfg_rdmadev if match($TYPE,'^_All_') {debug ' Inside EXL module, gathering RDMA devices information' report rdmadev var $cmd = '/usr/bin/ibv_devinfo' prefix {write '---+ RDMA Devices Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) {call validate(true) write $TOP toc '3:[[',getFile(),'][rda_report][RDMA Devices]]' } } else call validate(true) =head2 topology - Topology Collects the output of the F command (applicable for C, C, and C collections). =cut section EXLR_cfg_topology if match($TYPE,'^_(All|(Health)?Network|IbFabric)_') {debug ' Inside EXL module, gathering topology information' report topology var $cmd = '/opt/exalogic.tools/tools/verify-topology' prefix {write '---+ Topology Information' write '---## Using: ',encode($cmd) } call writeCommand($cmd) if hasOutput(true) {call validate(true) write $TOP toc '3:[[',getFile(),'][rda_report][Topology]]' } } else call validate(true) =head2 Log Files Gathers Exalogic-related log files. =cut section EXLR_log_logs if match($TYPE,'^_All_') {debug ' Inside EXL module, gathering log files' call validate(true) pretoc '3:Log Files' call sort_files(4,$TAIL,grepDir('/tmp','^ibdiagnet\.','ip'),\ grepDir('/var/log','^opensm','ip'),\ '/var/log/boot.log',\ '/var/log/secure') unpretoc } else call validate(true) =head1 SWITCH COLLECTIONS Collects the following Exalogic-related information from the switches (applicable for C and C collections). =cut section EXLR_switches if and(match($TYPE,'^_(All|Gateway|IbSwitch)_'),${EXL_COLLECT_SWITCH}) {debug ' Inside EXL module, getting information from the remote switches' if !loadCommand('/usr/sbin/ibswitches') echo 'Unable to get the switch information' else {var $SWITCH_PAUSE = ${EXL_SWITCH_WAIT_PWD:30} var $SWITCH_USERID = ${EXL_SWITCH_LOGIN:''} # Define parsing macros macro write_switch_list {var ($buf,$dat) = @arg var ($rpt,$lim) = split('\|',$dat,2) var $rpt = $[OUT]->add_report('F',$rpt,0) prefix $rpt {write {$rpt} '---+ Log Files' write {$rpt} ' * Last ',$lim,' log file lines collected' write {$rpt} ' * 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 {$rpt} '|*File Name*|' } while ?$lnk = $buf->get_line write {$rpt} '|',$lnk,'|' if $rpt->is_created(true) toc '4:[[',$rpt->get_report,'][rda_report][Log Files]]' end $rpt } # Definition for exec_command function set $def_exec_cmd {exec_command() "{ LIM="$1" " shift 1 " if [ "$LIM" -gt 0 ] " then " "$@" 2>/dev/null & " PID=$! " while [ $LIM -gt 0 ] " do " /bin/sleep 2 " if /bin/ps -l -p $PID 2>/dev/null | /bin/egrep " $PID *$$ " \ >/dev/null 2>&1 " then " LIM=`/usr/bin/expr $LIM - 2` " else " return " fi " done " if /bin/ps -l -p $PID 2>/dev/null | /bin/egrep " $PID *$$ " \ >/dev/null 2>&1 " then " /bin/kill -15 $PID 2>/dev/null " /bin/sleep 5 " /bin/kill -9 $PID 2>/dev/null " echo "---# RDA:SET TIMEOUT:***Execution Timeout***" " fi " else " "$@" 2>/dev/null " fi "} } # Define parsing macros macro set_swt_done {var ($buf,$swt) = @arg import %acc keep %acc var $acc{$swt} = '|Collection Completed| ' } # Switch section begin marker set $job_swt_begin {echo "---# RDA:BEGIN SECTION:3:${SWITCH} Information" } # Switch section end marker set $job_swt_end {echo "---# RDA:END SECTION" } # Job to mark the end of a switch collection set $job_end {echo "---# RDA:BEGIN" "echo "Collection Ended" "echo "---# RDA:END MACRO set_swt_done:${SWITCH}" " } =head2 dcsprt - Disk Port Collects the output of the C command. =cut set $cfg_dcsprt {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/local/bin/dcsport -printconnectors "echo "---# RDA:END REPORT:4|Disk Port|Disk Port Information|\ Using: /usr/local/bin/dcsport -printconnectors|dcsprt" } =head2 env_test - Environment Test Collects the output of the F command. =cut set $cfg_env_tst {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/local/bin/env_test "echo "---# RDA:END REPORT:4|Environment Test|Environment Test|\ Using: /usr/local/bin/env_test|env_test" } =head2 get_mst - Master Information Collects the output of the C command. =cut set $cfg_get_mst {if [ "$TYPE" = GW ] "then " echo "---# RDA:BEGIN" " exec_command ${TIMEOUT:-0} /usr/local/bin/getmaster -l " echo "---# RDA:END REPORT:4|Master Information|Master Information|\ Using: /usr/local/bin/getmaster -l|get_mst" "fi } =head2 ibcheckstate - InfiniBand State Check Collects the port physical state information using the F command. =cut set $cfg_ibcheckstate {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/sbin/ibcheckstate "echo "---# RDA:END REPORT:4|InfiniBand State Check|InfiniBand State Check|\ Using: /usr/sbin/ibcheckstate|ibcheckstate" } =head2 ibdiagnet - InfiniBand Diagnet Collects the output of the C command. =cut set $cfg_ibdiagnet {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/bin/ibdiagnet -skip dup_guids -pm "echo "---# RDA:END REPORT:4|InfiniBand Diagnet|\ InfiniBand Diagnet Information|\ Using: /usr/bin/ibdiagnet -skip dup_guids -pm|ibdiagnet" } =head2 iberrors - InfiniBand Errors Collects the output of the C command. =cut set $cfg_iberrors {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/sbin/ibcheckerrors -v "echo "---# RDA:END REPORT:4|InfiniBand Errors|InfiniBand Errors|\ Using: /usr/sbin/ibcheckerrors -v|iberrors" } =head2 ibnetdiscover - InfiniBand Netdiscover Collects the output of the F command. =cut set $cfg_ibnetdiscover {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/sbin/ibnetdiscover "echo "---# RDA:END REPORT:4|InfiniBand Netdiscover|\ InfiniBand Netdiscover Information|\ Using: /usr/sbin/ibnetdiscover|ibnetdiscover" } =head2 listlinkup - Linkup Collects the output of the F command. =cut set $cfg_linkup {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/local/bin/listlinkup "echo "---# RDA:END REPORT:4|Linkup|Linkup Information|\ Using: /usr/local/bin/listlinkup|listlinkup" } =head2 net_dev - Network Device Information Collects the output of the F file. =cut set $cfg_net_dev {echo "---# RDA:BEGIN" "/bin/cat /proc/net/arp "echo "---# RDA:END REPORT:4|Network Device Information|\ Network Device Information|Using: /proc/net/arp|net_dev" } =head2 nm2info - Switch Information Collects the output of the F command. =cut set $cfg_nm2info {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/local/bin/nm2info "echo "---# RDA:END REPORT:4|Switch Information|Switch Information|\ Using: /usr/local/bin/nm2info|nm2info" } =head2 nm2_ver - Switch Version Collects the output of the F command. =cut set $cfg_nm2_ver {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/local/bin/nm2version "echo "---# RDA:END REPORT:4|Switch Version|Switch Version|\ Using: /usr/local/bin/nm2version|nm2_ver" } =head2 pir_info - PIR Information Collects the output of the C command. =cut set $cfg_pir_info {if [ "$TYPE" = GW ] "then " echo "---# RDA:BEGIN" " exec_command ${TIMEOUT:-0} /usr/sbin/saquery PIR " echo "---# RDA:END REPORT:4|PIR Information|PIR Information|\ Using: /usr/sbin/saquery PIR|pir_info" "fi } =head2 prtconf - Port Configuration Collects the port error counters and configuration information using the C command. =cut set $cfg_prtconf {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/sbin/ibqueryerrors.pl -rR -s \ LinkDowned,RcvSwRelayErrors,XmtDiscards,XmtWait "echo "---# RDA:END REPORT:4|Port Configuration|Port Error Counters and \ Configuration Information|Using: /usr/sbin/ibqueryerrors.pl -rR \ -s LinkDowned,RcvSwRelayErrors,XmtDiscards,XmtWait|prtconf" } =head2 pr_info - PR Information Collects the output of the C command. =cut set $cfg_pr_info {if [ "$TYPE" = GW ] "then " echo "---# RDA:BEGIN" " exec_command ${TIMEOUT:-0} /usr/sbin/saquery PR " echo "---# RDA:END REPORT:4|PR Information|PR Information|\ Using: /usr/sbin/saquery PR|pr_info" "fi } =head2 saqry_adr0 - Memory Address0 Information Collects the output of the C command. =cut set $cfg_saqry_adr0 {if [ "$TYPE" = GW ] "then " echo "---# RDA:BEGIN" " exec_command ${TIMEOUT:-0} /usr/sbin/saquery -m 0xc000 " echo "---# RDA:END REPORT:4|Memory Address0|Memory Address0 Information|\ Using: /usr/sbin/saquery -m 0xc000|saqry_adr0" "fi } =head2 saqry_adr1 - Memory Address1 Information Collects the output of the C command. =cut set $cfg_saqry_adr1 {if [ "$TYPE" = GW ] "then " echo "---# RDA:BEGIN" " exec_command ${TIMEOUT:-0} /usr/sbin/saquery -m 0xc001 " echo "---# RDA:END REPORT:4|Memory Address1|Memory Address1 Information|\ Using: /usr/sbin/saquery -m 0xc001|saqry_adr1" "fi } =head2 sminfo - SM Information Collects the output of the F command. =cut set $cfg_sminfo {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/sbin/sminfo "echo "---# RDA:END REPORT:4|SM Information|SM Information|\ Using: /usr/sbin/sminfo|sminfo" } =head2 status - Status Information Collects the output of the C command. =cut set $cfg_status {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/bin/ibdiagnet -r -lw 4x -ls 10 "echo "---# RDA:END REPORT:4|Status Information|Status Information|\ Using: /usr/bin/ibdiagnet -r -lw 4x -ls 10|status" } =head2 version - Version Collects the output of the F command. =cut set $cfg_version {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/local/bin/version "echo "---# RDA:END REPORT:4|Version|Version Information|\ Using: /usr/local/bin/version|version" } =head2 switchlogs - Log Files Collects the last lines of the switch-related log files. =cut set $log_switch {echo "---# RDA:BEGIN LIST" "for fil in `/bin/ls /var/log/messages; \ /bin/ls /var/log/boot.log; \ /bin/ls /var/log/secure; \ /bin/ls /var/log/opensm*; \ /bin/ls /tmp/ibdiagnet*` "do " echo "---# RDA:BEGIN" " /usr/bin/tail -${TAIL} "$fil" " echo "---# RDA:END DATA:$fil" "done "echo "---# RDA:END LIST write_switch_list:switchlogs|${TAIL}" } # Define the collection code if compare('eq',$SWITCH_USERID,'root') var $cod = check($TYPE,\ '^_Gateway_',join("\012\012",\ $def_exec_cmd,$job_swt_begin,$cfg_dcsprt,$cfg_env_tst,$cfg_ibdiagnet,\ $cfg_iberrors,$cfg_ibnetdiscover,$cfg_linkup,$cfg_nm2info,$cfg_nm2_ver,\ $cfg_sminfo,$cfg_version,$log_switch,$job_swt_end,$job_end),\ '^_IbSwitch_',join("\012\012",\ $def_exec_cmd,$job_swt_begin,$cfg_get_mst,$cfg_ibcheckstate,\ $cfg_ibnetdiscover,$cfg_net_dev,$cfg_pir_info,$cfg_prtconf,$cfg_pr_info,\ $cfg_saqry_adr0,$cfg_saqry_adr1,$cfg_status,$log_switch,$job_swt_end,\ $job_end),\ '^_All_',join("\012\012",\ $def_exec_cmd,$job_swt_begin,$cfg_dcsprt,$cfg_env_tst,$cfg_get_mst,\ $cfg_ibcheckstate,$cfg_ibdiagnet,$cfg_iberrors,$cfg_ibnetdiscover,\ $cfg_linkup,$cfg_net_dev,$cfg_nm2info,$cfg_nm2_ver,$cfg_pir_info,\ $cfg_prtconf,$cfg_pr_info,$cfg_saqry_adr0,$cfg_saqry_adr1,$cfg_sminfo,\ $cfg_status,$cfg_version,$log_switch,$job_swt_end,$job_end),\ '') else var $cod = '' # Collect remote switch information in threads if length($cod) {pretoc '2:Switch Information' # Identify the switches and initialize the remote sessions var ($cnt,$pwd,@swt,%acc,%buf,%slp,%swt,%tim,%tmp) = (0) loop $lin (grepLastFile('\".*?\s(36P\sQDR|GW\sswitch)\sel.*?\"')) {var ($swt,$typ) = (undef) if match($lin,'\".*?\s36P\sQDR\s(.*?)\"') {var ($str) = last var $typ = '36P' if match($lin,'(.*?)\sleaf') {var ($str) = last var $swt = field('\s',0,$str) } else var $swt = field('\s',0,$str) } elsif match($lin,'\".*?\sswitch\s(.*?)\sleaf:\d+\"') {var ($str) = last var $typ = 'GW' var $swt = field('\s',0,$str) } elsif match($lin,'\".*?\sswitch\s(.*?)\"') {var ($swt) = last var $typ = 'GW' } next !?$swt next match($swt,'^(\(|localhost$)') if !match($swt,quote(${RDA.DOMAIN}),true) var $swt = join(".",$swt,${RDA.DOMAIN}) call addRemoteSession('EXL',$swt,$SWITCH_USERID) if and(defined($pwd),not(hasPassword('host',$swt,$SWITCH_USERID))) call setPassword('host',$swt,$SWITCH_USERID,$pwd) if needPassword('EXL') {var $pwd = askPassword(concat('Enter ',$SWITCH_USERID,'@',$swt,\ ' password:')) call setPassword('host',$swt,$SWITCH_USERID,$pwd) if needPassword('EXL') {var $acc{$swt} = '|Skipped due to connection problems| ' var $tim{$swt} = 0 call endRemoteSession('EXL') next } } var $slp{$swt} = cond(needPause('EXL'),$SWITCH_PAUSE,1) call endRemoteSession('EXL') var $swt{$swt} = $typ } # Collect switch specific information using remote session call $[REM]->set_timeout($dur = expr('*',25,$TIMEOUT)) loop $swt (@swt = keys(%swt)) {var $typ = $swt{$swt} var $acc{$swt} = '|Collection Incomplete| ' var $buf{$swt} = $res = getTemp($tmp{$swt} = concat('SWITCH',incr($cnt))) var $tim{$swt} = 0 var $key = concat('EXL_SWITCH_COLLECT_STATUS_',$tmp{$swt}) call setSetting($key) thread($cod,$swt,$typ,$key,$res) {var ($cod,$swt,$typ,$key,$res) = @arg import $SWITCH_USERID,$TAIL,$TIMEOUT debug ' - Getting switch information from ',$swt call addRemoteSession('EXL',$swt,$SWITCH_USERID) var $ret = rcollect('EXL',$cod,$res,\ {SWITCH => $swt,\ TAIL => $TAIL,\ TIMEOUT => $TIMEOUT,\ TYPE => $typ\ }) if !hasRemoteTimeout('EXL') call setSetting($key,$ret,'N','Remote collection exit code') call endRemoteSession('EXL') debug ' - Data collection ended for ',$swt } sleep $slp{$swt} } sleep 3 echo 'The remote switch data collection can take more than ',$dur,\ ' seconds. Do not interrupt the data collection.' wait $dur # Generate the remote switch reports loop $swt (@swt) {if getSetting(concat('EXL_SWITCH_COLLECT_STATUS_',$tmp{$swt})) var $acc{$swt} = concat('|Connection error (',last,')| ') else {call writeRemoteResult($buf{$swt} = new('Buffer','R',$buf{$swt}),$swt) call $buf{$swt}->close } call unlinkTemp($tmp{$swt}) } =head2 swt_summary - Switch Collection Summary Displays the switch list and their accessibility. =cut debug ' Inside EXL module, producing the switch collection summary' report swt_summary prefix {write '---+ Switch Collection Summary' write '|*Switch*|*Collection Status*| *Execution Timeout*|' } loop $key (keys(%acc)) write '|',$key,$acc{$key},$tim{$key},'|' if isCreated(true) {call validate(true) toc '3:[[',getFile(),'][rda_report][Switch Collection Summary]]' } else echo 'No switches found' unpretoc } } } else call validate(true) =head1 SEE ALSO L, 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