# DSCVinfo.def: Collects Generic Oracle Discoverer Information # $Id: DSCVinfo.def,v 2.8 2012/02/17 10:36:01 mschenke Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/DSCVinfo.def,v 2.8 2012/02/17 10:36:01 mschenke Exp $ # # Change History # 20120215 KRA Improve 'Active Discoverer Portlets' section functionality. =head1 NAME DSCVinfo - Collects Generic Oracle Discoverer Information =head1 DESCRIPTION This module collects generic Oracle Discoverer information. =cut # Initialization var ($AS11,$INS,$WEBCACHE) = @arg import $DISCOVERER_HOME,$ORACLE_HOME,$TOC,$TOP,$VER var $DISCO_INFRA_LOGIN = getSetting('DISCO_INFRA_LOGIN') var $DISCO_INFRA_SID = getSetting('DISCO_INFRA_SID') var $DISCO_EUL_LOGIN = getSetting('DISCO_EUL_LOGIN') var $DISCO_EUL_SID = getSetting('DISCO_EUL_SID') var $PORTLET = getSetting('DISCO_PORTLET',0) var $WEBSERVICE = getSetting('DISCO_WEBSERVICE',0) var $WEB_LOGIN = getSetting('DISCO_WEBSERVICE_LOGIN') # Collect the database information if or(and($AS11,$INS),not($AS11)) {# Load the common macros run DBinfo() # Collect information from the infrastructure database if ?$DISCO_INFRA_LOGIN {if hasSqlPassword($DISCO_INFRA_LOGIN,$DISCO_INFRA_SID) var $pwd = undef else var $pwd = askPassword(\ concat('Enter ',$DISCO_INFRA_LOGIN,'@',$DISCO_INFRA_SID,' user password:')) # Switch the context var $log = setSqlLogin($DISCO_INFRA_LOGIN,$pwd,$DISCO_INFRA_SID,\ getSetting('DISCO_INFRA_SYSDBA',0)) var $try = setSqlFailure(0) =head2 portlet - Active Discoverer Portlets Collects active Discoverer portlets information from the infrastructure database. =cut if !testSql() {debug ' Inside DSCV module, getting Active Discoverer Portlets' report portlet var $TTL = '---+!! Active Discoverer Portlets' var @TTL = ('',\ '---+ PTM5_SCHEDULE Information',\ '---+ PTM5_CACHE Information') if $AS11 {var $own = uc(getSetting('DISCO_INFRA_SCHEMA','')) set $sql {SELECT 'RDA' " FROM dba_users " WHERE username = ':1'; } if grepSql(bindSql($sql,$own),'^RDA$','f') {var $sql = undef var ($HDR[1],$col1) = getSqlColumns('RDA',$own,'PTM5_SCHEDULE') call clearSqlColumns('RDA') call setSqlColumns('RDA','cch_error_msg',\ "REPLACE(cch_error_msg,CHR(10),'%BR%')") var ($HDR[2],$col2) = getSqlColumns('RDA',$own,'PTM5_CACHE') call clearSqlColumns('RDA') if $col1 {set $sql {SELECT :1 " FROM :3.ptm5_schedule; } } if $col2 {append $sql {PROMPT ___Macro_separator(2)___ "SELECT :2 " FROM :3.ptm5_cache; } } if ?$sql {call separator(1) call writeSql(bindSql($sql,$col1,$col2,$own)) call separator(0,'Active Discoverer Portlets') } } } else {var $sql = undef var ($HDR[1],$col1) = getSqlColumns('RDA','DISCOVERER5','PTM5_SCHEDULE') call clearSqlColumns('RDA') call setSqlColumns('RDA','cch_error_msg',\ "REPLACE(cch_error_msg,CHR(10),'%BR%')") var ($HDR[2],$col2) = getSqlColumns('RDA','DISCOVERER5','PTM5_CACHE') call clearSqlColumns('RDA') if $col1 {set $sql {SELECT :1 " FROM discoverer5.ptm5_schedule; } } if $col2 {append $sql {PROMPT ___Macro_separator(2)___ "SELECT :2 " FROM discoverer5.ptm5_cache; } } if ?$sql {call separator(1) call writeSql(bindSql($sql,$col1,$col2)) call separator(0,'Active Discoverer Portlets') } } } # Restore the previous context call setSqlLogin($log) call setSqlFailure($try) } # Collect EUL information if ?$DISCO_EUL_LOGIN {if hasSqlPassword($DISCO_EUL_LOGIN,$DISCO_EUL_SID) var $pwd = undef else var $pwd = askPassword(\ concat('Enter ',$DISCO_EUL_LOGIN,'@',$DISCO_EUL_SID,' user password:')) # Switch the context var $log = setSqlLogin($DISCO_EUL_LOGIN,$pwd,$DISCO_EUL_SID,\ getSetting('DISCO_EUL_SYSDBA',0)) var $try = setSqlFailure(0) =head2 eulversion - EUL Version Collects End User Layer (EUL) version information. =cut if !testSql() {debug ' Inside DSCV module, getting EUL version' report eulversion prefix {write '---+ EUL Version' write '|*Release*|*Version Minimum Code Version*|*EUL Timestamp*|' } set $sql {SELECT '|' || " ver_release || ' |' || " ver_min_code_ver || ' |' || " ver_eul_timestamp || ' |' " FROM eul5_versions; } call writeSql($sql) if isCreated(true) toc '2:[[',getFile(),'][rda_report][EUL Version]]' =head2 eulmode - EUL Mode Collects End User Layer (EUL) mode. =cut debug ' Inside DSCV module, getting EUL mode' report eulmode prefix {write '---+ EUL Mode' write '|*Mode*|' } set $sql {SELECT '|' || " DECODE(COUNT(1),0,'Standard EUL','Application Mode EUL') || ' |' " FROM eul5_app_params " WHERE app_type = 'SP' " AND app_id = 1016; } call writeSql($sql) if isCreated(true) toc '2:[[',getFile(),'][rda_report][EUL Mode]]' } # Restore the previous context call setSqlLogin($log) call setSqlFailure($try) } =head2 disco_portlet - Discoverer Portlet Status Checks whether the discoverer portlet is well configured. =head2 disco_webservice - Discoverer Web Services Status Checks whether the discoverer web services is well configured. =cut if or($PORTLET,$WEBSERVICE) {debug ' Inside DSCV module, checking portlet and web services status' if testFile('r',$WEBCACHE) {var $top = xmlLoadFile($WEBCACHE,xmlDisable(xmlParser(),'DR')) if xmlFind($top,'CALYPSO/CACHE NAME=".*-WebCache"/MULTIPORT') {loop $xml (xmlFind(first(last),'LISTEN PORTTYPE="NORM"')) {next compare('ne',xmlValue($xml,'SSLENABLED','NONE'),'NONE') var $prt = xmlValue($xml,'PORT') next !match($prt,'^\d+$') # Test discoverer portlet status if $PORTLET {var $url = \ concat('http://',${RDA.HOST},':',$prt,'/discoverer/portletprovider') var $req = createRequest('GET',$url) var $rsp = submitRequest($req) report disco_portlet write '---+ Discoverer Portlet Information' write '---## Using: ',$url if isSuccess($rsp) write '**Discoverer Portlet is configured.**' else write 'Failed to get Discoverer Portlet (',\ join(',',getRspCode($rsp)),' - ',getRspMessage($rsp),')' toc '2:[[',getFile(),'][rda_report][Discoverer Portlet Status]]' } # Test discoverer web services status if $WEBSERVICE {var $url = \ concat('http://',${RDA.HOST},':',$prt,'/discoverer/wsi') var $pwd = askPassword(concat("Enter '",$WEB_LOGIN,\ "' user password for checking discoverer web services:")) var $req = createRequest('GET',$url) var $rsp = submitRequest($req) call setCredentials(needCredentials($rsp),concat($WEB_LOGIN,':',$pwd)) var $rsp = submitRequest($req) report disco_webservice write '---+ Discoverer Web Services Information' write '---## Using: ',$url if isSuccess($rsp) write '**Discoverer Web Services is configured.**' else write 'Failed to get Discoverer Web Services (',\ join(',',getRspCode($rsp)),' - ',getRspMessage($rsp),')' toc '2:[[',getFile(),'][rda_report][Discoverer Web Services Status]]' } break } } } } } =head2 check_discoverer - Discoverer Status Runs the checkdiscoverer script. =cut if !$AS11 {debug ' Inside DSCV module, running checkdiscoverer command' report check_discoverer if isUnix() {var $pgm = catCommand($DISCOVERER_HOME,'util','checkdiscoverer.sh') var $cmd = concat($pgm,' 2>&1') } elsif or(isWindows(),isCygwin()) {var $pgm = catCommand($DISCOVERER_HOME,'util','checkdiscoverer.bat') var $cmd = concat($pgm,' -nopause 2>&1') } else var $pgm = undef if testFile('fr',$pgm) {write '---+!! Discoverer Status' write '---## Using: ',encode($cmd) if !writeCommand($cmd) write '** Error running checkdiscoverer command **%BR%' write $TOP toc '2:[[',getFile(),'][rda_report][Discoverer Status]]' } } =head2 exe_versions - Executable Versions Gathers Oracle Discoverer executable versions. =cut if or(and($AS11,not($INS)),not($AS11)) {debug ' Inside DSCV module, getting executable versions' report exe_versions prefix {write '---+!! Executable Versions' write '|*File*|*Version*|' } loop $fil (grepDir(catDir($ORACLE_HOME,'bin'),'^dis51(ws|pr)','ip')) {next !testFile('fr',$fil) call loadString($fil,$VER) loop $lin (getLines()) {var (undef,$ver) = split(':',$lin,2) write '|',encode($fil),' |',$ver,' |' } } if isCreated(true) {write $TOP toc '2:[[',getFile(),'][rda_report][Executable Versions]]' } =head2 lib_versions - Library Versions Gathers Oracle Discoverer library versions. =cut if or(isWindows(),isCygwin()) var $dir = catDir($ORACLE_HOME,'bin') elsif isUnix() var $dir = catDir($DISCOVERER_HOME,'lib') else var $dir = undef if $dir {debug ' Inside DSCV module, getting library versions' report lib_versions prefix {write '---+!! Library Versions' write '|*File*|*Version*|' } loop $fil (grepDir($dir,'\.(dll|so)$','ip')) {next !testFile('fr',$fil) call loadString($fil,$VER) loop $lin (getLines()) {var (undef,$ver) = split(':',$lin,2) write '|',encode($fil),' |',$ver,' |' } } if isCreated(true) {write $TOP toc '2:[[',getFile(),'][rda_report][Library Versions]]' } } } =begin credits =over 10 =item RDA 4.4: Gurmakh Dev, Steve Fitzgerald. =item RDA 4.10: John Whitaker. =item RDA 4.15: Greg Cook, Andrew Salt. =item RDA 4.27: Gianluca Carosi. =back =end credits =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2012, 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