# MCf15c.ctl:240: Collects Sun Fire 15K Servers System Controller Information. # $Id: MCf15c.ctl,v 1.10 2015/08/31 14:06:16 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/EXPLORER/MCf15c.ctl,v 1.10 2015/08/31 14:06:16 RDA Exp $ # # Change History # 20150828 JGS Share the SMS user setting. =head1 NAME EXPLORER:MCf15c - Collects Sun Fire 15K Servers System Controller Information =head1 DESCRIPTION This module collects information about system controller on Sun Fire 15K servers. =cut 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.' var $SU = check(${RDA.T_OS},'solaris','/usr/bin/su',\ '/bin/su') run EXPLORER:XPLRlib('sf15k_sc') #------------------------------------------------------------------------------ # XPLR_sf15k_sc section #------------------------------------------------------------------------------ section XPLR_sf15k_sc # Validate the execution context if !${B_GLOBAL:1} return call log_run('Processing F15C sections ...') if !is_pkg_installed('SUNWSMSr*') return log_info('SMS not installed') # Validate the input parameters if ${T_SMS_USER/M} return log_error('SMS user is not defined') if !?$usr = isUser(${T_SMS_USER},true) return log_error('Bad user name for the SMS user') if !grepFile('/etc/passwd',concat('^',verbatim($usr),':'),'f') return log_error('SMS user does not exist') # Check SMS user privileges var $pat = verbatim($usr,'b') if !grepCommand('/opt/SUNWSMS/bin/smsconfig -l platform',$pat,'f') return log_error('SMS user does not have platform privileges') var @dom = () loop $dom ('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q',\ 'R') {if !grepCommand(join(' ','/opt/SUNWSMS/bin/smsconfig -l',$dom),$pat,'f') next log_warning(concat('SMS user does not have privileges on domain ',$dom)) call push(@dom,$dom) } if !@dom call log_warning('SMS user does not have privileges on any domain. No domain \ information will be collected') =head2 sf15k_sc - Sun Fire 15K System Controller Gathers Sun Fire 15K System Controller 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 =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 =cut debug ' Inside F15C collection, gathering Sun Fire 15K SC information' pretoc '2:Sun Fire 15K' # Define global variables imported by capture macro var @ret = () # Define the capture macro macro capture_results {var ($rpt,$wrk) = @arg import @ret while ?$wrk->get_line() {var $lin = chomp(last) write {$rpt} $lin call push(@ret,$lin) } } # Perform the collections report sf15k_sc title '---+!! System Controller Information' title $TOC var $sms = join(' ',$SU,$usr,'-c') var $rol = grepCommand(\ concat($sms,' "/opt/SUNWSMS/bin/showfailover -r" 2>/dev/null'),'^MAIN$','f') var @ret = () call do_exec(\ {cmd => 'TITLE',txt => '---+ SMS'},\ ['sf15k/smsversion_-t',\ '/opt/SUNWSMS/bin/smsversion','-t','---++ Active SMS Version',\ {out=>{fct=>'capture_results'}}],\ ['sf15k/ls_-laR_@etc@opt@SUNWSMS@SMS@config',\ '/usr/bin/ls','-laR /etc/opt/SUNWSMS/SMS/config',\ '---++ Contents of /etc/opt/SUNWSMS/SMS/config Directory'],\ ['sf15k/ls_-laR_@var@opt@SUNWSMS@SMS@adm',\ '/usr/bin/ls','-laR /var/opt/SUNWSMS/SMS/adm',\ '---++ Contents of /var/opt/SUNWSMS/SMS/adm Directory'],\ {cmd => 'UNTITLE'}) call do_remote(undef,$sms,'/',\ {cmd => 'TITLE',txt => '---+ Basic System Controller Informartion'},\ ['sf15k/showfailover' ,'/opt/SUNWSMS/bin/showfailover','' ,\ '---++ System Controller Failover Status'],\ ['sf15k/showfailover_-r','/opt/SUNWSMS/bin/showfailover','-r',\ '---++ System Controller Role'],\ ['sf15k/showfailover_-v','/opt/SUNWSMS/bin/showfailover','-v',\ '---++ System Controller Status Full Information'],\ {cmd => 'UNTITLE'}) var $ver = shift(@ret) if $rol {var @ret = () call do_remote(undef,$sms,'/',\ {cmd => 'TITLE',txt => '---+ Main System Controller'},\ ['sf15k/showplatform' ,'/opt/SUNWSMS/bin/showplatform' ,'',\ '---++ Board Available Component List'],\ ['sf15k/showplatform_-v' ,'/opt/SUNWSMS/bin/showplatform' ,'-v',\ '---++ Board Available Full Information'],\ ['sf15k/showenvironment' ,'/opt/SUNWSMS/bin/showenvironment','',\ '---++ Environmental Data'],\ ['sf15k/showdate_-v' ,'/opt/SUNWSMS/bin/showdate' ,'-v',\ '---++ System Controller Date and Time'],\ ['sf15k/marginclock' ,'/opt/SUNWSMS/bin/marginclock' ,'',\ '---++ Clock Margings Information'],\ ['sf15k/marginvoltage' ,'/opt/SUNWSMS/bin/marginvoltage' ,'',\ '---++ Voltage Margings Information'],\ ['sf15k/showboards_-v' ,'/opt/SUNWSMS/bin/showboards' ,'-v',\ '---++ Board Assignment and Status',\ {out=>{fct=>'capture_results'},req=>{inc=>3}}],\ ['sf15k/showbus' ,'/opt/SUNWSMS/bin/showbus' ,'',\ '---++ Bus Configuration'],\ ['sf15k/showbus_-v' ,'/opt/SUNWSMS/bin/showbus' ,'-v',\ '---++ Bus Configuration Full Information'],\ ['sf15k/showcmdsync' ,'/opt/SUNWSMS/bin/showcmdsync' ,'',\ '---++ Command Synchronization'],\ ['sf15k/showcmdsync_-v' ,'/opt/SUNWSMS/bin/showcmdsync' ,'-v',\ '---++ Command Synchronization Full Information'],\ ['sf15k/showdatasync_-l' ,'/opt/SUNWSMS/bin/showdatasync' ,'-l',\ '---++ Data Synchronization'],\ ['sf15k/showdatasync_-v' ,'/opt/SUNWSMS/bin/showdatasync' ,'-v',\ '---++ Data Synchronization Full Information'],\ ['sf15k/showcodusage_-v' ,'/opt/SUNWSMS/bin/showcodusage' ,'-v',\ '---++ Usage Statistics for Capacity On Demand (COD) Resources'],\ ['sf15k/showcodlicense_-v','/opt/SUNWSMS/bin/showcodlicense' ,'-v',\ '---++ Capacity on Demand (COD) Right-to-Use (RTU) Licenses']) # Save boards installed for later usage var @brd = @ret if compare('newer',$ver,'1.3') {var @ret = () call do_remote(undef,$sms,'/',\ ['sf15k/showboards_-c' ,'/opt/SUNWSMS/bin/showboards','-c',\ '---++ Clock Source and Status',{req=>{inc=>3}}],\ ['sf15k/showlogs_-E_-p_e','/opt/SUNWSMS/bin/showlogs' ,'-E -p e',\ '---++ Condensed Event Log',{out=>{fct=>'capture_results'}}],\ {cmd => 'TITLE',txt => '---++ Component Health Status'}) loop $lin (@ret) {var ($val,$fru) = split('\s+',$lin,3) next !match(concat($val,$fru),'FRU:') call do_remote(undef,$sms,'/',\ [concat('sf15k/showchs_-v_-c_',$fru),\ '/opt/SUNWSMS/bin/showchs',concat('-v -c ',quote($fru)),\ concat('---++ FRU: ',$fru)]) } call do_exec({cmd => 'UNTITLE'}) } call do_exec({cmd => 'UNTITLE'}) } # Get revisions on lpost elf files call do_exec({cmd => 'TITLE',txt => '---+ Revisions inside ELF Files'}) loop $fil (grepDir('/opt/SUNWSMS/hostobjs','\.elf$','n')) {if @tbl = grepCommand(\ concat('/usr/ccs/bin/mcs -p ',catCommand('/opt/SUNWSMS/hostobjs',$fil)),\ concat('\b',quote($fil),'\b')) call do_exec(\ {cmd => 'ARRAY',\ det => concat('/usr/ccs/bin/mcs -p /opt/SUNWSMS/hostobjs/',$fil,\ ' | grep ',$fil),\ nam => concat('sf15k/hostobjs/',$fil),\ tbl => \@tbl,\ ttl => concat('---+ File : ',encode($fil))}) } call do_exec({cmd => 'UNTITLE'}) # Get getfacl output call do_exec(\ {cmd => 'TITLE',txt => '---+ File and Directory Information'},\ ['sf15k/getfacl/getfacl_@etc@opt@SUNWSMS@SMS@config@',\ '/usr/bin/getfacl','/etc/opt/SUNWSMS/SMS/config/'],\ ['sf15k/getfacl/getfacl_@etc@opt@SUNWSMS@SMS@config@platform',\ '/usr/bin/getfacl','/etc/opt/SUNWSMS/SMS/config/platform'],\ ['sf15k/getfacl/getfacl_@var@opt@SUNWSMS@adm@',\ '/usr/bin/getfacl','/var/opt/SUNWSMS/adm/'],\ ['sf15k/getfacl/getfacl_@var@opt@SUNWSMS@adm@platform',\ '/usr/bin/getfacl','/var/opt/SUNWSMS/adm/platform'],\ ['sf15k/getfacl/getfacl_@var@opt@SUNWSMS@adm@anonymous',\ '/usr/bin/getfacl','/var/opt/SUNWSMS/adm/anonymous'],\ ['sf15k/getfacl/getfacl_@var@opt@SUNWSMS@data@',\ '/usr/bin/getfacl','/var/opt/SUNWSMS/data/'],\ {cmd => 'UNTITLE'}) # Collect domain information var @fil = () call do_exec({cmd => 'TITLE',txt => '---+ Domains'}) loop $dom (@dom) {next ?testFile('z',catFile('/var/opt/SUNWSMS/data',$dom,'nvramdata')) call do_remote(undef,$sms,'/',\ {cmd => 'TITLE',txt => concat('---++ ',$dom)},\ [concat('sf15k/',$dom,'/data/sysid_-d_',$dom),\ '/opt/SUNWSMS/bin/sysid',concat('-d ',$dom),\ '---+++ Identification']) if $rol {call do_remote(undef,$sms,'/',\ [concat('sf15k/',$dom,'/showdate_-v_-d_',$dom),\ '/opt/SUNWSMS/bin/showdate',concat('-v -d ',$dom),\ '---+++ Date and Time'],\ [concat('sf15k/',$dom,'/showobpparams_-d_',$dom),\ '/opt/SUNWSMS/bin/showobpparams',concat('-d ',$dom),\ '---+++ OpenBoot PROM Bring Up Parameters'],\ [concat('sf15k/',$dom,'/showkeyswitch_-d_',$dom),\ '/opt/SUNWSMS/bin/showkeyswitch',concat('-d ',$dom),\ '---+++ Position of the Virtual Keyswitch']) if ${MOD.F15C.B_SHOW_DEV} call do_remote(undef,$sms,'/',\ [concat('sf15k/',$dom,'/showdevices_-v_-d_',$dom),\ '/opt/SUNWSMS/bin/showdevices',concat('-v -d ',$dom),\ '---+++ System Board Devices and Resource Usage Information']) } # Execute getfacl commands call do_exec(\ {cmd => 'TITLE',txt => '---+++ File and Directory Information'},\ [concat('sf15k/getfacl/getfacl_@etc@opt@SUNWSMS@SMS@config@',$dom),\ '/usr/bin/getfacl',concat('/etc/opt/SUNWSMS/SMS/config/',$dom)],\ [concat('sf15k/getfacl/getfacl_@var@opt@SUNWSMS@adm@',$dom),\ '/usr/bin/getfacl',concat('/var/opt/SUNWSMS/adm/',$dom)],\ [concat('sf15k/getfacl/getfacl_@var@opt@SUNWSMS@data@',$dom),\ '/usr/bin/getfacl',concat('/var/opt/SUNWSMS/data/',$dom)],\ {cmd => 'UNTITLE'}) # Add domain files call push(@fil,\ [concat('sf15k/',$dom,'/postrc'),\ catFile('/etc/opt/SUNWSMS/config',$dom,'.postrc')],\ [concat('sf15k/',$dom,'/lock'),\ catDir('/var/opt/SUNWSMS/.lock',$dom),'','','^\.+$','nv']) var $dir = catDir('/var/opt/SUNWSMS/data',$dom) loop $fil (grepDir($dir,'^\.+$','nv')) call push(@fil,\ [concat('sf15k/',$dom,'/data/',$fil),catFile($dir,$fil),\ match($fil,'^nvramdata$|^idprom\.image$')]) } call do_exec({cmd => 'UNTITLE'}) # Choose the right FlashPROM image files var $obp = '/opt/SUNWSMS/firmware/SCOBPimg.di' var $sb = '/opt/SUNWSMS/hostobjs/sgcpu.flash' if compare('newer',$ver,'1.2') {var ($nmi) = command(concat(check(${RDA.T_OS},'solaris','/usr/bin/uname',\ '/bin/uname'),' -i')) if compare('eq',$nmi,'SUNW,UltraSPARC-IIi-cEngine') var $pst = '/opt/SUNWSMS/firmware/nSSCPOST.di' elsif compare('eq',$nmi,'SUNW,UltraSPARCengine_CP-40') var $pst = '/opt/SUNWSMS/firmware/oSSCPOST.di' else var $pst = createTemp('not_SSCPOST','.di') } else var $pst = '/opt/SUNWSMS/firmware/SSCPOST.di' # Check availability of the files and substitute them with others when missing if ?nvl(testFile('f',$obp),\ testFile('f',$sb),\ testFile('f',$pst)) {if !?testFile('f',$obp) {if !?testFile('f',$sb) var $sb = $pst var $obp = $sb } if !?testFile('f',$sb) var $sb = $obp if !?testFile('f',$pst) var $pst = $obp # Find active SC and collect FlasfPROMs var ($ip) = grepFile('/etc/opt/SUNWSMS/config/MAN.cf',\ '^[^#].*\s+SC0-I2\s+.*\s+(.*)','f1') var $sc = cond(grepCommand('/usr/sbin/ifconfig -a',re($ip),'f'),0,1) call do_remote(undef,$sms,'/',\ {cmd => 'TITLE',txt => '---+ FlashPROMs Contents'},\ [concat('sf15k/flashupdate/flashupdate_-f_',translate($obp,'/ ','@_'),\ '_-n_SC',$sc,'@FP0'),\ '/opt/SUNWSMS/bin/flashupdate',concat('-f ',$obp,' -n SC',$sc,'/FP0'),\ concat('---++ FlashPROM#0 on SC',$sc)],\ [concat('sf15k/flashupdate/flashupdate_-f_',translate($pst,'/ ','@_'),\ '_-n_SC',$sc,'@FP1'),\ '/opt/SUNWSMS/bin/flashupdate',concat('-f ',$pst,' -n SC',$sc,'/FP1'),\ concat('---++ FlashPROM#1 on SC',$sc)]) if $rol {loop $lin (@brd) {next !match($lin,'^(\w+)\s+On.*CPU') call do_remote(undef,$sms,'/',\ [concat('sf15k/flashupdate/flashupdate_-f_',translate($sb,'/ ','@_'),\ '_-n_',last),\ '/opt/SUNWSMS/bin/flashupdate',concat('-f ',$sb,' -n ',last),\ concat('---++ FlashPROMs on CPU Board ',last)]) } } call do_exec({cmd => 'UNTITLE'}) } if isCreated(true) toc '3:[[',getFile(),'][rda_report][System Controller Information]]' =head2 sf15k_sc_cfg - Configuration Files Gathers the following Sun Fire 15K System Controller configuration files: =over 2 =item o F =item o F =item o F =item o F =item o F =item o F =item o F =item o F =item o F =item o F =item o F =item o F =item o F =back =cut # Add general files call push(@fil,\ ['sf15k/pcd','/var/opt/SUNWSMS/.pcd','','','^\.+$','nv'],\ ['sf15k/adm/logger','/var/opt/SUNWSMS/adm/.logger'],\ ['sf15k/logs/smsbackup','/var/sadm/system/logs/smsbackup'],\ ['sf15k/etc/config/fomd_uids.cf','/etc/opt/SUNWSMS/config/.fomd_uids.cf'],\ ['sf15k/etc/config/postrc','/etc/opt/SUNWSMS/config/platform/.postrc'],\ ['sf15k/adm/platform/dump',\ '/var/opt/SUNWSMS/adm/platform/dump','','','^\.+$','nv'],\ ['sf15k/adm/anonymous','/var/opt/SUNWSMS/adm/anonymous','','','^\.+$','drv'],\ ['sf15k/etc','/etc/opt/SUNWSMS/SMS','','','^\.+$','drv'],\ ['sf15k/LockDump','/var/opt/SUNWSMS/data/LockDump','','','^\.+$','nv']) # Compress tracejournal files before collecting them var $tmp = get_tmp() var $dir = '/var/opt/SUNWSMS/adm/platform/trace' loop $fil (grepDir($dir,'^tracejournal(\.[012])?$','n')) {if ?testFile('sf',catFile($dir,$fil)) {call command(join(' ','/usr/bin/gzip -c',lastTestFile(),'>',\ catCommand($tmp,concat($fil,'.gz')))) call push(@fil,\ [concat('sf15k/adm/platform/trace/',$fil,'.gz'),\ catCommand($tmp,concat($fil,'.gz')),true,\ concat('sf15k/adm/platform/trace/',$fil,'.gz')]) } } # Collect configuration files report sf15k_sc_cfg title '---+!! Configuration Files' title $TOC prefix {write $WRN write '|*File Path*| *Size*|*Last Modified Date*|' } call do_collect_fil(@fil) if hasOutput(true) write $TOP # Add the report to the table of content if isCreated(true) toc '3:[[',getFile(),'][rda_report][Configuration Files]]' =head2 sf15k_sc_log - Log and Message Files Gathers the following Sun Fire 15K System Controller log and message files: =over 2 =item o F =item o F =item o F =item o F =item o F =item o F =item o F =item o F =item o F =item o F =item o F =back =cut # Determine the collection period if ${B_INCR_MODE} {var ($beg,$end) = (${STA.EXPLORER.XPLR.F15C.G_LAST_INCR},time()) if !?$beg var $beg = expr('-',$end,7776000) # 90 * 86400 } else var ($beg,$end) = () # Push files subject to potential incremental collection var @fil = () loop $dom (@dom) {loop $fil (get_modified_files($beg,$end,catDir('/var/opt/SUNWSMS/adm',$dom),\ '\.+$','drv')) call push(@fil,\ [concat('sf15k/',$dom,'/adm/',$fil),\ catFile('/var/opt/SUNWSMS/adm',$dom,$fil),match($fil,'^dump\/')]) } loop $fil (get_modified_files($beg,$end,'/var/opt/SUNWSMS/adm','^mess')) call push(@fil,\ [concat('sf15k/adm/',$fil),catFile('/var/opt/SUNWSMS/adm',$fil)]) loop $fil (get_modified_files($beg,$end,'/var/opt/SUNWSMS/adm/platform',\ '^mess')) call push(@fil,\ [concat('sf15k/adm/platform/',$fil),\ catFile('/var/opt/SUNWSMS/adm/platform',$fil)]) # Collect log and message files report sf15k_sc_log title '---+!! Log and Message Files' title $TOC prefix {if ?$end {write ' * Incremental collection mode activated:' write ' * Period start: ',gmtime('%d-%b-%Y %H:%M:%S',$beg),' UTC' write ' * Period end: ',gmtime('%d-%b-%Y %H:%M:%S',$end),' UTC' } write $WRN write '|*File Path*| *Size*|*Last Modified Date*|' } call do_collect_fil(@fil) if hasOutput(true) write $TOP # Add the report to the table of content if isCreated(true) toc '3:[[',getFile(),'][rda_report][Log and Message Files]]' # Store the new time stamp if ?$end var ${STA.EXPLORER.XPLR.F15C.G_LAST_INCR:'Last incremental collection'} = $end # Adjust the table of contents unpretoc #------------------------------------------------------------------------------ # Input section #------------------------------------------------------------------------------ section input if ?${ENV.EXP_SHOWDEVICES} var ${RUN.EXPLORER.XPLR.F15C.B_SHOW_DEV} = true if ?isUser(${ENV.EXP_SMSUSER},true) var ${RUN.EXPLORER.XPLR.T_SMS_USER} = last var ${RUN.EXPLORER.B_USE_F15C} = true =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