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, Michel made the change to IT in 1996, on a UNIX TTY terminal based computer and the MUMPS language. These days he is 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. He started in 2000 as a support analyst for a big bank with BEA Tuxedo 6.5 and WebLogic 6. His experience is from integrations at telco´s. He now works mainly with Oracle WebLogic 11g and 12c, plus releases with practically all Oracle products running on top of it. In 2012 he became an Oracle ACE and wrote 2 books about WebLogic: http://www.packtpub.com/oracle-weblogic-server-11gr2-administration-essentials/book http://www.packtpub.com/oracle-weblogic-server-12c-first-look/book.

55 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

      • Praveen schreef:

        Hi Michel,

        Since you mentioned we can use OEM 11g for such monitoring let me ask you something on OEM.
        Currently we are using OEM 12c and we are newbies to OEM.
        Please let me know how can we proactively monitor such functionality voa OEM.
        Please note that we are just one of the users of OEM and we dont have super user access to OEM 12c.

        thanks
        Kumar

        • Hi Praveen

          There are many ways to do monitoring.
          For OEM12c, fisrst thing is to have set basic things like an agent running on you OSB hosts, middleware management pack enabled for your OSB domain on OEM12c

          Important then is to monitoring basic things like:
          Are my server instances up
          How is CPU/Memory doing
          How are JVM instances doing

          Deeper dive into OSB leads you to the items you also monitor without OEM12c like
          Pipeline and SLA Alerts
          Service Metrics like min max response, operation metrics etc etc

          And apply al these into a monitoring template including watches and notifications.
          If you are just user in OME12c, you should do this together with you OEM admin or get the permission to do this for you OSB domain ( it doesn’t require super user access, just a good and clear thought of what permissions should be given and what not.

          Anyway, if you need more help, please contact me via our company, and we can work it out together.

          Kind regards

          Michel

  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

  23. Rajan Arkenbout schreef:

    Excellent example, would be nice to share the code!

  24. Enio machado schreef:

    Hi Michel,
    Can you please share the code with me?

    Thank you,
    Enio

  25. Jerczey schreef:

    Hello Michel

    Very nice example! Can you please share the code with me ?

    Thank you for your work, keep it up!

  26. Praful schreef:

    Hi Michel,

    Excellent work and very useful.
    Can you please share the code.

    Thanks,
    Praful

  27. Norberto Enomoto schreef:

    Hello,

    Nice script.
    Can you please share the code.

    Thanks,

    Norberto Enomoto

  28. Hi Michel schreef:

    This script will do wonders for my team. Can I please get the script as well.

    Thanks,
    Rooswald

  29. Roberto schreef:

    Very useful script!
    Cna you please share the code?

    Tnx

  30. Amit schreef:

    Very useful script!

    Can you please share the code? Also do you know if you can use wlst to create resource in a project?

  31. Fabrício Soares schreef:

    Hi Michael can you please share the code?
    This is very useful to me.

    Thnaks in advanced.
    Fabrício Soares

  32. Salvatore Di Salvo schreef:

    Excellent work !
    Can you please share the code ?

    Thanks,
    Salvo

  33. Fr schreef:

    A Great Work.
    Can you please send me the code ?
    Thanks

  34. Vishal schreef:

    Hi,
    I very much like this article. I need wslt scripts for listing all the deployed composites and for monitoring statistics.
    Can you please share at my email id: vishal.ras@gmail.com

    Thanks,
    Vishal

  35. ck schreef:

    Nice work!!, please share the code

  36. Arnab schreef:

    Great work Michel, it will be really helpful if you can send me the code. Do you also have the java code for doing the same? One of my other requirement is to find the business services being used by a specific proxy service.i,e something like the following : loop through and print all the proxy services in an OSB environment and list out the business services being invoked by a specific proxy service. Can this be also achieved through a wlst script or jmx?

    Thanks In Advance
    Arnab

  37. Kalyan schreef:

    HI

    Can you send me the script to find the all the proxy and business service

    Thanks
    Kalyan

  38. Kalyan schreef:

    Hi

    Thanks in advance

    Thanks
    Kalyan

  39. Julio Cesar Rodriguez Ibague schreef:

    Hi Michel.

    Excellent information .. Might you give me the code, also if you have information or procedure to make changes or deployments and osb same operations, but soa.
    Thank you very much, that good information.

  40. Indraneel schreef:

    Hi Michel,
    Thanks a lot for the informative articles. It’s a delight to read those stuff. Needless to say I would love to have the script! I will appreciate if you can email it to me.
    Thanks!!

  41. Enio schreef:

    Hi Michel,
    is possible list in the script teh Endpoint URI from the BS and PS?

    Thank you,
    Enio

  42. Enio schreef:

    Hi Michel,
    i found how to do it…

    Thank you.

  43. Christian schreef:

    Hi, good article.

    I need to know that is possible to get de endpoint uri’s form Proxy Services and Business Service.

    If you can help me with that, i would appreciate

    thanks

  44. Wayne Highland schreef:

    Hi Michel,

    Very interested in your article, would be great if I could get a copy of the script you use.

    Thanks again

  45. Andre schreef:

    Very nice article, could you send the source code?

  46. Ganesh umar schreef:

    Hi Michel,

    Good to see How an analyst grown dso big, I am also trying to follow you :)

    I am trying to develop a Java Code to extract complete Path for any PS or BS.

    Can you please suggest How I can do that? Also can you please send me complete code for example illustrated in this thread.

    A big thanks in advance.

  47. manu schreef:

    I am very new to OSB and this blog is really very helpful. Could you please share wslt source to deploy OSB Jar and ALSB plan(config plan) recursively.

  48. Victor Perez schreef:

    Hi, good day and thank you very much for your input. Might I send you the code, please.

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 class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

Contact

Hebt u vragen of suggesties?

Mail info@qualogy.com!


De Bruyn Kopsstraat 9

2288EC Rijswijk (ZH)

The Netherlands

+31.(0)70 319 5000

  • Blog

  • Tags

  • @qualogy_news

  • @qresources

  • Reacties

  • Blijf in contact

    +31.(0)70 319 5000