# DCmycl.ctl:239:Collects Oracle MySQL Cluster Information # $Id: DCmycl.ctl,v 1.7 2014/09/27 13:57:36 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/DB/DCmycl.ctl,v 1.7 2014/09/27 13:57:36 RDA Exp $ # # Change History # 20140926 MSC Rename parseFile in parsePath. =head1 NAME DB:DCmycl - Collects Oracle MySQL Cluster Information =head1 DESCRIPTION This module collects the Oracle MySQL cluster-related information. F can prompt you for a password to connect to each node. Therefore, RDA waits per default a few seconds before starting the data collection on the next node. The data collection can take up to 5 minutes with the default timeout value. The following reports can be generated and are regrouped under C: =head1 REPORTS =cut use Buffer,Remote echo tput('bold'),'Processing DB.MYCL module ...',tput('off') # Initialization var $CONFIG = ${F_CONFIG:''} var $PAUSE = ${N_WAIT_PWD:3} var $RECURSIVE = ${B_FILE_SYSTEM:false} var $TIMEOUT = ${DFT.N_TIMEOUT:0} var $USERID = nvl(isUser(${T_LOGIN},true),'') var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' pretoc '1:Oracle MySQL Cluster' # Load the common macros run RDA:library() =head2 Configuration Files Gathers Oracle MySQL cluster-related configuration files. =cut debug ' Inside MYCL module, collecting the configuration files' pretoc '2:Configuration Files' var ($dir,$bas) = parsePath(catDir($CONFIG)) call cat_report($dir,$bas,'log_','^(\s*password\s*=).*$','%R:PASSWORD%') unpretoc =head2 File System Files Gathers files from the data node file systems, when requested. =cut if or(isUnix(),isCygwin()) {# Define parsing macros macro set_done {var ($buf,$nod) = @arg import %acc keep %acc var $acc{$nod} = '|Collection Completed| ' } # Define the collection code set $cod {if [ "$RECURSIVE" -eq 0 ] "then " pgm="find $DATADIR/ndb_${NODE}* -maxdepth 1 -type f -print" "else " pgm="find $DATADIR/ndb_${NODE}* -type f -print" "fi "echo "---# RDA:BEGIN SECTION:3:${NODE} Node" "for fil in `$pgm` "do " echo "---# RDA:BEGIN" " cat "$fil" " echo "---# RDA:END FILE:$fil" "done "echo "---# RDA:END SECTION:4" "echo "---# RDA:BEGIN" "echo "Collection Ended" "echo "---# RDA:END MACRO set_done:${NODE}" " } debug ' Inside MYCL module, collecting the file system files' pretoc '2:File System Files' if ?testFile('fx','/bin/ndb_config') var $pgm = '/bin/ndb_config' elsif ?findCommand('ndb_config') var $pgm = last else var $pgm = undef if ?$pgm {var (@nod,%nod) = () if first(command(concat($pgm,' --config-file=',quote($CONFIG),\ ' --nodes --query=id --type=ndbd'))) call push(@nod,split('\s+',last)) if first(command(concat($pgm,' --config-file=',quote($CONFIG),\ ' --nodes --query=id --type=ndb_mgmd'))) call push(@nod,split('\s+',last)) # Macro to get the parameter value macro get_param {var ($cmd,$cfg,$nod,$qry) = @arg return first(command(concat($cmd,' --config-file=',quote($cfg),\ ' --id=',$nod,' --query=',$qry))) } # Determine with fully qualified host name and datadir directory var ($cnt,$pwd,%acc,%buf,%slp,%tim,%tmp) = (0) loop $nod (@nod) {var $hst = nvl(get_param($pgm,$CONFIG,$nod,'host'),\ join(".",$nod,${RDA.T_DOMAIN})) call addRemoteSession('MYCL',$hst,$USERID) if and(defined($pwd),not(hasPassword('host',$hst,$USERID))) call setPassword('host',$hst,$USERID,$pwd) if needPassword('MYCL') {var $pwd = askPassword(concat('Enter ',$USERID,'@',$hst,' password:')) call setPassword('host',$hst,$USERID,$pwd) if needPassword('MYCL') {var $acc{$hst} = '|Skipped due to connection problems| ' var $tim{$hst} = 0 call endRemoteSession('MYCL') next } } var $slp{$hst} = cond(needPause('MYCL'),$PAUSE,1) call endRemoteSession('MYCL') var $nod{$hst} = [$nod,get_param($pgm,$CONFIG,$nod,'datadir')] } # Collect node specific information using remote session $sta = ${STA.${CUR.K_NAME}.NODE/i}->clear call $[REM]->set_timeout($dur = expr('*',10,$TIMEOUT)) loop $nod (@nod = keys(%nod)) {var $acc{$nod} = '|Collection Incomplete| ' var $tim{$nod} = 0 var $tmp{$nod} = concat('R_EXIT',incr($cnt)) thread($cod,$nod,$sta,$tmp{$nod},$buf{$nod} = getTemp($tmp{$nod})) {var ($cod,$nod,$sta,$key,$res) = @arg import $RECURSIVE,$USERID debug ' - Getting node information from ',$nod call addRemoteSession('MYCL',$nod,$USERID) var $ret = rcollect('MYCL',$cod,$res,\ {NODE => $nod{$nod}->[0],\ DATADIR => $nod{$nod}->[1],\ RECURSIVE => $RECURSIVE\ }) if !hasRemoteTimeout('MYCL') call $sta->set_value($key,$ret,'Remote collection exit code') call endRemoteSession('MYCL') debug ' - Data collection ended for ',$nod } sleep $slp{$nod} } sleep 2 echo 'The remote node data collection can take more than ',$dur,\ ' seconds. Do not interrupt the data collection.' wait $dur # Generate the node reports loop $nod (@nod) {if $sta->get_first($tmp{$nod}) var $acc{$nod} = concat('|Connection error (',last,')| ') else {call writeRemoteResult($buf = new('Buffer','R',$buf{$nod}),$nod) call $buf->close } call unlinkTemp($tmp{$nod}) } =head2 summary - Node Collection Summary Displays the node list and their accessibility. =cut debug ' Inside MYCL module, producing the node collection summary' report summary prefix {write '---+ Node Collection Summary' write '|*Node*|*Collection Status*| *Execution Timeout*|' } loop $key (keys(%acc)) write '|',$key,$acc{$key},$tim{$key},'|' if isCreated(true) toc '2:[[',getFile(),'][rda_report][Node Collection Summary]]' else echo 'No nodes found' } unpretoc } unpretoc =head1 SEE ALSO L =begin credits =over 10 =item RDA 4.27: Rajesh Sivaramasubramaniom. =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