# DCdbc.ctl:430:Collects Database Control Information # $Id: DCdbc.ctl,v 1.8 2013/12/18 13:20:35 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/EM/DCdbc.ctl,v 1.8 2013/12/18 13:20:35 RDA Exp $ # # Change History # 20131217 KRA Fix spell. =head1 NAME EM:DCdbc - Collects Oracle Enterprise Manager Database Control Information =head1 DESCRIPTION This module collects Oracle Enterprise Manager Database Control-related information. Some reports require the EMDIAG kit availability. The following reports can be generated and are regrouped under C: =cut echo tput('bold'),'Processing EM.DBC module ...',tput('off') # Initialization var $AUDIT_AGE = ${R_AUDIT_AGE/T:30} var $BASE = ${T_BASE:''} var $EMDIAG_IN_USE = ${B_EMDIAG_IN_USE} var $EMDIAG_TOP = ${D_EMDIAG_TOP:''} var $ORACLE_HOME = ${SET.RDA.BEGIN.D_ORACLE_HOME:''} var $TAIL = ${DFT.N_TAIL:1000} var $VIOLATION_AGE = ${R_VIOLATION_AGE/T:15} var $EMCTL = catCommand($ORACLE_HOME,'bin',${AS.BATCH:'emctl'}) var $DBC = catDir($ORACLE_HOME,$BASE) var $OC4J = catDir($ORACLE_HOME,'oc4j','j2ee',concat('OC4J_DBConsole_',$BASE)) var $MOD = cond(isUnix(),'fx','fr') var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' var $ERR = ' (error)' pretoc '1:Database Control' # Load the common macros run DB:DBinfo() run EM:EMdiag() run RDA:library() # Set the required environment var $bkp = setContext({PERL5LIB => ${ENV.PERL5LIB},\ PERL5OPT => ${ENV.PERL5OPT}}) # Validate the context var $CFG = get_config($EMCTL) if !match($CFG,'dbconsole|true') {echo 'Not a valid Database Control installation' return } # Set ORACLE_SID for emctl if match($BASE,'\_([^\.]+)$') var $env = setLocalEnv('ORACLE_SID',last) else var $env = getLocalEnv('ORACLE_SID') =head2 no_access - No Repository Access Indicates whether the Oracle Enterprise Manager repository is not accessible. =head2 not_found - No EMDIAG Kit Indicates whether the EMDIAG kit is not found. =head2 diagkit - EMDIAG Kit Information Displays the information collected by the EMDIAG kit. It generates this report only when the EMDIAG kit is installed in the Enterprise Manager repository. =head2 violations - Violation List Collects the diagnostic violation list. =head2 audit - Audit Log Lists all actions taken in the last days. =head2 EMDIAG Kit Log Files When the EMDIAG kit is available, collects its log file on request. =for stopwords Agtvfy =head2 agtvfy - EMDIAG Agtvfy Detail Output Collects EMDIAG Agent verification results. =cut if $EMDIAG_IN_USE {# Determine the user password when EMDIAG kit results are requested. var $log = nvl(get_em_login($DBC),'sysman') var $sid = get_em_conn($DBC) if derivePassword('Oracle',$sid,$log,'DBC_REPOS_USER') call setPassword('Oracle',$sid,$log,\ askPassword("Enter ${VAR.log} user password:",'')) # Collect kit information debug ' Inside DBC module, collecting EMDIAG kit information' call setDbTarget({T_TYPE=>'Oracle',T_USER=>$log,T_SOURCE=>$sid}) if testDb() {report no_access write '**Repository database connection disabled**%BR%',getDbMessage() toc '2:[[',getFile(),'][rda_report][No Repository Access]]' } elsif check_emdiag_kit() {# Get kit results call call_emdiag_kit($VIOLATION_AGE,$AUDIT_AGE) # Collect kit log files if $EMDIAG_TOP {pretoc '2:EMDIAG Kit Log Files' call sort_files(3,$TAIL,grepDir(catDir($EMDIAG_TOP,'log'),'\.log$','np')) unpretoc } } # Collect agent verification results debug ' Inside DBC module, running agtvfy' report agtvfy if ?testFile($MOD,catFile($EMDIAG_TOP,'bin',${AS.BATCH:'agtvfy'})) {var $cmd = concat(lastTestCommand(),' verify -level 9 -detail /d ',\ quote($EMDIAG_TOP),' /o ',quote($ORACLE_HOME),' 2>&1') prefix {write '---+ EMDIAG Agtvfy Detail Output' write '---## Using: ',encode($cmd) } call writeCommand({cmd=>$cmd,\ env=>{EMDIAG_HOME=>$EMDIAG_TOP,\ ORACLE_HOME=>$ORACLE_HOME}}) if isCreated(true) toc '2:[[',getFile(),'][rda_report][EMDIAG Agtvfy Detail Output]]' } } =for stopwords emctl =head2 emctl - emctl Command Output Displays the output of the following F command options: =over 4 =item o C =item o C =item o C =item o C =item o C =item o C =back For version 11g and later, it collects the output of additional F command options: =over 4 =item o C =item o C =item o C =back =cut debug ' Inside DBC module, collecting emctl information' var @opt = ('status dbconsole',\ 'status agent',\ 'upload',\ 'status agent scheduler',\ 'status agent jobs',\ 'config agent getTZ') var @dsc = ('Current Database Control status',\ 'Current status of the agent',\ 'Makes upload request to the OMS. Shows error message (if any) \ returned by the OMS in response to the request.',\ 'List of collections currently scheduled for the agent',\ 'List of current jobs running in the agent',\ 'Agent time zone') var $flg = false if grepCommand(concat($EMCTL,' getversion'),'11\.\d+\.') {var @opt = ('getversion',\ @opt,\ 'status agent memory',\ 'secure status') var @dsc = ('Database Control version',\ @dsc,\ 'Current memory footprint of agent',\ 'Agent and Database Console secure status') var $flg = true } var $cmd = exec_emctl($EMCTL,$ORACLE_HOME,\@opt,\@dsc) =head2 monitored_targets - Monitored Targets Displays the targets found in the F file of the agent and performs some predefined tests on target properties. It displays the current state of the target and its blackout information also. =cut debug ' Inside DBC module, collecting monitored target information' call display_targets($cmd,$DBC,$flg,\ 'v,oracle_database,UserName,.',\ 'v,oracle_database,password,.',\ 'f,oracle_listener,ListenerOraDir,.',\ 'h,oracle_ias,StatusURL,.') =head2 dbc_config - Database Control Configuration Displays the content of the following configuration files: =over 24 =item F This file contains all the operational parameters for the Oracle Management Server. =item F This file contains all the logging and tracing parameters for the Oracle Management Server. =item F This file contains all the operational parameters for the agent. =item F This file contains the logging setup for the Java fetchlets. =item F This file contains the list of all Oracle Universal Installer inventories on the machine to be considered by the agent. =item F This file contains the time stamp of the last heartbeat to the Oracle Management Server. =item F This file contains a list of all discovery scripts that must be run for discovery. Discovery is run only once, typically during the installation of the Enterprise Manager Agent. =item F This file has information about categories properties computed for various targets. =item F This file contains the names of all supported time zones. =item F This file contains the version-specific information of the Oracle Management Server, which is required by the agent to communicate properly. =item F This file is generated by Oracle Universal Installer during the installation of the Enterprise Manager Agent. It contains installation-specific information. =item F This file contains the names of all supported time zones. =item F This file contains supported time zone mappings. =back It performs some predefined tests on the configuration properties also. It reports failures. =cut debug ' Inside DBC module, collecting OMS configuration' var @cfg = ('f,emdRootCertLoc,.') var @log = () call display_dbc_config($DBC,\@cfg,\@log) call skip_files(\ catFile($DBC,'sysman','config','emoms.properties'),\ catFile($DBC,'sysman','config','emomslogging.properties'),\ catFile($DBC,'sysman','config','emd.properties'),\ catFile($DBC,'sysman','config','emagentlogging.properties')) call sort_files(3,$TAIL,\ catFile($ORACLE_HOME,'sysman','admin','nsupportedtzs.lst'),\ catFile($ORACLE_HOME,'sysman','admin','supportedtzs.lst'),\ catFile($ORACLE_HOME,'sysman','admin','tzmappings.lst'),\ catFile($ORACLE_HOME,'sysman','admin','discover','discover.lst'),\ catFile($DBC,'sysman','setupinfo.txt'),\ grepDir(catDir($DBC,'sysman','config'),'.','np'),\ grepDir(catDir($DBC,'sysman','emd'),'\.(ini|txt|xml)$','np')) =head2 file_permissions - File/Directory Details Displays the details of some files and directories. It checks the ownership and permissions also. =cut debug ' Inside DBC module, collecting files/directories details' var %dir = (catDir($DBC,'sysman','emd','state'),'o',\ catDir($DBC,'sysman','emd','upload'),'o',\ catDir($DBC,'sysman','recv'),'o') var %fil = ($EMCTL,'xo') var @own = (catFile($ORACLE_HOME,'bin','nmhs'),\ catFile($ORACLE_HOME,'bin','nmo')) call check_permissions('File/Directory Details',\@own,\%dir,\%fil) =head2 log_errors - Log Errors Filters all the lines with C message from various Oracle Enterprise Manager Database Control log files. =cut debug ' Inside DBC module, extracting errors from OMS log files' call extract_errors('log_errors',2,'Log Errors',$TAIL,\ grepDir(catDir($DBC,'sysman','log'),'^emagent_memDump','npv')) =head2 Log Files Collects the Oracle Enterprise Manager Database Control log files. =cut debug ' Inside DBC module, collecting Database Control log files' pretoc '2:Log Files' call sort_files(3,undef,\ grepDir(catDir($DBC,'sysman','log'),'^emagent_memDump','npv'),\ grepDir(catDir($ORACLE_HOME,'opmn','logs'),'.','np'),\ grepDir(catDir($OC4J,'log'),'.','np')) unpretoc =for stopwords Cfgtoollogs =head2 Cfgtoollogs Files Collects the Oracle Enterprise Manager Database Control F log files. =cut debug ' Inside DBC module, collecting Database Control cfgtoolslog files' var $ORACLE_BASE = find_base() pretoc '2:Cfgtoollogs Files' call sort_files(3,undef,\ grepDir(catDir($ORACLE_BASE,'cfgtoollogs','emca'),'.','nr'),\ grepDir(catDir($ORACLE_HOME,'cfgtoollogs'),'.','np'),\ grepDir(catDir($ORACLE_HOME,'cfgtoollogs','emca'),'.','nr'),\ grepDir(catDir($ORACLE_HOME,'cfgtoollogs','cfgfw'),'\.log$','np'),\ grepDir(catDir($ORACLE_HOME,'cfgtoollogs','oui'),'\.(err|log|out)$','np'),\ grepDir(catDir($ORACLE_HOME,'cfgtoollogs','opatch'),'\.(log|txt)$','np')) unpretoc =head2 Miscellaneous Files Collects files that are related to Oracle Enterprise Manager Database Control. Some of the important files are as follows: =over 16 =item F This file specifies the list of special integration classes to be loaded when the Enterprise Manager application starts. These integration classes define and shape which special pages and features are enabled for the various target types. =item F This file contains OPMN settings. =item F This file contains specific settings for the OC4J application. =item F This file contains specific settings for the UIX Web pages including supported languages. =item F This file contains specific settings for the user interface. =back =cut debug ' Inside DBC module, collecting miscellaneous OMS files' pretoc '2:Miscellaneous Files' call sort_files(3,undef,\ grepDir(catDir($ORACLE_HOME,'Apache','Apache','conf'),'.conf$','np'),\ grepDir(catDir($ORACLE_HOME,'install'),'.','np'),\ catFile($ORACLE_HOME,'inventory','ContentsXML','comps.xml'),\ catFile($ORACLE_HOME,'oc4j','j2ee','oc4j_applications','applications',\ 'em','em','WEB-INF','uix-config.xml'),\ catFile($ORACLE_HOME,'oc4j','j2ee','oc4j_applications','applications',\ 'em','em','WEB-INF','web.xml'),\ catFile($ORACLE_HOME,'opmn','conf','opmn.xml'),\ grepDir(catDir($OC4J,'application-deployments','default','defaultWebApp'),\ '.','np'),\ grepDir(catDir($OC4J,'application-deployments','em'),'.','np'),\ grepDir(catDir($OC4J,'application-deployments','em','em'),'.','np'),\ grepDir(catDir($OC4J,'config'),'.','np')) unpretoc # Restore the environment call setLocalEnv('ORACLE_SID',$env) call restoreContext($bkp) =head1 SEE ALSO L, L, L =begin credits =over 10 =item RDA 4.9: Smitha Nath. =item RDA 4.15: Eliane Papillon Le Noc. =item RDA 4.16: Eliane Papillon Le Noc. =item RDA 4.18: Eliane Papillon Le Noc. =item RDA 4.22: Eliane Papillon Le Noc. =item RDA 4.28: Laurence De Sulzer Wart. =item RDA 4.30: Eliane Papillon Le Noc. =item RDA 8.00: Laurence De Sulzer Wart. =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