# DCwebc.ctl:350:Collects Oracle Web Cache Information # $Id: DCwebc.ctl,v 1.5 2015/07/03 12:04:44 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/OFM/DCwebc.ctl,v 1.5 2015/07/03 12:04:44 RDA Exp $ # # Change History # 20150703 MSC Improve the documentation. =head1 NAME OFM:DCwebc - Collects Oracle Web Cache Information =head1 DESCRIPTION This module collects Oracle Web Cache information (for example, configuration, DTD, and log files). The following reports can be generated and are regrouped under C (for version 11g and later) or C (for versions earlier than 11g): =head1 REPORTS =cut echo tput('bold'),'Processing OFM.WEBC module ...',tput('off') # Initialization var $ORACLE_HOME = ${D_ORACLE_HOME/P:''} var $MNU = '1:Oracle Web Cache' # Collect the Oracle Web Cache information if !?${B_PRIMARY} {# Initialization var $WEBC_TAIL = ${N_TAIL:5000} var $WEBCACHE_HOME = catDir($ORACLE_HOME,'webcache') var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' pretoc $MNU # Load the common macros run RDA:library() # Collect configuration files related to Oracle Web Cache debug ' Inside WEBC module, gathering Oracle Web Cache configuration files' pretoc '2:Config Files' var $dir = $WEBCACHE_HOME if ?testFile('r',catFile($dir,'webcache.xml')) {debug ' Inside WEBC module, extract main webcache.xml tags' macro get_data {var ($xml,$c_p,$c_s,$pre) = @arg $n_p = concat($c_p,'  |') $n_s = substr($c_s,1) loop $nod (xmlContent($xml)) {var $tag = xmlName($nod) var $pth = join('/',$pre,$tag) if match($tag,'^(ACCESSLOG(DIR)?|BUFFERING|CACHE(ABILITY(RULE)?)?|CLUSTER|\ DEBUGVERBOSITY|DIAGNOSTICS|EVENTLOG(DIR)?|\ EXPIRATION(REF|RULE)?|GLOBALCACHINGRULES|HOST(REF)?|\ HTTPMETHODS|IDENTITY|IOLOGGER|LISTEN|\ MAXCACHEABLECONTENTLENGTH|MULTIPORT|RESOURCELIMITS|\ ROLLOVER|SEARCHKEYOPTIONS|SELECTORS|SITE|TRACEDUMP|\ URLEXP|VERBOSITY|VIRTUALHOSTMAP|WATCHDOG)$',true) {# Treat the node var @tbl loop $key (xmlAttributes($nod)) push(@tbl,concat('``',$key,'``%NEXT%``',\ replace(xmlValue($nod,$key),'\|','|',true),'``')) if @tbl write $c_p,'``',$pth,'``',$c_s,\ '%TBL%%ID:Key:Value%',join('%BR%',@tbl),'%ENDTBL%|' else write $c_p,'``',$pth,'``',$c_s,' |' } # Treat the child nodes call get_data($nod,$n_p,$n_s,$pth) } } macro get_depth {var ($xml) = @arg var $max = 0 if xmlContent($xml) {loop $nod (last) var $max = max($max,get_depth($nod)) incr $max,1 } return $max } # Detect the depth var $xml = xmlLoadFile(lastFile(),xmlDisable(xmlParser(),'DR')) var $max = get_depth($xml) # Produce the report report webcachedet var $pre = '|' var $spn = repeat('|',$max) prefix {write '---+ Main webcache.xml Tags' write '---## Information Extracted from ',encode(lastFile()) write $pre,'*Tag Path*',$spn,'*Attributes*|' } loop $nod (xmlContent($xml)) call get_data($nod,$pre,$spn,xmlName($nod)) if isCreated(true) {write $TOP toc '3:[[',getFile(),'][rda_report][Main webcache.xml Tags]]' } } call cat_report($dir,'webcache.xml') call cat_report($dir,'internal.xml') call cat_report($dir,'webcachetargets.xml') unpretoc # Collect DTD files related to Oracle Web Cache debug ' Inside WEBC module, gathering Oracle Web Cache DTD files' pretoc '2:DTD Files' var $dir = catDir($WEBCACHE_HOME,'dtds') call cat_report($dir,'wcstats.dtd') call cat_report($dir,'webcache.dtd') call cat_report($dir,'webcache20.dtd') unpretoc =pod Log files can be relocated. Because of this, RDA parses a few xml files to get their location, and then dumps them. =cut # Collect log files related to Web Cache debug ' Inside WEBC module, gathering Web Cache log files' pretoc '2:Log Files' macro get_param {var ($fil,$re1,$re2,$val) = @arg import $ORACLE_HOME if ?testFile('r',$fil) {if grepFile($fil,$re1) {var ($val) = (last) var $val = replace($val,$re2) var $val = field('"',0,$val) var $val = replace($val,'\?',$ORACLE_HOME) } } return $val } # Let's do the web cache access_log var $dir = catDir($WEBCACHE_HOME,'logs') var $fil = catFile($WEBCACHE_HOME,'webcache.xml') var $log = get_param($fil,'ACCESSLOG.*LOGDIR','^.*LOGDIR="',$dir) call tail_report($log,'access_log',$WEBC_TAIL) # Now let's do the web cache tracedump file var $log = get_param($fil,'TRACEDUMP.*FILENAME','^.*FILENAME="') if $log call head_report(dirname($log),basename($log),$WEBC_TAIL) else call head_report($dir,'tracedump',$WEBC_TAIL) # Now let's do the web cache IOLOGGER file var $log = get_param($fil,'IOLOGGER.*FILENAME','^.*FILENAME="') if $log call tail_report(dirname($log),basename($log),$WEBC_TAIL) else call tail_report($dir,'io_log',$WEBC_TAIL) # Let's do the web cache event_log. var $log = get_param($fil,'EVENTLOGDIR.*LOGDIR','^.*LOGDIR="',$dir) var $nam = get_param($fil,'EVENTLOG.*FILENAME','^.*FILENAME="','event_log') call tail_report($log,$nam,$WEBC_TAIL) unpretoc =head2 perms - File Permissions Collects the owner and group permissions of the files used by Oracle Web Cache. =cut debug ' Inside WEBC module, gathering Web Cache File Permissions' var $dir = $WEBCACHE_HOME if ?testDir('d',$dir) {report perms prefix write '---+ Web Cache File Permissions' loop $fil ($dir,findDir($dir,'^[\.]+$','vr')) call statDir('an',$fil) if isCreated(true) toc '2:[[',getFile(),'][rda_report][File Permissions]]' } =head2 not_found - Not found Used as a warning when none of the Oracle Web Cache files are found. =cut if !isTocCreated(true) {debug ' Inside WEBC module, no file found' report not_found write 'No Web Cache files were found. This does not mean there was \ necessarily a problem with RDA, but it should be investigated.' toc $MNU toc '2:[[',getFile(),'][rda_report][Not found]]' } } =head1 WEBCACHE INFORMATION FOR ORACLE FUSION MIDDLEWARE Includes the reports generated by the L module about the Oracle instances and their associated Oracle homes. =cut elsif ${B_REQ_IREQ} {# Analyze the instance requests var %tbl = () loop $req (${CUR.O_SETUP}->search('^IREQ_OFM_WEBC_OI')) {var $ins = $req->get_first('I_ORACLE_INSTANCE') if ?$ins->get_first('I_ORACLE_HOME')->get_prime('I_COMMON_HOME') var $tbl{last->get_oid,$req->get_oid} = $ins->get_first('D_ORACLE_INSTANCE') else var $tbl{'CH',$req->get_oid} = $ins->get_first('D_ORACLE_INSTANCE') } # Collect the WEBC 11g information toc '%PUSH("0: * Oracle Web Tier")%' loop $oid (keys(%tbl)) {toc '%PUSH("1+:Common Product Home")%' toc '%INCLUDE("OFM_IREQ_OFM_WEBC_',$oid,'_TF.toc")%' toc '%POP%' loop $tid (keys($tbl = $tbl{$oid})) {toc '%PUSH("0: * ',"'",basename($tbl->{$tid}),"'",' Instance")%' toc '%PUSH("%SPLIT%")%' toc '%PUSH("1++:Associated Oracle Home")%' toc '%INCLUDE("OFM_',replace($tid,'_OI','_OH'),'_TF.toc",1)%' toc '%POP2%' toc '%PUSH("%SPLIT%")%' toc '%PUSH("1++:Instance Home")%' toc '%INCLUDE("OFM_',$tid,'_TF.toc")%' toc '%POP3%' } } toc '%POP%' } =head1 SEE ALSO L, L, L =begin credits =over 10 =item RDA 4.9: Marcus Lachmanez, Mark Templeton. =item RDA 4.19: Daniel Mortimer. =item RDA 4.22: Daniel Mortimer. =item RDA 4.24: Greg Cook, Andrew Salt. =item RDA 4.31: Laura Del Riego Sayalero. =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