# S211EXA.def: Collects Exadata Information # $Id: S211EXA.def,v 1.4 2009/08/06 06:05:59 mschenke Exp $ # ARCS: $Header: /u02/webapps/workbench/cvs/RDA_4/src/scripting/lib/modules/S211EXA.def,v 1.4 2009/08/06 06:05:59 mschenke Exp $ # # Change History # 20090806 DEM Improve documentation. =head1 NAME S211EXA - Collects Exadata Information =head1 DESCRIPTION This module collects the Exadata-related diagnostic information. It requires that a F authentication agent is configured. Otherwise, you will have to provide the password multiple times. The following reports can be generated and are regrouped under C: =cut echo tput('bold'),'Processing Exadata module ...',tput('off') # Initialization var $ALERT_TAIL = getSetting('EXA_ALERT_TAIL',3000) var $COLLECT_CELL = getSetting('EXA_COLLECT_CELL',true) var $TIMEOUT = getSetting('RDA_TIMEOUT',0) var $TRACE_TAIL = getSetting('EXA_TRACE_TAIL',1000) var $USERID = getSetting('EXA_LOGIN','celladmin') var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' pretoc '^1:RDBMS' pretoc '1+:Exadata' # Validate the settings if !match($ALERT_TAIL,'^\d+$') var $ALERT_TAIL = 3000 if !match($TRACE_TAIL,'^\d+$') var $TRACE_TAIL = 1000 # Load the common macros run DBinfo() run library() =head2 no_db_access - No Database Access Reports database access issue. =cut if testSql() {report no_db_access write 'Cannot connect to the database ',' (',getSqlMessage(),')' toc '2:[[',getFile(),'][rda_report][No Database Access]]' } # Get database version var $ver = get_db_version() =head2 dbinfo - Database Information Gets Exadata Database information (available for Oracle Database 11g and later). =cut report dbinfo var $TTL = '---+!! Database Information' if match($ver,'^11') {debug ' Inside Exadata module, gathering Database information' var @TTL = ('',\ '---+ Database Instance Parameters Relative to Exadata',\ '---+ Exadata Cells Statistics',\ '---+ Data Sent Back to Host After Smart Scan',\ '---+ Filtering Efficiency',\ '---+ Tablespaces Storage Option',\ '---+ V$Cell',\ '---+ V$Cell_State',\ '---+ V$Cell_Thread_History',\ '---+ V$Cell_Request_Totals') var @HDR = ('',\ '|*Name*|*Value*|',\ '|*Name*|*Value*|',\ '| *Size*|',\ '| *Efficiency*|',\ '|*Tablespace Name*|*Predicate Evaluation*|') set $sql {SELECT '|' || " name || ' |' || " value|| ' |' " FROM v$parameter " WHERE UPPER(name) LIKE 'CELL_%'; "PROMPT ___Macro_separator(2)___ "SELECT '|' || " name || ' |' || " value || ' |' " FROM v$sysstat " WHERE UPPER(name) LIKE 'CELL%'; "PROMPT ___Macro_separator(3)___ "SELECT '| ' || " (a.value-(b.value-c.value)) || '|' " FROM v$sysstat a,v$sysstat b,v$sysstat c " WHERE a.name = 'cell physical IO interconnect bytes' " AND b.name = 'physical IO disk bytes' " AND c.name = 'cell physical IO bytes eligible for predicate offload'; "PROMPT ___Macro_separator(4)___ "SELECT '| ' || " DECODE(c.value,0,'Not calculated', " (a.value-(b.value-c.value)) / c.value) || '|' " FROM v$sysstat a,v$sysstat b,v$sysstat c " WHERE a.name = 'cell physical IO interconnect bytes' " AND b.name = 'physical IO disk bytes' " AND c.name = 'cell physical IO bytes eligible for predicate offload'; "PROMPT ___Macro_separator(5)___ "SELECT '|' || " tablespace_name || ' |' || " predicate_evaluation || ' |' " FROM dba_tablespaces " WHERE predicate_evaluation = 'STORAGE'; } var ($HDR[6],$col6) = getSqlColumns('RDA','','V$CELL') call clearSqlColumns('RDA') if $col6 {append $sql {PROMPT ___Macro_separator(6)___ "SELECT :1 " FROM v$cell; } } var ($HDR[7],$col7) = getSqlColumns('RDA','','V$CELL_STATE') call clearSqlColumns('RDA') if $col7 {append $sql {PROMPT ___Macro_separator(7)___ "SELECT :2 " FROM v$cell_state; } } var ($HDR[8],$col8) = getSqlColumns('RDA','','V$CELL_THREAD_HISTORY') call clearSqlColumns('RDA') if $col8 {append $sql {PROMPT ___Macro_separator(8)___ "SELECT :3 " FROM (SELECT * " FROM v$cell_thread_history " WHERE snapshot_time > SYSDATE - 1 " ORDER BY snapshot_time DESC) " WHERE ROWNUM < 1000; } } var ($HDR[9],$col9) = getSqlColumns('RDA','','V$CELL_REQUEST_TOTALS') call clearSqlColumns('RDA') if $col9 {append $sql {PROMPT ___Macro_separator(9)___ "SELECT :4 " FROM (SELECT * " FROM v$cell_request_totals " WHERE snapshot_time > SYSDATE - 1 " ORDER BY snapshot_time DESC) " WHERE ROWNUM < 1000; } } call separator(1) call writeSql(bindSql($sql,$col6,$col7,$col8,$col9)) call separator(0,'Database Information') } =head2 Configuration Files Gathers configuration files in the following directory structure: =over 4 =item o F =back =cut debug ' Inside Exadata module, collecting the configuration files' pretoc '2:Configuration Files' call sort_files(3,undef,\ grepDir('/etc/oracle/cell/network-config','^\.+$','vr')) unpretoc # Determine accessible cell if !$COLLECT_CELL {# Disable the group title in next index if isTocCreated() toc '-:RDBMS' return } debug ' Inside Exadata module, checking the connectivity to the remote cells' if !loadFile('/etc/oracle/cell/network-config/cellip.ora') {echo 'Unable to get the cell information' # Disable the group title in next index if isTocCreated() toc '-:RDBMS' return } call setTempSetting('REMOTE_EXA_USER',$USERID) call setTempSetting('REMOTE_EXA_SSH_COMMAND','ssh') call setTempSetting('REMOTE_EXA_SSH_OPTIONS','-Cnq -o ConnectTimeout=30') var ($cel,%acc,%err) = () loop $lin (grepLastFile('^cell=\".*?\"')) {if match($lin,'^cell=\"(.*?)\"') {var ($cel) = last debug ' - Trying to connect to ',$cel call setTempSetting('REMOTE_EXA_HOSTNAME',$cel) if rexec('EXA','env',true) var $acc{$cel} = concat('|Connection error (',last,')| ') else {var $acc{$cel} = '|Successful connection| ' var @cel = (@cel,$cel) } } } if !?$cel {echo 'No cells found' # Disable the group title in next index if isTocCreated() toc '-:RDBMS' return } =head2 celldet - Cell Detail Gets the C information. =head2 celldisk - Celldisk Detail Gets the C information. =head2 griddisk - Griddisk Detail Gets the C information. =head2 iormplan - Iormplan Detail Gets the C information. =head2 metdef - Metricdefinition Detail Gets the C information. =head2 metcurd - Metriccurrent Detail Gets the C information. =head2 methist - Metrichistory Detail Gets the C information. =head2 phydisk - Physicaldisk Detail Gets the C information. =head2 threshold - Threshold Detail Gets the C information. =cut if @cel {var %tb_cmd = (\ 'celldet', 'cellcli -e list cell detail',\ 'celldisk', 'cellcli -e list celldisk detail',\ 'griddisk', 'cellcli -e list griddisk detail',\ 'iormplan', 'cellcli -e list iormplan detail',\ 'metdef', 'cellcli -e list metricdefinition detail',\ 'metcurd', 'cellcli -e list metriccurrent detail',\ 'methist', 'cellcli -e list metrichistory detail | tail -500',\ 'phydisk', 'cellcli -e list physicaldisk detail',\ 'threshold','cellcli -e list threshold detail') var %tb_ttl = (\ 'celldet', 'Cell Detail',\ 'celldisk', 'Celldisk Detail',\ 'griddisk', 'Griddisk Detail',\ 'iormplan', 'Iormplan Detail',\ 'metdef', 'Metricdefinition Detail',\ 'metcurd', 'Metriccurrent Detail',\ 'methist', 'Metrichistory Detail',\ 'phydisk', 'Physicaldisk Detail',\ 'threshold','Threshold Detail') # Define the reporting macro macro gen_report {var ($rpt,$ttl,$cmd,\@cel,\%tmp,\%err) = @arg report $rpt prefix {write '---+ ',$ttl write '---## Using: ssh ',$cmd write '|*Cell*|*Name*|*Value*|' } loop $cel (@cel) {var $fil = getTemp($tmp{$cel}) if getSize($fil) call writeData($fil) else incr $err{$cel} call unlinkTemp($tmp{$cel}) } if isCreated(true) toc '2:[[',getFile(),'][rda_report][',$ttl,']]' } # Use threads to execute the commands var ($prv,%prv) = () loop $key (keys(%tb_cmd)) {# Launch a command on each accessible cells var ($cmd,%key) = ($tb_cmd{$key}) loop $cel (@cel) {var $key{$cel} = concat($key,'_',$cel) call createTemp($key{$cel}) thread {debug ' Inside Exadata module, getting "',$tb_ttl{$key},'" from ',$cel call setTempSetting('REMOTE_EXA_HOSTNAME',$cel) if !rexec('EXA',$cmd,true) {loop $lin (getRemoteLines()) {if match($lin,'\S') call writeTemp($key{$cel},\ '|',$cel,' |',replace(trim($lin),':\s+',' |'),' |') } } } } # Report information from the previous command if $prv call gen_report($prv,$tb_ttl{$prv},$tb_cmd{$prv},\@cel,\%prv,\%err) var ($prv,%prv) = ($key,%key) # Wait the previous thread completion wait $TIMEOUT } # Generate the last report if $prv call gen_report($prv,$tb_ttl{$prv},$tb_cmd{$prv},\@cel,\%prv,\%err) } =head2 cellinit - cellinit.ora Collect cellinit.ora file from the cells. =cut var $nod = 0 loop $cel (@cel) {incr $nod pretoc '2:',$cel,' Information' call setTempSetting('REMOTE_EXA_HOSTNAME',$cel) debug ' Inside Exadata module, getting cellinit.ora from ',$cel var $cmd = 'cat /opt/oracle/cell/cellsrv/deploy/config/cellinit.ora' if rexec('EXA',$cmd,true) incr $err{$cel} else {report concat('cellinit_',$nod) prefix {write '---+ Information from cellinit.ora' write '---## Using: ssh ',$cmd write '' } loop $lin (getRemoteLines()) write $lin if isCreated(true) {write '' toc '3:[[',getFile(),'][rda_report][cellinit.ora]]' } } =head2 alert - alert.log Collects alert.log from the cells. =cut debug ' Inside Exadata module, getting alert.log from ',$cel var $cmd = 'ls -rt /opt/oracle/cell/log/diag/asm/cell' if rexec('EXA',$cmd,true) incr $err{$cel} else {var $cnt = 0 loop $dir (getRemoteLines()) {incr $cnt var $dir = catDir('/opt/oracle/cell/log/diag/asm/cell',$dir,'trace') pretoc '3:',$dir var $cmd = concat('cat ',catFile($dir,'alert.log'),' | tail -',$ALERT_TAIL) if rexec('EXA',$cmd,true) incr $err{$cel} else {report concat('alert_',$nod,'_',$cnt) prefix {write '---+ Information from alert.log' write '---## Using: ssh ',$cmd write '' } loop $lin (getRemoteLines()) write $lin if isCreated(true) {write '' toc '4:[[',getFile(),'][rda_report][alert.log]]' } } =head2 tracelist - Trace File List Collects the list of trace files. =cut debug ' Inside Exadata module, getting list of trace files from ',$cel var $cmd = concat('ls -alrt ',$dir) if rexec('EXA',$cmd,true) incr $err{$cel} else {report concat('tracelist_',$nod,'_',$cnt) prefix {write '---+ Trace File List' write '' } loop $lin (getRemoteLines()) write $lin if isCreated(true) {write '' toc '4:[[',getFile(),'][rda_report][Trace File List]]' } } =head2 tracefiles - Latest Trace Files Collects the last lines of trace files. =cut debug ' Inside Exadata module, getting latest trace files from ',$cel var $cmd = concat('ls -rt ',$dir,'| grep -v alert.log | tail -10') if rexec('EXA',$cmd,true) incr $err{$cel} else {report concat('tracefiles_',$nod,'_',$cnt) prefix {write '---+ Latest Trace Files from ',$dir write '---## Last ',$TRACE_TAIL,' lines of trace files 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 '|*Trace File Name*|' } loop $fil (getRemoteLines()) {var $cmd = concat('cat ',catFile($dir,$fil),' | tail -',$TRACE_TAIL) if rexec('EXA',$cmd,true) incr $err{$cel} else {suspend report data concat($fil,'_',$nod,'_',$cnt) loop $lin (getRemoteLines()) write $lin var $lnk = concat('[[',getFile('.'),'][_blank][',encode($fil),']]') resume report write '|',$lnk,'|' } } if isCreated(true) toc '4:[[',getFile(),'][rda_report][Latest Trace Files]]' } unpretoc } } unpretoc } =head2 summary - Cell Collection Summary Displays the cell list and their accessibility. =cut debug ' Inside Exadata module, producing the cell collection summary' report summary prefix {write '---+ Cell Collection Summary' write '|*Cell*|*Connection Status*| *Collection Errors*|' } loop $key (keys(%acc)) write '|',$key,$acc{$key},$err{$key},'|' if isCreated(true) toc '2:[[',getFile(),'][rda_report][Cell Collection Summary]]' # Disable the group title in next index if isTocCreated() toc '-:RDBMS' =head1 SEE ALSO L, L =begin credits =over 10 =item RDA 4.16: Jean-Marc Gaudron. =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