# DCocfs.ctl:401:Collects Oracle Cluster File System Information # $Id: DCocfs.ctl,v 1.4 2013/12/18 14:13:37 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/DB/DCocfs.ctl,v 1.4 2013/12/18 14:13:37 RDA Exp $ # # Change History # 20131218 KRA Fix spell. =head1 NAME DB:DCocfs - Collects Oracle Cluster File System Information =head1 DESCRIPTION This module collects data that is related to the use of the Oracle Cluster File System and its configuration. The module is restricted to Linux and Windows environments currently. The following reports can be generated and are regrouped under C: =cut echo tput('bold'),'Processing DB.OCFS module ...',tput('off') # Initialization var $ORACLE_HOME = ${SET.RDA.BEGIN.D_ORACLE_HOME:''} var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' pretoc '^1:Cluster' pretoc '1+:OCFS' # Produce the reports if ${OS.linux} {# Get Linux information var $ROOT = match(id(),'^uid=0\(') =head1 FOR LINUX =head2 config_status - Configuration and Status Gets the OCFS package information, collects F and F, and determines the OCFS status. =cut debug ' Inside OCFS module, gathering configuration and status information' report config_status write '---+!! Oracle Cluster File System' write $TOC write '---+ OCFS Package Information' prefix write '' loop $lin (grepCommand('rpm -qa','ocfs')) write $lin if hasOutput(true) write '' else write 'OCFS is not installed%BR%' write $TOP prefix write '---+ /etc/ocfs.conf' call writeFile('/etc/ocfs.conf') if hasOutput(true) write $TOP loop $fil (grepDir('/etc/ocfs2','^cluster.conf','np')) {prefix write '---+ ',encode($fil) call writeFile($fil) if hasOutput(true) write $TOP } prefix write '---+ /etc/sysconfig/o2cb' call writeFile('/etc/sysconfig/o2cb') if hasOutput(true) write $TOP prefix write '---+ /etc/fstab' call writeFile('/etc/fstab') if hasOutput(true) write $TOP prefix write '---+ /etc/init.d/ocfs' if statFile('b','/etc/init.d/ocfs') {var $lin = replace(command('/etc/init.d/ocfs status'),\ '\033\[[\d;]+[A-Za-z]','',true) if $lin {write '' write $lin write '' } } if hasOutput(true) write $TOP prefix write '---+ /etc/init.d/o2cb' if statFile('b','/etc/init.d/o2cb') call writeCommand('/etc/init.d/o2cb status') if hasOutput(true) write $TOP toc '2:[[',getFile(),'][rda_report][Configuration and Status]]' # Get the IP addresses var %adr if loadFile('/etc/ocfs2/cluster.conf') {var ($flg,$nam,$adr) = (true) loop $lin (getLines()) {if match($lin,'^node:') var $flg = false elsif match($lin,'^\s+') {next $flg var $key = key($lin) if compare('eq',$key,'name') var $nam = value($lin) elsif compare('eq',$key,'ip_address') var $adr = value($lin) if ?$nam var $adr{$nam} = $adr } else var ($flg,$nam,$adr) = (true) } } =head2 ping - Ping Tests Performs ping tests to the nodes defined in F. =cut report ping debug ' Inside OCFS module, gathering ping information' title '---+!! Ping Tests' title $TOC var $cmd = 'ping -R -c 10 -s 1280 ' title concat('---## Pings done using: ',$cmd,'<machine>') loop $nam (keys(%adr)) {prefix write '---+ Ping ',$nam call writeCommand(concat($cmd,$nam)) if hasOutput() write $TOP } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Ping Tests]]' =for stopwords Tracepath =head2 tracepath - Tracepath Information Collects C to the nodes defined in F. =cut report tracepath debug ' Inside OCFS module, gathering tracepath information' var $cmd = 'tracepath ' title '---+!! Tracepath Information' title $TOC title concat('---## Using: ',$cmd,'<machine>') loop $nam (keys(%adr)) {prefix write '---+ Tracepath ',$nam call writeCommand(concat($cmd,$nam)) if hasOutput() write $TOP } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Tracepath Information]]' =head2 dns_lookup - DNS Lookup Information Collects DNS lookup information for the nodes defined in F. =cut report dns_lookup debug ' Inside OCFS module, gathering DNS Lookup information' var $cmd = 'host ' title '---+!! DNS Lookup Information' title $TOC title concat('---## Using: ',$cmd,'<machine>') loop $nam (keys(%adr)) {prefix write '---+ ',$nam call writeCommand(concat($cmd,$nam)) if hasOutput() write $TOP } if isCreated(true) toc '2:[[',getFile(),'][rda_report][DNS Lookup Information]]' =head2 rev_lookup - Reverse Lookup Information Collects reverse lookup information for the nodes defined in F. =cut report rev_lookup debug ' Inside OCFS module, gathering reverse lookup information' title '---+!! Reverse Lookup Information' title $TOC loop $adr (values(%adr)) {prefix write '---+ ',$adr call extern('Net','reverse_lookup',$adr) if hasOutput() write $TOP } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Reverse Lookup Information]]' =head2 logoptions - Logging Options Collects reverse lookup information for the nodes defined in F. =cut debug ' Inside OCFS module, gathering logging options' report logoptions var $dir = '/sys/o2cb/logmask' title '---+!! Logging Options' title '---## From ',$dir title '|*Option*|*Value*|' loop $fil (grepDir($dir,'^\.+$','npv')) {if grepFile($fil,'\boff\b','v') write '|',basename($fil),' |',join('%BR%',last),' |' } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Logging Options]]' =head2 drives - Drives Identifies all OCFS drives and provides a report on the space that is available on the drives. =cut report drives debug ' Inside OCFS module, gathering drive information' title '---+!! Oracle Cluster File System Drives' title $TOC loop $lin (grepCommand('/bin/mount','ocfs')) {var ($dev,undef,$nam) = split('\s+',$lin,4) var $dev{$nam} = $dev } if ?testFile('x','/usr/sbin/ocfsextfinder') {loop $nam (keys(%dev)) {var $cmd = concat('/usr/sbin/ocfsextfinder ',$dev{$nam},' 2>&1') prefix {write '---+ Space on ',$nam write '---## Using: ',$cmd } call writeCommand($cmd) if hasOutput(true) write $TOP } } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Drives]]' =head2 ocfs2_device - OCFS2 Device Information Gathers OCFS2 device information. =cut if $ROOT {report ocfs2_device debug ' Inside OCFS module, gathering OCFS2 device information' title '---+!! OCFS2 Device Information' title $TOC set $cmd {tunefs.ocfs2 -Q ' "Block size = %B "Cluster group = %P "Cluster size = %T "Compatibility = %M "Incompatibility = %H "Label = %V "Number of slots = %N "Read/Only = %O "Root directory = %R "System directory = %Y "UUID = %U "' :1 2>&1 } loop $nam (keys(%dev)) {prefix {write '---+ Device Information for ',$nam write '---## Using: tunefs.ocfs2 -Q' } call writeCommand(bind($cmd,$dev{$nam})) if hasOutput(true) write $TOP } if isCreated(true) toc '2:[[',getFile(),'][rda_report][OCFS2 Device Information]]' =head2 ocfs2_drives - OCFS2 Drives Lists OCFS2 drive information. =cut report ocfs2_drives debug ' Inside OCFS module, gathering OCFS2 drive information' var $cmd = 'mounted.ocfs2 -d' prefix {write '---+ OCFS2 Drives' write '---## Using: ',$cmd } if loadCommand($cmd) {call writeLastFile() loop $lin (getLines()) {var $dev = field('\s+',0,$lin) call push(@dev,$dev) } } if hasOutput(true) {write $TOP toc '2:[[',getFile(),'][rda_report][OCFS2 Drives]]' } =head2 ocfs2_stats - OCFS2 Drive Statistics Lists OCFS2 drive statistics information. =cut report ocfs2_stats debug ' Inside OCFS module, gathering OCFS2 drive statistics information' var $pgm = 'debugfs.ocfs2 -R stats ' title '---+!! OCFS2 Drive Statistics' title $TOC loop $dev (@dev) {var $cmd = concat($pgm,$dev) prefix {write '---++ Drive Statistics for ',$dev write '---++!! Using: ',$cmd } call writeCommand($cmd) if hasOutput(true) write $TOP } if isCreated(true) toc '2:[[',getFile(),'][rda_report][OCFS2 Drive Statistics]]' =head2 all_ocfs2_drives - All OCFS2 Drives Lists information about all OCFS2 drives. =cut report all_ocfs2_drives debug ' Inside OCFS module, gathering information on all OCFS2 drives' var $cmd = 'mounted.ocfs2 -f' prefix {write '---+ All OCFS2 Drives' write '---## Using: ',$cmd } call writeCommand($cmd) if hasOutput(true) {write $TOP toc '2:[[',getFile(),'][rda_report][All OCFS2 Drives]]' } } =head2 messages - Error Messages Extracts all OCFS messages from the error log. =cut debug ' Inside OCFS module, extracting error messages' report messages prefix {write '---+!! Oracle Cluster File System Error Messages' write '---## Using: dmesg | grep ocfs' write '' } loop $lin (grepCommand('dmesg','ocfs')) write $lin if isCreated(true) {write '' toc '2:[[',getFile(),'][rda_report][Error Messages]]' } } =head1 FOR WINDOWS =head2 windrive - Windows Driver Information Gets the information about OCFS drivers. =cut elsif or(isWindows(),isCygwin()) {debug ' Inside OCFS module, getting Windows driver information' report windriver prefix {write '---+!! Windows Driver Information' write $TOC } if getEnv('SYSTEMROOT') var $sys = last else var ($sys) = command('echo %SystemRoot%') if ?testFile('f',catFile($sys,'system32','drivers','ocfs.sys')) {write '---+ ocfs.sys Driver Information' call statFile('p',lastFile()) } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Windows Driver Information]]' } # Disable the group title in next index if isTocCreated(true) toc '-:Cluster' =begin credits =over 10 =item RDA 4.0: Bernhard Cock Buning, Luc Dens. =item RDA 4.6: Guido Tijskens. =item RDA 4.16: Jaime Alcoreza, Hagen Herbst, Scott Jesse, Rick Pulliam, Sanjay Singh. =item RDA 4.18: Jaime Alcoreza. =item RDA 4.23: Herbert van den Bergh, Srinivas Eeda. =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