# MCmsg.ctl:296:Collects Messages # $Id: MCmsg.ctl,v 1.5 2014/10/15 17:03:50 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/EXPLORER/MCmsg.ctl,v 1.5 2014/10/15 17:03:50 RDA Exp $ # # Change History # 20141015 LDE Improve portability. =head1 NAME EXPLORER:MCmsg - Collects Messages =head1 DESCRIPTION This module collects messages from the 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]]' run EXPLORER:XPLRlib('messages') #------------------------------------------------------------------------------ # XPLR_messages section #------------------------------------------------------------------------------ section XPLR_messages # Validate the execution context call log_run('Processing MSG sections ...') =head2 messages - Messages from /var/adm (Solaris) or from /var/log (Linux) Gathers messages information using the following commands: =over 2 =item o C =back Also collects the following system log files: =over 2 =item o F =item o F =back =cut pretoc '2:Messages' # Determine the collection period if ${B_INCR_MODE} {var ($beg,$end) = (${STA.EXPLORER.XPLR.MSG.G_LAST_INCR},time()) if !?$beg var $beg = expr('-',$end,7776000) # 90 * 86400 } else var ($beg,$end) = () # Perform the collections 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('messages: RUNNING: zone ',$nam),\ concat(' Inside MSG collection, collecting from zone ',$nam)) } else var ($ttl,$pre,$exe) = ('From Global Zone') var $top = $rec->[1] report concat('msg_z_',nvl($nam,'global')) title '---+!! ',$ttl title $TOC # Collect commands call do_remote($pre,$exe,$top,\ ['messages/dmesg',\ ${CMD.DMESG:'dmesg'},undef,\ '---+ System Error Log Data']) # Collect files prefix {write '---+ System Log Files' 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 ' * 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 '|*File Path*| *Size*|*Last Modified Date*|' } var ($dir,@fil) = (cond(${OS.solaris},'/var/adm','/var/log')) loop $fil (get_modified_files($beg,$end,catDir($top,$dir),\ '^messages(\.\d)?$')) call push(@fil,['B',concat('messages/',$fil),catFile($dir,$fil)]) call do_collect_rem($pre,$top,@fil) if hasOutput(true) write $TOP # Add the report to the table of contents if isCreated(true) toc '3:[[',getFile(),'][rda_report][',$ttl,']]' } # Store the new time stamp if ?$end var ${STA.EXPLORER.XPLR.MSG.G_LAST_INCR:'Last incremental collection'} = $end unpretoc 2 =head2 Zones =for zone begin messages By default, collects information from the global zone only. When local zone collections are requested explicitly, collects messages information from the selected local zones using the following commands: =over 2 =item o C =back and collects the following system log files from the selected local zones: =over 2 =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