# RClinux.ctl: Linux Specific Multi-run Collection Code # $Id: RClinux.ctl,v 1.9 2015/10/07 21:02:45 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/OS/RClinux.ctl,v 1.9 2015/10/07 21:02:45 RDA Exp $ # # Change History # 20151006 KRA Add 'OS_collectl_logs' section. =head1 NAME OS:RClinux - Submodule Specific to the Linux Operating System =cut use Mrc # Make the module persistent var @COMMON_SECTIONS = ('NET_ifconfig','OS_system_error_log') var @ROOT_SECTIONS = ('NET_net_summary',\ 'OS_collectl_logs','OS_dmsetup','OS_multipath') keep $KEEP_BLOCK,@COMMON_SECTIONS,@ROOT_SECTIONS # Initialization import $TOC,$TOP keep $TOC,$TOP section begin # Load the common macros run RDA:library() =head1 CONTRIBUTION TO THE OS.NET MODULE =head2 ifconfig - Interface Configuration Gets the network interface configuration. =cut section NET_ifconfig debug ' Inside NET module, getting network interface configuration (linux)' report ifconfig title '---+!! Interface Configuration' title $TOC if ?testFile('x','/sbin/ifconfig') {prefix { write '---+ Interface Configuration - ifconfig' write '---## Using: ifconfig -a' call addBlock('X','O','OS.NET/ifconfig_-a.out') } call writeCommand('/sbin/ifconfig -a') if hasOutput(true) write $TOP } if ?testFile('x','/sbin/ip') {prefix {write '---+ Interface Configuration - ip' write '---## Using: ip address' call addBlock('X','O','OS.NET/ip_address.out') } call writeCommand('/sbin/ip address') if hasOutput(true) write $TOP } if isCreated(true) {call validate(true) toc '2:[[',getFile(),'][rda_report][Interface Configuration]]' } =head2 net_summary - Network Device Summary Gets the network device summary information. =cut section NET_net_summary debug ' Inside NET module, getting network device summary information' var @eth = () loop $lin (grepCommand('/sbin/ifconfig -a','eth')) call push(@eth,field('\s+',0,$lin)) if @eth {# Macro to get ethernet devices settings macro get_eth {var ($nam,\@eth) = @arg import $TOP keep $TOP loop $eth (@eth) {var $cmd = concat($nam,' ',quote($eth)) prefix {write '---++ Using: ',encode($cmd) call addBlock('X','O',concat('OS.NET/ifconfig_-a_',$eth,'.out')) } call writeCommand($cmd) if hasOutput(true) write $TOP } } # Produce the report report net_summary title '---+!! Network Device Summary Information' title $TOC call get_eth('/usr/sbin/ethtool',\@eth) call get_eth('/usr/sbin/ethtool -S',\@eth) if isCreated() {call validate(true) toc '2:[[',getFile(),'][rda_report][Network Device Summary]]' } } =head1 CONTRIBUTION TO THE OS.OS MODULE =head2 system_error_log - System Error Log Collects system error log data. =cut section OS_system_error_log report system_error_log write '---+!! System Error Log Data' write $TOC write '---+ Using: dmesg | tail -1000' call loadCommand('/bin/dmesg 2>&1',true,1,-1000) call addBlock('X','D','OS.OS/dmesg_tail') call writeLastFile() write $TOP write '---+ Contents of System Log File' output => d,'system.log' if ?$fil = testFile('fr','/var/log/messages') {if $lim = ${N_TAIL} write ' * Last ',$lim,' log file lines collected' 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 Name*| *Size*|*Last Modified Date*|' call addBlock('X','D','OS.OS/files/var/log/messages') if $lim call ${CUR.O_LAST}->write_tail($fil,$lim) else call ${CUR.O_LAST}->write_data($fil) write '|[[',${CUR.O_LAST}->get_raw(true),'][_blank][',encode($fil),']]| ',\ getSize($fil),'|',getLastModify($fil,''),' |' } elsif ?testFile('e',$fil) {write 'Unable to read ',encode($fil),'%BR%\ May be file permission problem.%BR%\ Permissions are:%BR%' call statFile('b',$fil) write 'User: ',id(),'%BR%' } else write $fil,' does not exist%BR%' write $TOP end ${CUR.O_LAST} if isCreated(true) {call validate(true) toc '2:[[',getFile(),'][rda_report][System Error Log]]' } =head2 dmsetup - Low Level Logic Volume Gets low level logic volume information. =cut section OS_dmsetup report dmsetup var $cmd = '/sbin/dmsetup -v table' write '---+ Low Level Logic Volume' write '---## Using: ',$cmd call addBlock('X','O','OS.OS/dmsetup_-v_table.out') call writeCommand($cmd) write $TOP if isCreated(true) {call validate(true) toc '2:[[',getFile(),'][rda_report][Low Level Logic Volume]]' } =head2 multipath - Multipath Topology Gets multipath topology from all available information. =cut section OS_multipath report multipath var $cmd = '/sbin/multipath -v2 -ll' write '---+ Multipath Topology' write '---## Using: ',$cmd call addBlock('X','O','OS.OS/multipath_-v2_-ll.out') call writeCommand($cmd) write $TOP if isCreated(true) {call validate(true) toc '2:[[',getFile(),'][rda_report][Multipath Topology]]' } =for stopwords Collectl =head2 Collectl Log Files Collects the content of the D directory structure. =cut section OS_collectl_logs pretoc '2:Collectl Log Files' if grepDir('/var/log/collectl','^\.+$','drv') {call sort_files(3,0,last) call validate(true) } unpretoc =begin credits =over 10 =item RDA 4.25: Jaime Alcoreza. =item RDA 4.29: Pierre Lecomte. =item RDA 8.01: Pierre Lecomte. =item RDA 8.10: Suresh Kumar. =back =end credits =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