# TLsos.def: Collects siga/sosreport/sysreport Report # $Id: TLsos.def,v 1.5 2009/08/06 09:13:00 mschenke Exp $ # ARCS: $Header: /u02/webapps/workbench/cvs/RDA_4/src/scripting/lib/modules/TLsos.def,v 1.5 2009/08/06 09:13:00 mschenke Exp $ # # Change History # 20090706 DEM Add siga collection. =head1 NAME TLsos - Collects siga/sosreport/sysreport Report. =head1 DESCRIPTION This tool executes F/F/F on Linux systems. The tool can be executed only as root user. It collects the information and changes the owner of generated report to the owner of report directory. If you execute this tool before any RDA collection, it creates the output directory with the permissions of the root user. It removes the reports older than 15 days from the output directory. The command execution can display some prompts. Ignore them. =head1 USAGE -T sos =cut echo tput('bold'),'Processing SOS tool ...',tput('off') # Initialisation var $RPT_GROUP = getSetting('RPT_GROUP','RDA') var $RPT_DIRECTORY = catDir(getSetting('RPT_DIRECTORY','output')) if !match(getOsName(),'linux') {echo 'This tool is specific to Linux systems.' return } if !match(id(),'^uid=0\(') {echo 'This tool can be run only as root user.' return } # Create the output directory if it does not exist and purge old reports call purge('O','SOS_',15,0,true) # Execute the relevant command if testFile('x','/usr/sbin/sosreport') {debug ' Inside OS module, gathering sosreport information' var $rpt = 'sosreport' var $tmp = newTemp('sos','.txt') if setDebug() {echo 'The tool execution is done in debug mode.' echo tput('bold'),'Ignore any message to input any data.',tput('off') echo 'The output file will be transferred to the RDA output directory.' sleep 5 output P,concat('/usr/sbin/sosreport -k rpm.rpmva=off 2>&1 | tee ',\ quote($tmp,'x')) } else output P,concat('/usr/sbin/sosreport -k rpm.rpmva=off >',quote($tmp,'x'),\ ' 2>&1') write '' write $rpt write '1' close call loadFile($tmp) var $flg = false loop $lin (getLines()) {if $flg {var $fil = trim($lin) break } var $flg = match($lin,'^Your sosreport has been generated and saved in:$') } } elsif testFile('x','/usr/sbin/sysreport') {debug ' Inside OS module, gathering sysreport information' var $rpt = 'sysreport' var $tmp = newTemp('sos','.txt') if setDebug() {echo 'The tool execution is done in debug mode.' echo tput('bold'),'Ignore any message to input any data.',tput('off') echo 'The output file will be transferred to the RDA output directory.' sleep 5 output P,concat('/usr/sbin/sysreport -norpm 2>&1 | tee ',quote($tmp,'x')) } else output P,concat('/usr/sbin/sysreport -norpm >',quote($tmp,'x'),' 2>&1') write '' write $rpt close var ($lin) = grepFile($tmp,'^(Please send.*to your support|Please mail.*to)',\ 'f') if match($lin,'^Please send\s*(.*?)\s*to your support') var ($fil) = last elsif match($lin,'^Please mail\s*(.*?)\s*to') var ($fil) = last } elsif testFile('x','/usr/bin/siga') {debug ' Inside OS module, gathering siga information' var $tmp = newTemp('sos','.txt') var $rpt = 'siga' if setDebug() {echo 'The tool execution is done in debug mode.' echo 'The output file will be transferred to the RDA output directory.' sleep 5 call command(concat('/usr/bin/siga no 2>&1 | tee ',quote($tmp,'x'))) } else call command(concat('/usr/bin/siga no >',quote($tmp,'x'),' 2>&1')) call loadFile($tmp) var $flg = false loop $lin (getLines()) {if $flg {var $fil = trim($lin) if testFile('r',$fil) break } else var $flg = match($lin,'^ You will find the output here:') } } else {echo 'RDA did not find /usr/sbin/sosreport, /usr/sbin/sysreport, or \ /usr/bin/siga.' return } call unlinkTemp('sos') # Transfer the result file to the report directory var $src = basename($fil) var (undef,$suf) = split('\.',$src,2) var $dst = concat($RPT_GROUP,'_SOS_',$rpt,'.',$suf) if transfer(dirname($fil),$src,$RPT_DIRECTORY,$dst) {var $own = getOwner($RPT_DIRECTORY) if compare('eq',$own,'0') echo 'The owner of the output directory is root. Modify the owner of that \ directory if you do not plan to make the subsequent RDA executions \ as root user.' else call command(concat('chown ',$own,' ',catFile($RPT_DIRECTORY,$dst))) } =begin credits =over 10 =item RDA 4.16: Shinya Narahara, Takeshi Watanabe. =item RDA 4.17: Shinya Narahara. =back =end credits =head1 COPYRIGHT NOTICE Copyright (c) 2002-2009, Oracle. All rights reserved. =head1 TRADEMARK NOTICE Oracle, JD Edwards, PeopleSoft, and Siebel are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. =cut