# MCexlr.ctl:120:Performs Oracle Exalogic Multi-run Collections (Rack Part) # $Id: MCexlr.ctl,v 1.5 2015/05/29 11:43:18 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/OFM/MCexlr.ctl,v 1.5 2015/05/29 11:43:18 RDA Exp $ # # Change History # 20150527 KRA Improve the documentation. =head1 NAME OFM:MCexlr - 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,Mrc,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 = ${SET.OFM.EXL.N_TAIL:1000} var $TIMEOUT = ${DFT.N_TIMEOUT:0} var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' keep $TAIL,$TIMEOUT,$TOC,$TOP # Load the common variables and define common macros section begin var $TYPE = ${SET.OFM.EXL.T_TYPE:'_All_'} # Load the common macros run RDA:library() 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. =for stopwords Diagnet =head3 ibdiagnet - Diagnet Details Gets the C information. =head3 ibhosts - Hosts Gets the F information. =head3 iblinkinfo - Link Gets the F information. =for stopwords Netdiscover =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 ILOM-related events information using the C command (applicable for C collection). =head2 lan - LAN Information Gets the ILOM-related LAN information using the C command (applicable for C collection). =head2 mac - Machine Details Gets the ILOM-related machine details using the C command (applicable for C collection). =head2 network - Network Information Gets the ILOM-related network information using the C command (applicable for C collection). =head2 sdr - SDR Information Gets the ILOM-related SDR information using the C command (applicable for C collection). =head2 sensor - Sensor Information Gets the ILOM-related sensor information using the C command (applicable for C collection). =head2 sysinfo - System Information Gets the 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)_'),${SET.OFM.EXL.B_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 = ${SET.OFM.EXL.N_SWITCH_WAIT_PWD:30} var $SWITCH_USERID = nvl(isUser(${SET.OFM.EXL.T_SWITCH_LOGIN},true),'') # 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 -e "\n---# RDA:SET TIMEOUT:***Execution Timeout***" " fi " else " "$@" 2>/dev/null " fi "} } # Definition for exec_subshell_command function set $def_exec_sub {exec_subshell_command() "{ LIM="$1" " shift 1 " if [ "$LIM" -gt 0 ] " then " "$@" 2>/dev/null & " PID=$! " SHP=`/bin/ps -l -p $PID 2>/dev/null | \ /bin/sed -e "/$PID/{s/.*$PID *\([0-9][0-9]*\).*/\1/ " p " } " d"` " while [ $LIM -gt 0 ] " do " /bin/sleep 2 " if /bin/ps -l -p $PID 2>/dev/null | \ /bin/egrep " $PID *$SHP " >/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 *$SHP " >/dev/null 2>&1 " then " /bin/kill -15 $PID 2>/dev/null " /bin/sleep 5 " /bin/kill -9 $PID 2>/dev/null " echo -e "\n---# RDA:SET TIMEOUT:***Execution Timeout***" " fi " else " "$@" 2>/dev/null " fi "} } # Definition for tail_command function set $def_exec_tail {tail_command() "{ LIM="$1" " MAX="$2" " shift 2 " if [ "$LIM" -gt 0 ] " then " "$@" 2>/dev/null | /usr/bin/tail -${MAX} & " 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 -e "\n---# RDA:SET TIMEOUT:***Execution Timeout***" " fi " else " "$@" 2>/dev/null | /usr/bin/tail -${MAX} " 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 bxconf - Bridge Configuration Collects the output of the F file. =cut set $cfg_bxconf {echo "---# RDA:BEGIN" "/bin/cat /conf/bx.conf "echo "---# RDA:END REPORT:4|Bridge Configuration|Bridge Configuration \ Information|Using: /conf/bx.conf|bxconf" } =head2 config_sta - Configuration Status Collects the output of the F file. =cut set $cfg_config_sta {echo "---# RDA:BEGIN" "/bin/cat /conf/configvalid "echo "---# RDA:END REPORT:4|Configuration Status|Configuration Status \ Information|Using: /conf/configvalid|config_sta" } =head2 df - Disk Free Information Collects the output of the C command. =cut set $cfg_df {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /bin/df -h "echo "---# RDA:END REPORT:4|Disk Free Information|Disk Free Information|\ Using: /bin/df -h|df" } =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 free - Memory Free Information Collects the output of the C command. =cut set $cfg_free {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/bin/free -m "echo "---# RDA:END REPORT:4|Memory Free Information|Memory Free Information|\ Using: /usr/bin/free -m|free" } =head2 fwverify - Firmware Status Collects the output of the F command. =cut set $cfg_fwverify {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/local/bin/fwverify "echo "---# RDA:END REPORT:4|Firmware Status|Firmware Status Information|\ Using: /usr/local/bin/fwverify|fwverify" } =head2 get_mst - Master Information Collects the output of the C command. =cut set $cfg_get_mst {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" } =head2 gw_config - GW Configuration Information Collects the output of the F command. =cut set $cfg_gw_config {if [ "$TYPE" = GW ] "then " echo "---# RDA:BEGIN" " exec_command ${TIMEOUT:-0} /usr/local/bin/showgwconfig " echo "---# RDA:END REPORT:4|GW Configuration Information|GW Configuration \ Information|Using: /usr/local/bin/showgwconfig|gw_config" "fi } =head2 gw_port - GW Port Information Collects the output of the F command. =cut set $cfg_gw_port {if [ "$TYPE" = GW ] "then " echo "---# RDA:BEGIN" " exec_command ${TIMEOUT:-0} /usr/local/bin/showgwports " echo "---# RDA:END REPORT:4|GW Port Information|GW Port Information|\ Using: /usr/local/bin/showgwports|gw_port" "fi } =head2 ib_addr - InfiniBand Address Information Collects the output of the F command. =cut set $cfg_ib_addr {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/sbin/ibaddr "echo "---# RDA:END REPORT:4|InfiniBand Address Information|InfiniBand \ Address Information|Using: /usr/sbin/ibaddr|ib_addr" } =head2 ib_stat - InfiniBand Status Collects the output of the F command. =cut set $cfg_ib_stat {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/sbin/ibstat "echo "---# RDA:END REPORT:4|InfiniBand Status|InfiniBand Status \ Information|Using: /usr/sbin/ibstat|ib_stat" } =head2 ib_nodes - InfiniBand Nodes Information Collects the output of the F command. =cut set $cfg_ib_nodes {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/sbin/ibnodes "echo "---# RDA:END REPORT:4|InfiniBand Nodes Information|InfiniBand Nodes \ Information|Using: /usr/sbin/ibnodes|ib_nodes" } =head2 ib_width - InfiniBand Width Check Collects the output of the F command. =cut set $cfg_ib_width {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/sbin/ibcheckwidth "echo "---# RDA:END REPORT:4|InfiniBand Width Check|InfiniBand Width Check|\ Using: /usr/sbin/ibcheckwidth|ib_width" } =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 net_sta - Network Status Information Collects the output of the F command. =cut set $cfg_ibnetstatus {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/local/bin/ibnetstatus "echo "---# RDA:END REPORT:4|Network Status Information|Network Status \ Information|Using: /usr/local/bin/ibnetstatus|ibnetstatus" } =head2 ntp_conf - NTP Configuration Collects the output of the F file. =cut set $cfg_ntp_conf {echo "---# RDA:BEGIN" "/bin/cat /conf/ntp.conf "echo "---# RDA:END REPORT:4|NTP Configuration|NTP Configuration Information|\ Using: /conf/ntp.conf|ntp_conf" } =head2 partition - Partition Information Collects the output of the F file. =cut set $cfg_partition {echo "---# RDA:BEGIN" "/bin/cat /conf/partitions.current "echo "---# RDA:END REPORT:4|Partition Information|Partition Information|\ Using: /conf/partitions.current|partition" } =head2 smlog - SM Log Data Collects the last 100 lines of output using the F command. =cut set $cfg_smlog {echo "---# RDA:BEGIN" "tail_command ${TIMEOUT:-0} 100 /usr/local/bin/showsmlog "echo "---# RDA:END REPORT:4|SM Log Data|Last 100 Lines of SM Log Data|\ Using: /usr/local/bin/showsmlog|smlog" } =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 spshexec - Switch Properties Collects the output of the C command. =cut set $cfg_spshexec {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/local/bin/spshexec \ 'show /SP system_description' "echo "---# RDA:END REPORT:4|Switch Properties|Switch Properties Information|\ Using: /usr/local/bin/spshexec 'show /SP system_description'|spshexec" } =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 opensm - SM Process Information Collects the C process status information. =cut set $cfg_opensm {echo "---# RDA:BEGIN" "exec_subshell_command ${TIMEOUT:-0} /bin/ps wwwaux | /bin/egrep opensm | \ /bin/egrep -v egrep "echo "---# RDA:END REPORT:4|SM Process Information|SM Process Information|\ Using: ps wwwaux|opensm" } =head2 sm_service - SM Service Information Collects the output of the C command. =cut set $cfg_sm_service {echo "---# RDA:BEGIN" "exec_subshell_command ${TIMEOUT:-0} /sbin/service --status-all | \ /bin/egrep sm | /bin/egrep -v egrep "echo "---# RDA:END REPORT:4|SM Service Information|SM Service Information|\ Using: /sbin/service --status-all|sm_service" } =head2 opensmd_sta - SM Status Information Collects the output of the C command. =cut set $cfg_opensmd_sta {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /sbin/service opensmd status "echo "---# RDA:END REPORT:4|SM Status Information|SM Status Information|\ Using: /sbin/service opensmd status|opensmd_sta" } =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 topology - Topology Information Collects the output of the F command. =cut set $cfg_topology {echo "---# RDA:BEGIN" "exec_command ${TIMEOUT:-0} /usr/local/bin/showtopology "echo "---# RDA:END REPORT:4|Topology Information|Topology Information|\ Using: /usr/local/bin/showtopology|topology" } =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 vlan - VLAN Information Collects the output of the F command. =cut set $cfg_vlan {if [ "$TYPE" = GW ] "then " echo "---# RDA:BEGIN" " exec_command ${TIMEOUT:-0} /usr/local/bin/showvlan " echo "---# RDA:END REPORT:4|VLAN Information|VLAN Information|\ Using: /usr/local/bin/showvlan|vlan" "fi } =head2 vnic - VNIC Information Collects the output of the F command. =cut set $cfg_vnic {if [ "$TYPE" = GW ] "then " echo "---# RDA:BEGIN" " exec_command ${TIMEOUT:-0} /usr/local/bin/showvnics " echo "---# RDA:END REPORT:4|VNIC Information|VNIC Information|\ Using: /usr/local/bin/showvnics|vnic" "fi } =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,$def_exec_sub,$def_exec_tail,$job_swt_begin,\ $cfg_bxconf,$cfg_config_sta,$cfg_dcsprt,$cfg_df,$cfg_env_tst,$cfg_free,\ $cfg_fwverify,$cfg_get_mst,$cfg_gw_config,$cfg_gw_port,$cfg_ib_addr,\ $cfg_ib_nodes,$cfg_ib_stat,$cfg_ib_width,$cfg_ibdiagnet,$cfg_iberrors,\ $cfg_ibnetdiscover,$cfg_ibnetstatus,$cfg_linkup,$cfg_nm2info,\ $cfg_nm2_ver,$cfg_ntp_conf,$cfg_opensm,$cfg_opensmd_sta,$cfg_partition,\ $cfg_sm_service,$cfg_sminfo,$cfg_smlog,$cfg_spshexec,$cfg_topology,\ $cfg_version,$cfg_vlan,$cfg_vnic,$log_switch,\ $job_swt_end,$job_end),\ '^_IbSwitch_',join("\012\012",\ $def_exec_cmd,$def_exec_sub,$def_exec_tail,$job_swt_begin,\ $cfg_bxconf,$cfg_config_sta,$cfg_df,$cfg_free,$cfg_fwverify,\ $cfg_get_mst,$cfg_ib_addr,$cfg_ib_nodes,$cfg_ib_stat,$cfg_ib_width,\ $cfg_ibcheckstate,$cfg_ibnetdiscover,$cfg_ibnetstatus,$cfg_linkup,\ $cfg_net_dev,$cfg_ntp_conf,$cfg_opensm,$cfg_opensmd_sta,$cfg_partition,\ $cfg_pir_info,$cfg_prtconf,$cfg_pr_info,$cfg_saqry_adr0,$cfg_saqry_adr1,\ $cfg_sm_service,$cfg_sminfo,$cfg_smlog,$cfg_spshexec,$cfg_status,\ $cfg_topology,$cfg_version,$log_switch,\ $job_swt_end,$job_end),\ '^_All_',join("\012\012",\ $def_exec_cmd,$def_exec_sub,$def_exec_tail,$job_swt_begin,\ $cfg_bxconf,$cfg_config_sta,$cfg_dcsprt,$cfg_df,$cfg_env_tst,$cfg_free,\ $cfg_fwverify,$cfg_get_mst,$cfg_gw_config,$cfg_gw_port,$cfg_ib_addr,\ $cfg_ib_nodes,$cfg_ib_stat,$cfg_ib_width,$cfg_ibcheckstate,\ $cfg_ibdiagnet,$cfg_iberrors,$cfg_ibnetdiscover,$cfg_ibnetstatus,\ $cfg_linkup,$cfg_net_dev,$cfg_nm2info,$cfg_nm2_ver,$cfg_ntp_conf,\ $cfg_opensm,$cfg_opensmd_sta,$cfg_partition,$cfg_pir_info,$cfg_prtconf,\ $cfg_pr_info,$cfg_saqry_adr0,$cfg_saqry_adr1,$cfg_sm_service,\ $cfg_sminfo,$cfg_smlog,$cfg_spshexec,$cfg_status,$cfg_topology,\ $cfg_version,$cfg_vlan,$cfg_vnic,$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 var ($cnt,$pwd,@swt,%acc,%buf,%slp,%swt,%tb_swt,%tbl,%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(.*?)(\s.*?)?\"') {var ($swt) = last var $typ = 'GW' } next !?$swt next match($swt,'^(\(|localhost$)') if !match($swt,verbatim(${RDA.T_DOMAIN}),true) var $swt = join(".",$swt,${RDA.T_DOMAIN}) if compare('eq',$typ,'GW') {if compare('eq',$TYPE,'_All_') var $tb_swt{'all',$swt} = $typ elsif compare('eq',$TYPE,'_Gateway_') var $tb_swt{'gw',$swt} = $typ } elsif compare('eq',$typ,'36P') {if compare('eq',$TYPE,'_All_') var $tb_swt{'all',$swt} = $typ elsif compare('eq',$TYPE,'_IbSwitch_') var $tb_swt{'36p',$swt} = $typ } } # Identify the valid switches needed for the collection type if compare('eq',$TYPE,'_All_') {loop $key (keys($tb_swt{'all'})) var $tbl{$key} = $tb_swt{'all',$key} } elsif compare('eq',$TYPE,'_Gateway_') {loop $key (keys($tb_swt{'gw'})) var $tbl{$key} = $tb_swt{'gw',$key} } elsif compare('eq',$TYPE,'_IbSwitch_') {loop $key (keys($tb_swt{'36p'})) var $tbl{$key} = $tb_swt{'36p',$key} } # Initialize switch specific remote sessions loop $swt (keys(%tbl)) {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 = setPassword('host',$swt,$SWITCH_USERID,\ askPassword("Enter ${VAR.SWITCH_USERID} at ${VAR.swt} password:",'')) 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} = $tbl{$swt} } # Collect switch specific information using remote session var $sta = ${STA.${CUR.K_NAME}.SWITCH/i}->clear call $[REM]->set_timeout($dur = expr('*',25,$TIMEOUT)) loop $swt (@swt = keys(%swt)) {var $typ = $swt{$swt} var $acc{$swt} = '|Collection Incomplete| ' var $tim{$swt} = 0 var $tmp{$swt} = concat('R_EXIT',incr($cnt)) thread($cod,$swt,$typ,$sta,$tmp{$swt},$buf{$swt} = getTemp($tmp{$swt})) {var ($cod,$swt,$typ,$sta,$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 $sta->set_value($key,$ret,'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 $sta->get_first($tmp{$swt}) var $acc{$swt} = concat('|Connection error (',last,')| ') else {call writeRemoteResult($buf = new('Buffer','R',$buf{$swt}),$swt) call $buf->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, 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