Oracle Service Bus 11g: listing projects and services with WLST – part 1

For automating and repetitive purposes, as well for uniformity it’s always good to have some scripting. Especially when you want to do automated monitoring, and you don’t have a monitoring system such as Oracle EM GridControl, you can use the WebLogic tooling to do it for you. A tool, based on python and jython is WLST, in fact a JMX interface to access the MBean Domain structure within WebLogic, and in this case especially Oracle Service Bus.
 
My end goal is to monitor statistics en online endpoints of proy and business services, but first I issued to list my projects, business and proxy services.
 
The approach is:
 
- A WLST script to list Projects, Business and  Proxy Services
 
- A WLST script that frequently monitors these services on statistics, pipeline and SLA alerts
 
(if configured)
 
In this blog I will describe the listing, all done on a linux system. To start the script, execute:
 
java weblogic.WLST osbservices.py
 
For this you must have set your server’s CLASSPATH by running setDomainEnv.sh
 
Here are the various components of the script:
 
# Set some constants
username='weblogic'
password='<>'
 
import socket
localhost = socket.gethostname()
import os
domain = os.getenv('WL_DOMAIN')
domain_dir= os.getenv('WL_DOMAIN_DIR')
mwHome = os.getenv('MW_HOME')
print mwHome
url = 't3://' + localhost + ':<>'
print url
 
This section specifies some basics like connecting to the domain and setting some operating system variables like MW_HOME, WL_DOMAIN_DIR and so on. These settings need to be set on the O/S as well, like:
 
export MW_HOME=<path of your middleware home>
 
A good thing is to set these in you local users profile ( .profile or .bash_profile). I try to keep the script as generic as possible, by using special python functions like socket.gethostname()
 
Next part, the login section and I had to import some interfaces:
 
print “Lijst Proxy en Business services in ” + domain
 
connect(username, password,url)
 
from com.bea.wli.sb.management.configuration import ALSBConfigurationMBean
from com.bea.wli.config import Ref
from java.lang import String
from com.bea.wli.config import Ref
from com.bea.wli.sb.util import Refs
from com.bea.wli.sb.management.configuration import CommonServiceConfigurationMBean
from com.bea.wli.sb.management.configuration import SessionManagementMBean
from com.bea.wli.sb.management.configuration import ProxyServiceConfigurationMBean
from com.bea.wli.monitoring import StatisticType
from com.bea.wli.monitoring import ServiceDomainMBean
from com.bea.wli.monitoring import ServiceResourceStatistic
from com.bea.wli.monitoring import StatisticValue
from com.bea.wli.monitoring import ResourceType
 
Two important MBeans that must be used are OSB(ALSB) specific MBeans:

  • ALSBConfigurationMBean for managing an manipulating resources in your OSB Domain
  • ServiceDomainMBean for monitoring statistics for service

Next section is to list the Projects

As reference typeID you have to choose PROJECT_REF.
 
Listed:

In the following sections I listed the proxy and business services in my Domain. See the code:

I used the findService to do a complete search within the configuration MBean. See listed Proxy and Business Services.

This is the way to do this. In part 2 (later on) I will describe the statistics monitoring. If you want the code, please leave a message below with your email so I can send it to you.

OVER DE AUTEUR

Started in pharmacy, I made the change to IT in 1996. I am an Oracle Fusion Middleware Architect at Qualogy, as member of the Exalogic Squad team, with focus on technical infrastructure, Serverside solutions, installing, administering, configuring the Oracle Fusion Middleware stack. My experience is from integrations at telco´s using Oracle AIA, Oracle Portal, OID, Forms&Reports, Discoverer upto the latest Oracle WebLogic 11g and 12c, plus releases with practically all Oracle products running on top of it. This 2012 he became an Oracle ACE.

26 Reacties op Oracle Service Bus 11g: listing projects and services with WLST – part 1

  1. Ranga schreef:

    Hi Michel,
    This is very useful script.
    Can you please send me the code?
    -Ranga

  2. Pradip Gupta schreef:

    Michel,

    Thanks for sharing the useful script. I would also like to have the code. and also waiting for your next steps ..

    Thanks again

    Regards,

    Pradip

  3. Nazeer Ballim schreef:

    Hi Michel,

    This would come in handy in out production environment, would really appreciate the source. Thumbs up to your efforts

    Cheers

  4. Xander van Rooijen schreef:

    Michel,

    Which benefits do you get from doing it this way, rather then using the OSB / ALSB dashboard functionality? Considering alerting, monitoring etc is enabled on all services?

    With regards,
    Xander

    • Hi Xander

      This is a beginscript which I will extend with statistics. Using just the console is not a bad option, but in a huge environment with massive services and a bulkload of messages, the console is not sufficient for pro-active monitoring. Either you use an out of the box product like OEM GridControl or you use scripting with email notifications

      kind regards

      Michel

      • Xander van Rooijen schreef:

        Michel,

        Today i wanted to check which proxies in OSB where enabled and which were disabled. With that in mind, i thought about this blog and thought your script could help with this.

        Could you share the used script?

        Thanks in advance.

        With regards,
        Xander

  5. abhay kumar schreef:

    Hi,
    This would be very helpful in monitoring the services. Great work. Please send the code.

  6. Rajan Arkenbout schreef:

    Very interesting stuff! Would love to see the code complete, Great Effort!

    Thanks

  7. Dan Dobrin schreef:

    I’d like to see the code, thanks in advance.
    Dan

  8. kavin schreef:

    nice work. please send me the code.

  9. Igshaan schreef:

    Excellent Read, Please share the code ,Great Work!

  10. Hemamalini schreef:

    would like to see the code… thanks!!

  11. Mauricio schreef:

    Michel,
    Thanks for sharing the useful script. I would also like to have the code. Would love to see the code complete.
    Thanks again
    Regards,

  12. Pierluigi schreef:

    thanks a ton, Michel, thanks to you I managed to put together this JSP
    http://www.javamonamour.org/2012/08/jsp-to-list-all-osb-projects-deployed.html

    to display all resources in a OSB server…

    Incidentally if you could share the code to display also the performance statistics, that would be fabulous – my email is publicpierre at gmail dot com

    pierre

  13. Igshaan schreef:

    Excellent Read,Great Work!
    Can you please send me the code?

  14. Mette Stephansen schreef:

    Hello !

    I’m just beginning on monitoring WLS and OSB. We need to script the monitoring of queues, jdsc connections and services/aplications.

    Could you mail me the code from the above examples? They would be great to work from.

    regards
    Mette

  15. Very good schreef:

    Could you send me the code?

    Thk in advance
    L.

  16. Khang Nguyen schreef:

    It is very useful script, could you send me the source code?

    Thanks
    Khang

  17. Ran schreef:

    Hi Michael,
    I am looking to get more OSB configuration such as following using API programming, where can i get more details?

    Proxy name
    Proxy State
    EndPoint URI
    EndPoint Properties
    Dispatch Policy

    Similarly business service and MQ information, can u help?

    Regards
    Ran

  18. Rao Vidadala schreef:

    Hello Michel,
    Very nice article.. Could you please send me the code. Thanks very much..

    Rao Vidadala

  19. Jaisankar schreef:

    Thanks for sharing the nice article. Please let us have the code for SLA alerts.

  20. Franco schreef:

    Hi Michel,
    Great blog, and excellent post. It really seems like a great tool for large environments. Could you please share the code with us?
    Thanks!

  21. Jonas schreef:

    Can you please share the code with me?

  22. Zeljka schreef:

    Hi, can you please send me the code?
    Thank you

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Verplichte velden zijn gemarkeerd met *

De volgende HTML tags en attributen zijn toegestaan: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Contact

Hebt u vragen of suggesties?

Mail info@qualogy.com!


De Bruyn Kopsstraat 9

2288EC Rijswijk (ZH)

The Netherlands

+31.(0)70 319 5000

  • Tip

  • Blog

  • Tags

  • Now @QAFE.COM

  • Now @QPORTAL.NL

  • Reacties

  • Blijf in contact

    +31.(0)70 319 5000