WLST Offline Script to Create Summary of WebLogic Domain

Introduction

I have always believed it is important to find out the bigger picture early on in a problem investigation. For example, if a managed server is exhibiting problematic behaviour, as well as I looking at the logs, I like to know the context - for example:

  • Is the server part of a cluster?
  • How many servers / clusters are in the Weblogic Domain?
  • Is the domain spread across multiple machines?
  • Are System Resources such JDBC and JMS in play?

Weblogic Server scripting ( WLST ) has been around for many years. Consequently there are a large number of examples to be found in blogs, websites and forums. The vast majority assume you can run the script in online mode. What if, however, a WLST online connection cannot be established? Ok, sure we can manually peruse the DOMAIN_HOME/config/config.xml. It is not a friendly a solution partly because some of the configuration is held in other xml files referenced by the config.xml. There has to be another way, I thought, after all WebLogic Server holds domain configuration in MBeans. This got me thinking about WLST.


WLST's readDomain Function

We can use WLST's readDomain function, in offline mode, to load the domain MBean configuration hierarchy / tree. It is as simple this:

Example: Unix Machine:

WL_HOME=/oracle/middleware/wlserver_10.3
DOMAIN_HOME=/oracle/middleware/user_projects/domains/MyDomain
$WL_HOME/common/bin/wlst.sh
wls:/offline/readDomain('/oracle/middleware/user_projects/domains/MyDomain')

Now you are ready to navigate the "tree" using "cd" and "ls" style syntax

wls:/offline/MyDomain/ls()

drw-   AnyMachine
drw-   AppDeployment
drw-   Cluster
drw-   EmbeddedLDAP
drw-   FileStore
drw-   JDBCSystemResource
drw-   JMSServer
drw-   JMSSystemResource
drw-   Library
drw-   MigratableTarget
drw-   Security
drw-   SecurityConfiguration
drw-   Server
drw-   ShutdownClass
drw-   StartupClass
drw-   WLDFSystemResource
-rw-   Active                                        false
-rw-   AdminServerName                               AdminServer
-rw-   AdministrationMBeanAuditingEnabled            false
-rw-   AdministrationPort                            9002
.... etc
wls:/offline/MyDomain/cd ('Server')
wls:/offline/MyDomain/Server/ls()
drw-   AdminServer
drw-   MyManagedServer
drw-   MyManagedServer01
wls:/offline/MyDomain/Server/cd ('MyManagedServer')
wls:/offline/MyDomain/Server/MyManagedServer/ls()
drw-   DataSource
drw-   NetworkAccessPoint
drw-   SSL
drw-   ServerDiagnosticConfig

-rw-   AcceptBacklog                                 300
-rw-   AdminReconnectIntervalSeconds                 10
-rw-   AdministrationPort                            0
-rw-   AdministrationPortEnabled                     false
-rw-   AdministrationProtocol                        null
...
-rw-   JavaCompilerPostClassPath                     null
-rw-   JavaCompilerPreClassPath                      null
-rw-   JavaStandardTrustKeyStorePassPhraseEncrypted  null
-rw-   JdbcLoginTimeoutSeconds                       0
-rw-   KeyStores                                     null
-rw-   ListenAddress                                 127.0.0.1
-rw-   ListenDelaySecs                               0
-rw-   ListenPort                                    7021
-rw-   ListenPortEnabled                             true

... etc
wls:/offline/MyDomain/Server/MyManagedServer/foo = get('ListenPort')
wls:/offline/MyDomain/Server/MyManagedServer/print foo

7021

 

Sample Script and Output

To write a script, which automates the capture and print out of attributes useful to a summary, is challenging because the functions to traverse and search the MBean tree are limited compared to online mode. You are pretty much stuck with the cd(), ls() and get(). However, with a bit of coding creativity with IF and FOR loop syntax you can programmatically explore the tree and return output in a nice format - in my sample I have chosen HTML tables.

Sample Output

To view sample output, go here

Screenshot below shows snipper of sample output.


Download Sample Script

You can grab the sample script by clicking here.

Instructions to Run:

1. Edit the environment variables in the start wrapper script startWLSofflineCollection.sh (Unix) or startWLSofflineCollection.cmd (MS Windows) to suit your system

Example - startWLSofflineCollection.sh

WL_HOME=/oracle/middleware/wlserver_10.3
DOMAIN_HOME=/oracle/middleware/user_projects/domains/MyDomain; export DOMAIN_HOME
WLST_OUTPUT_PATH=/temp/wlst/; export WLST_OUTPUT_PATH
WLST_OUTPUT_FILE=WLST_MBean_Config_Summary.html; export WLST_OUTPUT_FILE
${WL_HOME}/common/bin/wlst.sh CollectWLSConfigOffline.py

Note: The WLST_OUTPUT_PATH directory value must have a trailing slash. If there is no trailing slash script will error and not continue.

2. Then run the wrapper script. It should launch WLST and run the script. The script will collect MBean values and render them in a HTML file.
(Once the script has invoked the WLST shell, the execution of the python script should not take longer than 5 to 10 seconds.)

Disclaimer

This is a sample script. I have tested it against WebLogic Server 10.3.6 domains on MS Windows and Unix.  I cannot guarantee that the script will run error free or produce the expected output on your system. That said, a number of colleagues have also run the script and with their feedback I have ironed out a few problems. If you have any feedback add a comment to the blog. I will endeavour to fix any problems with my WLST code. 

Credits

I found the following blogs particularly useful.

Java / Oracle SOA blog
[http://biemond.blogspot.co.uk/2010/02/invoking-fmw-application-mbeans-in.html]

WLST By Examples
[http://wlstbyexamples.blogspot.co.uk/]


Some Pitfalls (which required coding around)

Checking whether Configuration MBean Hierarchy Exists

If a service or functionality, such as Clusters, JDBC, JMS, Filestore are not configured, the related MBean hierarchy will not be visible when listing at domain level. Example: If Cluster, JDBC, JMS and Filestore have not been configured, the ls() will show:

wls:/offline/MyDomain/ls()

drw-   AnyMachine
drw-   AppDeployment
drw-   EmbeddedLDAP
drw-   Library
drw-   MigratableTarget
drw-   Security
drw-   SecurityConfiguration
drw-   Server
drw-   ShutdownClass
drw-   StartupClass
drw-   WLDFSystemResource

A programmatic attempt to cd to a directory not listed will return an error e.g.

Error: cd() failed. Do dumpStack() to see details.

To work-around, the script contains a custom findMBean function. The function places the contents of the ls() in an array using the returnmap parameter. We can then loop through the array and check whether a given string - the MBean directory name exists e.g.

def findMBean(v_pattern):
        # get a listing of everything in the current directory
    mydirs = ls(returnMap='true');

        v_compile_pattern = java.util.regex.Pattern.compile(v_pattern);

    found = 'Nope not here';

    for mydir in mydirs:
        x = java.lang.String(mydir);
        v_matched = v_compile_pattern.matcher(x);
        if v_matched.find():
            found = 'true';

        return found;

AnyMachine v Machines

In WebLogic Server 10.3, if a domain has one or more machines configured (i.e nodemanager related machines) the ls() at domain level will show

wls:/offline/MyDomain/ls()

drw-   AnyMachine

A cd ('AnyMachine'), however, will fail. The correct cd syntax is

wls:/offline/MyDomain/cd ('Machines')

Identifying Target Information

Features such as JDBC System Resources, Clusters may or may not have targets. An attempt to cd to an MBean directory or get an MBean attribute which does not exist will throw an error and prevent the script from continuing. To work-around we can use TRY / EXCEPT syntax. Example - snippet from sample script which deals with the capture of JDBC System Resource targets.

try:
            v_any_targets = '';
            v_jdbc_target = get('Target');

            # Even if the get fails, the variable is assigned a value of none, set the flag variable accordingly
            if v_jdbc_target == 'None':
                v_any_targets = 'None';
                v_no_of_targets = 1;
            else:   
                # If the get has succeeded then set flag accordingly and obtain length of array returned by the get
                # The array length will be used to determine the HTML rowspan value

                v_any_targets ='Use v_jdbc_target';
                v_no_of_targets = len(v_jdbc_target);

        except:

            # Setting flag and rowspan variable here as well .. belt and braces
            v_any_targets = 'None';
            v_no_of_targets = 1;

            # The exception will still display to standard out, which may cause alarm
            # So adding this message telling the user the exception is expected and can be ignored
            print "IGNORE this exception";   

Comments:

Hi, The script looks good. could you brief me how to execute the script i.e., where to put the code(directory?) and where to execute?

Thanks
Swaroop

Posted by guest on May 14, 2013 at 10:43 PM BST #

Hi Swaroop,

Thanks for your comment. Since posting this blog entry, I have enhanced the script so it is capable of performing an online or offline domain summary.

Please go to

https://blogs.oracle.com/fmwinstallproactive/entry/wlst_offline_or_online_domain

Regards running the script, there is not a lot I can add to the instructions already given. I have provided a wrapper sh (Unix) and cmd (Windows) script which will launch WLST and execute the script. All you have to do is

a) Download the zip and extract to a directory of your choosing on the machine which is hosting the WebLogic Server Home (WL_HOME)

b) Manually open and edit the wrapper script and change the environment variable values to suit your environment.

c) Run the wrapper script (no parameters are required) e.g

Unix:

chmod 777 startWLSofflineCollection.sh
./startWLSofflineCollection.sh

MS Windows:

startWLSofflineCollection.cmd

Note: If you are using the enhanced solution from

https://blogs.oracle.com/fmwinstallproactive/entry/wlst_offline_or_online_domain

The wrapper script has a slightly different name:

Unix:

startWLSTDomainSummarizer.sh

Windows:

startWLSTDomainSummarizer.cmd

Posted by Dan Mortimer on May 15, 2013 at 09:05 AM BST #

Hi Dan,

Thank you for your valuable response. I have executed the script and it delivered output in html format, which is awesome.
I only got basic domain info by running the script. Is there anyway you could modify the script to fetch the below info:
a)JTA configuration parameters
b) all the JDBC datasource configuration parameters (connection pools, trasaction properties, resource adapter connection pools)

I am working on pulling all the domain configuration parameters adn exporting them to any file format (html, txt)

please help me regarding this.

Regards,
Swaroop

Posted by guest on May 15, 2013 at 04:05 PM BST #

Hi Swaroop

First of all, it is not clear whether you have gone to the latest solution as I suggested

https://blogs.oracle.com/fmwinstallproactive/entry/wlst_offline_or_online_domain

If you did, I recommend choosing the option to connect to the Admin Server of the domain. If you do this, you will get more information as the startWLSTDomainSummarizer wrapper script will kick off

WLSDomainInfoOnline.py

This script collects configuration and runtime MBean values. Did you try this?

Secondly, be aware that my sample script is only intended to provide a high level Weblogic Domain Summary. Think of it as a summary which provides at a glance a sense of what a domain contains. I did not want to fill it with a large amount of data for two reasons:

1. Too much data and it seizes to be a summary.
2. Collecting more and more data adds to the complexity of the sample script (it's already quite long :-) )

That all said, it is a sample solution and you have all the jython scripts to amend and adapt to suit your purpose. The two which contain the bulk of the code are

WLSDomainInfoOffline.py
WLSDomainInfoOnline.py

I have commented the code in the scripts - so hopefully you can follow my logic.

The scripts already collect some JDBC information - it should be straightforward to pick out more MBean values.

I have not covered JTA. But it should be straightforward for you to add JTA MBean info into the HTML output by copying the techniques I have employed.

Before amending the scripts, I suggest you manually explore the MBean Configuration and Runtime tree to get an idea of what MBeans exists and where. Take a look at

http://docs.oracle.com/cd/E15523_01/web.1111/e13715/nav_edit.htm#i1007314

(Note: this link takes you to the 10.3.1 WLST Guide. Unfortunately, and I have only just noticed, they have removed this chapter from the 10.3.6 version of the same guide :-( )

Posted by Dan Mortimer on May 15, 2013 at 04:45 PM BST #

Hi Dan,

I have gone through the latest solution as you suggested and executed the script by specifying the admin server details, it gave all the configuration and runtime information for JDBC & JMS.

Is there anyway i can take only the JDBC configuration & runtime information in the script and run using other script.

Thanks,
Swaroop

Posted by guest on May 15, 2013 at 06:31 PM BST #

Hi Swaroop

Although, it should be possible to create your own JDBC metrics collection script by

a) Ripping out all the unwanted pieces from my sample script.
or
b) Extracting the relevant section from WLSDomainInfoOnline.py and/or WLSDomainInfoOffline.py for use in your own version.

I appreciate it is challenging because the script is long + there is HTML and a little javascript in the mix.

So, I have created a version of WLSDomainInfoOnline.py which just collects JDBC data. Grab it from here.

https://blogs.oracle.com/fmwinstallproactive/resource/Scripts/WLSTJDBCSummarizer.zip

This example should make for an easier to read blueprint / template for your own creation / customization.

Posted by Dan Mortimer on May 16, 2013 at 09:29 AM BST #

Hi dan,

Thank you so much for your response. I will do the above and let you know if i have any further questions.

Regards
Swaroop

Posted by guest on May 16, 2013 at 03:48 PM BST #

Hello Dan,

I am facing a big challenge with your script. I am not able to add some information in the script. May be i am missing the logic. I am trying to add JDBCSystemResources-->JDBC-->JDBCResource-->JDBC-->JDBCConnectionPoolParams-->JDBC-->( i am trying to add Initial, maximum & minimum capacity) in the script.

I am not able to execute the script as its not working when i tried to modify the script. Please help me.

Regards,
Swaroop

Posted by guest on May 16, 2013 at 11:27 PM BST #

Hi Swaroop

I have uploaded a new version of the JDBC Summarizer which includes Connection Pool capacity (configuration) details

- InitialCapacity
- MaxCapacity
- MinCapacity

Hopefully from the changes I have made you can work out where you were going wrong.

Grab the latest copy via the same URL as before:

https://blogs.oracle.com/fmwinstallproactive/resource/Scripts/WLSTJDBCSummarizer.zip

I have three tips regards debugging your wlst / jython script writing efforts:

a) Use an editor which recognises Python. Eclipse is one solution, but my current preference is this open source editor - SciTE

http://www.scintilla.org/SciTE.html

The advantage of using such an editor is it will automatically add the required indentations + color coding which helps you avoid syntax errors at runtime.

b) The script is programatically navigating up and down the MBean hierarchy using cd() .. if you are seeing cd errors your logic is probably in the wrong place in the tree.

Open up a WLST session and manually navigate the tree to find the MBean directory / attribute you want to examine. This will give you a point of comparison regards what you are writing in the script.

Add these lines just above the lines in the script which are failing

print "DEBUG Message: Where am I?";
ls();

You can then compare the ls() output from the script against where you think the script should be.

c) Take a look at this blog entry. Contains some useful tips and tricks.

http://wlstbyexamples.blogspot.co.uk/2011/03/wlst-tricks-tips.html#.UZXzDKwmaSo

Posted by Dan Mortimer on May 17, 2013 at 10:14 AM BST #

Hi Dan,

Thank you so much for your valuable responses.I am feeling pretty much confident that i can make the script.

Regards,
Swaroop

Posted by guest on May 17, 2013 at 05:16 PM BST #

Hi Dan,
I am unable to find out the resource adapter (Dbadapter) connection pool parameters using WLST when i am connected to admin server in a domain.

I can find that information in weblogic console- deployments- dbadapter- outbound connection pools- javax.resource.cci.ConnectionFactory- connection pool.But, I am unable to find that using WLST in a domain.

Thanks,
Swaroop

Posted by guest on May 20, 2013 at 11:56 PM BST #

Hi

As far as my sample domain summary script is concerned I have only sought to summarize JDBC System Resources.

It appears that you are seeking to monitor / summarize a deployed database adapter. I have not deployed a database adapter on my test system so I cannot explore where the adapter MBean information may be held.

However, I did a quick internet search and found this blog entry

http://www.albinsblog.com/2012/06/monitoring-jca-adapters-through-wlst.html#.UZtDXqyB6So

My guess is that you will find your dbadapter info under the "ApplicationRuntimes" branch of the MBean hierarchy.

Posted by Dan Mortimer on May 21, 2013 at 10:57 AM BST #

Hi Dan,

Is there any script which compares our existing environment JDBC connection pool parameters and the tuning values for those JDBC connection pool parameters.

Basically, the script needs to compare the existing JDBC connection pool parameters to any custom values and tell the difference. For example, we have SOADatasource initial capacity configured as 0 and we need to tune that to 40. so, the script needs to compare & tell the difference.

Please help regarding this matter.

Regards,
Swaroop

Posted by guest on May 21, 2013 at 05:56 PM BST #

Hi Swaroop

If I understand correctly you are now trying to write a script which not only captures MBean values but performs some logic to compare values and throw back an alert or health check report.

You can definitely achieve this using Jython. However, I do not have nor am I aware of a sample script which does exactly what you are asking for.

That said, for some inspiration, take a look at

http://wlstbyexamples.blogspot.co.uk/2010/05/jdbc-monitoring.html#.UZyFOqxc-68

In the section "In Year 2012 revisting the same script" they have an example of some logic which compares MaxCapacity and ActiveConnectionsCurrentCount. If the ActiveConnectionsCurrentCount reaches 85% of the MaxCapacity value, a warning is printed.

Posted by Dan Mortimer on May 22, 2013 at 09:46 AM BST #

Hi Dan,

Could you modify your script "WLS_JDBC_Summary_Online.py" by using if or then attributes. Basically, the script now is running in the domain and generating the JDBC configuration summary.

Is there any way that you could modify the script like it runs in the domain and check the Connection pool parameters and throws an exception that currently initial capacity is '0' but it needs to be as '40'. could you specify just for SOADataSource. so, that i will use the logic and apply for other data sources.

I need the script for checking 'Initial, maximum & capacity increment' parameters for SOADataSource. I have seen the URL you sent regarding the script but i am not getting it.

Please help.

Thanks,
Swaroop

Posted by guest on May 22, 2013 at 11:55 PM BST #

Hi Swaroop

Yes, the script could be modified, but I am sorry I don't have the bandwidth to do this right now.

Real quick .. try experimenting by adding lines of code like this within the table printing section

++++++++++++++++
..
..
print >>f, "<td";
print >>f, "rowspan=";
print >>f, v_no_of_targets;
print >>f, ">";
print >>f, v_ConnectPoolInitial;
if v_ConnectPoolInitial < 40:
print >>f, "</br></br>"
print >>f, "<strong><span style=\"color:red\">"
print >>f, "Recommendation: Increase value to 40 or higher"
print >>f, "</span></strong>";
print >>f, "</td>";

..
..

Posted by Dan Mortimer on May 23, 2013 at 09:22 AM BST #

Hi Dan,

Thank you, The script works good for throwing exception. However what i need to do if i need only specific datasource information rather than all the existing datasources in the domain.

Thanks,
Swaroop

Posted by guest on May 23, 2013 at 06:58 PM BST #

Hi

If you know the name of the data source you want to examine then just remove the loop

for myjdbcresource in myjdbcresources:
..

and cd directly to the jdbc resource you wish to target

cd ('MyJDBCResource');

and navigate and grab attribute values.

Posted by Dan Mortimer on May 24, 2013 at 11:27 AM BST #

Hi Dan,
How are you? I need your help. Could you send me the script for getting JTA information i.e., 1) TimeoutSeconds 2) AbandonTimeoutSeconds 3) MaxXACallMillis. I am trying to modify the script which i used for JDBC, but its throwing many errors.

Thanks & Regards,
Swaroop

Posted by guest on June 05, 2013 at 12:23 AM BST #

Hi Swaroop

I am sorry I don't have the bandwidth to add in JTA stats to my sample right now.

I did a quick web search to see if anyone has written a WLST script to grab JTA stats and found

http://oraclefusion1011.blogspot.co.uk/2012/09/monitor-weblogic-using-wlst-in-java.html

I would start by experimenting with this guy's example code.

If I can find time in the next two or three weeks I may look to create a new blog entry which provides a JDBC only example. Just depends on workload and other priorities.

Posted by Dan Mortimer on June 05, 2013 at 09:07 AM BST #

Hi Dan,

IS there a way that you could add the code to fetch JTA stats by deleting your previous code. I am trying to add JTA stats but i am unable to do so. I am going till fetching the table but unable to fetch the main stats i.e., JTA attributes.

Please help.

Thanks
Swaroop

Posted by guest on June 24, 2013 at 05:08 PM BST #

I have found some time today to enhance the JDBCSummarizer which I provided back in a reply to you on May 16th (see above).

Check out new blog entry

https://blogs.oracle.com/fmwinstallproactive/entry/wlst_script_to_obtain_jdbc

Hope this helps.

Posted by Dan Mortimer on June 25, 2013 at 04:01 PM BST #

Hi Dan,

Thank you so much for your help.

Swaroop

Posted by guest on June 25, 2013 at 05:08 PM BST #

Hi Dan,

I am trying to run the script that pulls out JTA & JMS stats. but, i am successfully pulling out JTA stats but not able to get JMS stats. Please let me know where exactly the problem is. I am trying to send the script here but its marking as spam.

Please let me know your email so that i will send the script to.

Thanks,
Swaroop

Posted by guest on June 27, 2013 at 12:33 AM BST #

Sorry .. I missed out a cd('..') in the JTA section to take the script back to the MBean serverConfig root after the JTA MBean collection was completed. Consequently when you added the code to collect JMS, your script found itself in the JTA MBean tree and the findMBean('JMSServers'), which needs to execute from the serverConfig root, was returning false. I have re-uploaded

https://blogs.oracle.com/fmwinstallproactive/resource/Scripts/WLSTJDBCSummarizer.zip

with the mistake corrected and a small improvement to the logic which checks whether a given MBean directory (e.g. JDBCSystemResource, JTA and JMSServers) is available.

Also just for you here is the .py script which has JDBC, JTA and JMS tabs.

https://blogs.oracle.com/fmwinstallproactive/resource/Scripts/WLS_JDBC_Summary_Online_With_JMS.zip

Posted by Dan Mortimer on June 27, 2013 at 11:37 AM BST #

Hi Dan,

i have a question regarding the script. Is there anyway that the script can call another script for comparing JDBC connection pool parameters. For example, right now we have included if the value is less than 40 then print -"recommendation: the value need to tuned to 50 or higher".

My question is the script need to call another script (say a gold copy of expected tuning values) and display the comparison result rather than giving a hard value every time.

Do you have any idea how to do it. I really thankful to you for all your support, and your script is allowing us monitor our environments.

Thanks,
Swaroop

Posted by guest on July 01, 2013 at 10:29 PM BST #

Hi

It sounds like you want to store certain variable values in a "properties" file. If I am right you can use the WLST function loadProperties

Example:

In an earlier reply I suggested this snippet for comparing a collected value against a nominal value

print >>f, "<td";
print >>f, "rowspan=";
print >>f, v_no_of_targets;
print >>f, ">";
print >>f, v_ConnectPoolInitial;
if v_ConnectPoolInitial < 40:
print >>f, "</br></br>"
print >>f, "<strong><span style=\"color:red\">"
print >>f, "Recommendation: Increase value to 40 or higher"
print >>f, "</span></strong>";
print >>f, "</td>";

You could store the nominal value in a properties file e.g.

++++++++++++++++++++++++++
myproperties.properties
++++++++++++++++++++++++++
v_Recommended_ConnectPoolInitial=40

Place this file in the same directory as the .py file.

In the .py script load this properties file using the syntax

loadProperties('myproperties.properties');

This will allow you to refer the variable setting in the properties file within your logic e.g.

print >>f, "<td";
print >>f, "rowspan=";
print >>f, v_no_of_targets;
print >>f, ">";
print >>f, v_ConnectPoolInitial;
if v_ConnectPoolInitial < v_Recommended_ConnectPoolInitial:
print >>f, "</br></br>"
print >>f, "<strong><span style=\"color:red\">"
print >>f, "Recommendation: Increase value to 40 or higher"
print >>f, "</span></strong>";
print >>f, "</td>";

Posted by Dan Mortimer on July 02, 2013 at 02:20 PM BST #

Hi Dan,

Thanks for your prompt response. I have created myproperties.properties file in the same directory as the .py file. i included 'v_Recommended_ConnectPoolInitial=40' in the properties file. also, i tried to load loadProperties('myproperties.properties');in the .py script. But, i am not able to see any difference.

Please let me know where i need to load the loadProperties('myproperties.properties'); in the script also please let me know what i need to include in it.

Thanks & Regards,
Swaroop

Posted by guest on July 02, 2013 at 06:39 PM BST #

Place the

loadProperties('myproperties.properties');

at the start of the main section of the .py - after the #END OF FUNCTIONS

I have already indicated what you need to put in the .properties file. In the example given it needs the line the variable declaration. Do not add a semi colon, just type it as I have done below

v_Recommended_ConnectPoolInitial=40

All the loadProperties function does is load the lines in the given .properties file. In other words the variables found there are available to the WLST session, and therefore available to the .py script running in that session. If your code is not working, temporarily comment out the loadProperties line, and check that the logic works if the variable (e.g. v_Recommended_ConnectPoolInitial is declared in the main .py) e.g.

v_Recommended_ConnectPoolInitial=40

print >>f, "<td";
print >>f, "rowspan=";
print >>f, v_no_of_targets;
print >>f, ">";
print >>f, v_ConnectPoolInitial;
if v_ConnectPoolInitial < v_Recommended_ConnectPoolInitial:
print >>f, "</br></br>"
print >>f, "<strong><span style=\"color:red\">"
print >>f, "Recommendation: Increase value to 40 or higher"
print >>f, "</span></strong>";
print >>f, "</td>";

Note: In my previous reply, I did not indicate the tab indents that are required after the if statement. As previously stated it is important to use a code editor like SCITE which helps you put the right indents in place.

Posted by Dan Mortimer on July 03, 2013 at 09:33 AM BST #

Ah .. unfortunately posting a reply removes spaces / indents. Instead, I am trying dashes to indicate where the indent should be

print >>f, "<td";
print >>f, "rowspan=";
print >>f, v_no_of_targets;
print >>f, ">";
print >>f, v_ConnectPoolInitial;
if v_ConnectPoolInitial < v_Recommended_ConnectPoolInitial:
------ print >>f, "</br></br>"
------ print >>f, "<strong><span style=\"color:red\">"
------ print >>f, "Recommendation: Increase value to 40 or higher"
------ print >>f, "</span></strong>";
print >>f, "</td>";

Posted by Dan Mortimer on July 03, 2013 at 09:35 AM BST #

Hi Dan,

Thank you so much, its working. its calling the properties file and displaying the result. Also, i am using SCITE as you suggested.

I will get back to you if i have any queries.

Thanks & Regards,
Swaroop

Posted by guest on July 03, 2013 at 06:27 PM BST #

Hi Dan,

Could you share your email. i will send you other script to verify. Please reply me at tejasai.n@gmail.com

Thanks,
Swaroop

Posted by guest on July 03, 2013 at 09:35 PM BST #

Good to hear that you have the properties file working. I am not willing to "verify your script". To do so would mean stepping too far into the world of consultancy. If you are struggling with an aspect of the example code, I am happy to comment, fix or enhance as and when I can find time.

Lastly, just to set your expectations, I am definitely not a WLST guru. The examples I have posted via this blog represent my first serious foray into the subject. As well as using the WLST documentation, I found many of the solutions to the problems and questions I hit by reading blogs and forum threads on the internet. WLST and Jython have been around for a long time. Chances are someone has published a solution to any coding obstacle you may encounter. For example, I was not aware of property files until you asked the question of sourcing parameter values from a source outside the main script. Then I researched it, discovered loadProperties, found example usage and posted a reply to you.

Posted by Dan Mortimer on July 04, 2013 at 10:49 AM BST #

Hi Dan,

Thanks for your reply. Dan,we have foreign destinations in our JMS modules. the exact path for this directory is when we go through WLST online: server config-->JMSSystemResources-->JMSModules-->JMSAQModuleEnq-->JMSResource-->JMSAQModuleEnq-->ForeignServers-->AqForeignJMSServerEnq-->ForeignDestinations. there are 25 foreign destinations which i need to fetch their info. Please provide me the logic using the example code.Like i said every time i am working with the example code and try to apply the logic i am failing.

Also, if you have time please provide me logic for- DBAdapter-->outbound connection pool-->list all the jndi's related to DB adapter.

I really appreciate your help regarding this.

Thanks & Regards,
swaroop

Posted by guest on July 04, 2013 at 08:53 PM BST #

Hi Swaroop

This is becoming consultancy. I am really sorry, but I cannot write the solution for you.

When the objective is to widen the data collection, it is advisable to take a step back from the example code.

1. Check that you can interactively view the MBean values via a WLST session - i.e by typing navigating and get commands

2. Then write your own simple .py script first which navigates the MBean tree and finds the desired MBeans values and simply prints them back to the console.

Here is an example of a simple script which print MBean values back to the console

JMS Monitoring
http://middlewaremagic.com/weblogic/?p=4931

Once you have confidence that the desired values can be obtained via a basic script, you can convert the output into HTML as I have demonstrated in my example script.

Posted by Dan Mortimer on July 05, 2013 at 08:45 AM BST #

Hi Dan,

I really appreciate your work and effort for this article. I learn a lot and a lot from this article. Excellent job!

No question or no request from me. :-) Just want to truly say:

Thank you!

A guest reading this article plus the comments.

Posted by guest on September 06, 2013 at 02:18 PM BST #

Hi Dan,

After some changes Script is working fine in our environment

Thanks for sharing it.

Regards,
Amol Trigune

Posted by Amol Trigune on November 12, 2013 at 11:51 AM GMT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

This is the blog of the Oracle Fusion Middleware Proactive Support Delivery Team. Here we will provide information about our activities, publications, product related information and more. Feedback welcome.

Follow OracleMWSupport on Twitter

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today