# MCvar.ctl:285: Collects /var Related Files and Commands # $Id: MCvar.ctl,v 1.8 2015/05/29 11:41:06 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/EXPLORER/MCvar.ctl,v 1.8 2015/05/29 11:41:06 RDA Exp $ # # Change History # 20141205 PRA Add live upgrade history file collection. =head1 NAME EXPLORER:MCvar - Collects /var Related Files and Commands =head1 DESCRIPTION This module collects information related to F directory. =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.' run EXPLORER:XPLRlib('var') #------------------------------------------------------------------------------ # XPLR_var section #------------------------------------------------------------------------------ section XPLR_var # Validate the execution context call log_run('Processing VAR sections ...') =head2 var - /var file and command collection Gathers /var related 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 =back Collects the following configuration files: =over 2 =item o F<${LOGDIR_LWACT}/${HOSTID}.lwact.xml> =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 Also collects the following log and diagnostic files: =over 2 =item o Last 1000 lines from F =item o Last 1000 lines from F =item o Last 10000 lines from F =item o Last 2000 lines from F =item o Last 2000 lines from F =item o Last 2000 lines from F =item o F =item o F =item o F (Oracle Solaris 11.2 and later) =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 =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 # Run reports debug ' Inside VAR collection, gathering /var related information' pretoc '2:/var' loop $rec (get_zones(false)) {if $loc = defined($nam = $rec->[0]) {var ($ttl,$pre,$exe) = (concat('From Zone ',$nam),\ concat('zones/',$nam),\ concat('/usr/sbin/zlogin ',$nam)) call log_info(concat('var: RUNNING: zone ',$nam),\ concat(' Inside VAR collection, collecting from ',$nam,' zone')) } else var ($ttl,$pre,$exe) = ('From Global Zone') var $top = $rec->[1] var $ver = $rec->[2] # Determine tha commands to execute if !$loc {var @cmd = (\ '---+ /var Related File Lists',\ ['var/ls-ld',\ '/usr/bin/ls','-ld /var',\ '---++ /var'],\ ['var/adm-ld',\ '/usr/bin/ls','-ld /var/adm',\ '---++ /var/adm'],\ ['var/cron/ls_-la_@var@spool@cron@crontabs',\ '/usr/bin/ls','-la /var/spool/cron/crontabs',\ '---++ /var/spool/cron/crontabs'],\ ['var/sadm-ld',\ '/usr/bin/ls','-ld /var/sadm',\ '---++ /var/sadm'],\ ['var/ntp',\ '/usr/bin/ls','-l /var/ntp',\ '---++ /var/ntp'],\ ['var/tmp-l',\ '/usr/bin/ls','-l /var/tmp',\ '---++ /var/tmp'],\ ['var/tmp-al',\ '/usr/bin/ls','-al /var/tmp',\ '---++ /var/tmp - with Hidden Files'],\ ['var/yp_binding_ls-l',\ '/usr/bin/ls','-l /var/yp/binding',\ '---++ /var/yp/binding']) if ?testFile('f','/var/cron/log') call push(@cmd,\ ['var/cron/log/ls_-l_@var@cron@log',\ '/usr/bin/ls','-l /var/cron/log',\ '---+ Crontab Log']) } else var @cmd = () # Determine the configuration files to collect if grepFile(catFile($top,'/etc/default/lwact'),'^LOGDIR=','f') var $wdr = value(last) else var $wdr = '/var/log' var ($hid) = grepCommand(join(' ',$exe,'/usr/bin/hostid'),'^[0-9a-fA-F]{8}$') var @cfg = (\ ['B','etc/krb5', '/etc/krb5',\ undef,undef,'^\.+$','drv'],\ ['B','var/krb5', '/var/krb5',\ undef,undef,'^\.+$','drv'],\ ['B',concat('var/lwact/',$hid,'.lwact.xml'),\ catFile($wdr,concat($hid,'.lwact.xml'))],\ ['B','var/yp/binding', '/var/yp/binding',\ undef,undef,'^\.+$','drv']) if !$loc {call push(@cfg,\ ['G','var/ep', '/var/ep',\ undef,undef,'^\.+$','drv'],\ ['G','var/ntp/ntp.drift', '/var/ntp/ntp.drift'],\ ['G','var/opt/sun/jet/config/host.config',\ '/var/opt/sun/jet/config/host.config'],\ ['G','var/CLUSTER', '/var/sadm/system/admin/CLUSTER'],\ ['G','var/psn', '/var/run/psn'],\ ['G','var/sse', '/var/sun/include',\ undef,undef,'^\.+$','drv']) # Get usernames for whom to collect crontab file loop $usr (@{MOD.VAR.T_CRON}) {next !?$usr = isUser($usr,true) call push(@cfg,\ ['G',concat('var/cron/',$usr),catFile('/var/spool/cron/crontabs',$usr)]) } } # Determine the log files to collect var @log = (\ ['B','var/opt/SUNWuce/agent/logs','/var/opt/SUNWuce/agent/logs',\ undef,undef,'^\.+$','drv'],\ ['B','var/sadm/install_data', '/var/sadm/install_data',\ undef,undef,'^\.+$','drv'],\ ['B','var/scn/update-agent/logs', '/var/scn/update-agent/logs',\ undef,undef,'^\.+$','drv'],\ ['B','var/svc/log', '/var/svc/log',\ undef,undef,'^\.+$','drv']) if compare('VALID',$ver,'5.11.2') call push(@log,\ ['B','var/log/ssm','/var/log/ssm',\ undef,undef,'^\.+$','drv']) if !$loc {call push(@log,\ {cmd=>'TAIL',nam=>'var/cpudiag/log/error.log.out',\ fil=>'/var/cpudiag/log/error.log',cnt=>'1000'},\ {cmd=>'TAIL',nam=>'var/cpudiag/log/info.log.out',\ fil=>'/var/cpudiag/log/info.log',cnt=>'1000'},\ {cmd=>'TAIL',nam=>'var/cron/log/tail_-10000_@var@cron@log.out',\ fil=>'/var/cron/log',cnt=>'10000'},\ {cmd=>'TAIL',\ nam=>'var/log/webconsole/console/tail_-2000_console_debug_log.out',\ fil=>'/var/log/webconsole/console/console_debug_log',cnt=>'2000'},\ {cmd=>'TAIL',nam=>'var/log/webconsole/tail_-2000_console_debug_log.out',\ fil=>'/var/log/webconsole/console_debug_log',cnt=>'2000'},\ {cmd=>'TAIL',nam=>'var/log/webconsole/tail_-2000_debug_se6130ui.log.out',\ fil=>'/var/log/webconsole/debug_se6130ui.log',cnt=>'2000'},\ ['G','var/cpudiag/data', '/var/cpudiag/data',\ undef,undef,'^bad_cpu_id.*','np'],\ ['G','var', '/var/log',\ undef,undef,'^install_stb-v.*\.log$','n'],\ ['G','var/log/sunfire', '/var/log/sunfire',\ undef,undef,'^\.+$','drv'],\ ['G','var/opt/sun/jet/jumpstart_install.log',\ '/var/opt/sun/jet/jumpstart_install.log'],\ ['G','var/contents', '/var/sadm/install/contents'],\ ['G','var/sadm/install/se6000', '/var/sadm/install/se6000',\ undef,undef,'^\.+$','drv'],\ ['G','var/INST_RELEASE', '/var/sadm/softinfo/INST_RELEASE'],\ ['G','var/sun/EIS-CD.log', '/var/sun/EIS-CD.log'],\ ['G','var/sun/GOLD-CD.log', '/var/sun/GOLD-CD.log'],\ ['G','var/sun/install-ORIG', '/var/sun/install-ORIG',\ undef,undef,'^\.+$','drv'],\ ['G','var/tmp/lu_history_log_file','/var/tmp/lu_history_log_file']) if ?testFile('f','/var/sunvts/logs/sunvts.info') call push(@log,\ ['G','var/sunvts.info.old', '/var/opt/SUNWvts/logs/sunvts.info'],\ ['G','var/sunvts.info', '/var/sunvts/logs/sunvts.info']) else call push(@log,\ ['G','var/sunvts.info', '/var/opt/SUNWvts/logs/sunvts.info']) # Add Security Toolkit log files if ?testDir('d','/var/opt/SUNWjass') {loop $sub (findDir('/var/opt/SUNWjass/run','^\.+$','nv')) {var $dir = catDir('/var/opt/SUNWjass/run',$tst) loop $fil ('jass-audit-log','jass-checksums','jass-install-log',\ 'jass-manifest','jass-script-list','jass-undo-log',\ 'jass-version') call push(@log,\ ['G',concat('var/jass/',$fil,'.',$sub,'.txt'),\ catFile($dir,concat($fil,'.txt'))]) } } } # Produce the report report concat('var_cfg_z_',nvl($nam,'global')) title '---+!! ',$ttl title $TOC call do_remote($pre,$exe,$top,@cmd) prefix {write '---+ Configuration Files' write $WRN write '|*File Path*| *Size*|*Last Modified Date*|' } call do_collect_rem($pre,$top,@cfg) if hasOutput(true) write $TOP prefix {write '---+ Log Files' write $WRN write '|*File Path*| *Size*|*Last Modified Date*|' } call do_collect_rem($pre,$top,@log) if hasOutput(true) write $TOP if isCreated(true) toc '3:[[',getFile(),'][rda_report][',$ttl,']]' } # Adjust the table of content unpretoc #------------------------------------------------------------------------------ # Input section #------------------------------------------------------------------------------ section input var @crn = () if ?${ENV.EXP_CRON_WHICH} {loop $usr (split(',',last)) {next !?$usr = isUser($usr,true) call push(@crn,$usr) } } else var @crn = ('adm','lp','root','sys','uucp') var ${RUN.EXPLORER.XPLR.VAR.T_CRON} = [@crn] var ${RUN.EXPLORER.B_USE_VAR} = true =head2 Zones =for zone begin var By default, collects information from the global zone only. When local zone collections are requested explicitly, collects the following configuration files from the selected local zones: =over 2 =item o F<${LOGDIR_LWACT}/${HOSTID}.lwact.xml> =item o F =item o F =item o F =back and the following log and diagnostic files from the selected local zones: =over 2 =item o F (Oracle Solaris 11.2 and later) =item o F =item o F =item o F =item o F =back =for zone end =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