Oracle Service Bus 11g: statistics projects and services with WLST – part 2

Hi all

As a follow-up on my earlier blogpost about how to list all your projects and services in your OSB domain, I’ve extended the script with some count statistics. Look at this screenshot below. I blacked out the names for the services.



In the example I’ve used I extended it with some statistic counts on some Proxy services. Now at this moment the script errors out on non monitored services, but that is because I did not implement a check if a service is monitored or not. Which should be done by checking if the value of isMonitoringEnabled in the CommonServiceConfigurationMBean is set to true.

Look below at some of the code. The first section is to get the list of projects and their proxy or business services (in my example I used proxy services). With a for loop on the getAllResourceStatistics method I filtered out the statistics I’d like to see: some counts about pipeline and SLA.


Now this is of course a beginning, you can build, customize and cosmetize your script to you own needs with all kinds of colors for high error rates. For example you can implement an if statement if your error rates raise above a certain level and colorize it with terminal colours (red '33[1;31m').

My next challenge is to filter out those services which are not enabled for monitoring, but that will be for a next time.


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: This blog is also being published at: thanks to Jürgen Kress

38 Reacties op Oracle Service Bus 11g: statistics projects and services with WLST – part 2

  1. Elvedin schreef:


    Thax for investing time in such useful things. Can you share with me the script as well.

    Thank you

  2. Enio machado schreef:

    Hi Michel,
    Can you share with me the script?

    Thank you,

  3. Praful schreef:

    Hi Michel,

    can you please share the code for this too.


  4. Norberto Enomoto schreef:

    Hi Michel,

    Excellent work.
    Can you please share the code.


    Norberto Enomoto

  5. Ronen schreef:

    Hi Michel,
    can you please share the code for this too.

  6. Brian Orozco schreef:

    This is very useful. I’m beginning with WLST and could use the source from both parts 1 and 2 as a reference. Please send both.



  7. Hi Michel schreef:

    Hi Michel

    Can you please send me the script for part 2.


  8. Reper Arnaud schreef:

    Nice post! Great job! I’m actually looking in howto export the pipeline alerts out of the console. Could you share me your WLST script as a starting point? Which libraries should be added to the setWLSEnv? I’m missing the ServiceDomainMBean and some other MBean.



  9. Elvedin schreef:


    Thanx for update. Can you share script with me as well.

    Thank you

  10. ck schreef:

    please share the code
    txs for your time

  11. TML schreef:

    Very interesting. I kept running into issues using jmx in Java, so a pure WLST approach would be nice. Could you email me the script please?

  12. Luiz schreef:

    Hi Michel,

    Could you please send me the code?

  13. Amol Trigune schreef:

    Hi Michel,

    Could you please send me the code?
    Amol Trigune

  14. Amol Trigune schreef:

    Hi Michel,

    I preparing monitoring script for our domain, but i am stuck because of following error.

    Proxy service : FinnoneCollections_OSB_Integration/Resources/AlertDestinations/polling service
    Traceback (innermost last):
    File “”, line 1, in ?
    File “”, line 27, in ?
    com.bea.wli.monitoring.MonitoringException: [MonitoringRuntime:473057]Failed to get statistics for services due to java.rmi.UnknownHostException: Could not discover administration U
    RL for server ‘osb_server1’
    at com.bea.wli.monitoring.ServiceDomain.getStatisticsForServices(
    at com.bea.wli.monitoring.ServiceDomain.getServiceStatistics(
    at com.bea.wli.monitoring.ServiceDomain.getProxyServiceStatistics(
    at com.bea.wli.monitoring.DelegatedServiceDomainMBeanImpl.getProxyServiceStatistics(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(

    Thanks & Regards,
    Amol Trigune

    • Michel schreef:

      Hi Amol
      It seems like either:
      Your AdminServer url is either wrong or unreachable.
      It should be t3://:
      Could you send me the content of your script?

      kind regards

      Kind regards

  15. Michel schreef:

    format should be t3://:

  16. Amol Trigune schreef:

    Hi Michel,

    I have prepared script using your blog, Here is code of same.

    import time
    import sys
    url = ‘t3://’
    connect(username, password,url)
    from import ALSBConfigurationMBean
    from com.bea.wli.config import Ref
    from java.lang import String
    from com.bea.wli.config import Ref
    from import Refs
    from import CommonServiceConfigurationMBean
    from import SessionManagementMBean
    from 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
    saveout = sys.stdout
    LogFile = open(‘/home/osb/scrOutput/PROXY_SERVICES.csv’, ‘a’)
    sys.stdout = LogFile
    alsbCore = findService(ALSBConfigurationMBean.NAME, ALSBConfigurationMBean.TYPE)
    it = refs.iterator()
    while it.hasNext():
    r =
    if r.getTypeId() == Ref.PROJECT_REF:
    print “Project Nam3 : “+(r.getProjectName())
    allRefs= alsbCore.getRefs(Ref.DOMAIN)
    for ref in refs:
    typeId = ref.getTypeId()
    if typeId == “ProxyService”:
    print “Proxy Sevice : ” + ref.getFullName ()
    stat = cmo.getProxyServiceStatistics([ref],ResourceType.SERVICE.value(),”)
    for ps in stat[ref].getAllResourceStatistics():
    for s in ps.getStatistics():
    if s.getType() == StatisticType.COUNT:
    CType = str(s.getType())
    CCount = str(s.getCount())
    print s.getName() + “(“+str(s.getType()) +”: ” + str(s.getCount())
    if s.getType() == StatisticType.INTERVAL:
    print s.getName() + “(“+str(s.getType()) +”: ” + str(s.getMin()) + ” ” + str(s.getMax()) + ” ” + str(s.getAvrage())
    IType = str(s.getType())
    IMin = str(s.getMin())
    Imax = str(s.getMax())
    IAverage = str(s.getAvrage())
    if s.getType() == StatisticType.STATUS:
    print s.getName() + “(“+str(s.getType()) +”: ” + str(s.getCurrentStatus())
    SType = str(s.getType())
    SCrState = str(s.getCurrentStatus())
    Print ref.getFullName ()+’,’+ SType +’,’+ CCount +’,’+ IMin +’,’+ Imax +’,’+ IAverage
    sys.stdout = saveout

    Amol Trigune

    • Michel schreef:

      Please look at url: = ‘t3://’

      On which host is your osb_server1 running? On the same host as the WLS AdminServer?
      If yes, is the above IP valid
      If it runs on a separate host, is it reachable?

      kind regards


  17. Amol Trigune schreef:

    Hi Michel,

    I have solved that error. It is because of in our test environment we have configured cluster for OSB. After starting both instance script is working fine.

    Amol Trigune

  18. Amol Trigune schreef:

    Hi Michel,

    Using above script we get statistics collected since last reset.
    Is there any way to collect current statistics.

    Thanks and Regards,
    Amol Trigune

  19. matias schreef:

    Hi Michel,

    do you know if exist a way to enable messaging tracing from wlst?


  20. Suman schreef:

    Hi Michel,

    Can you please send me the Script code?

    Thanks and Regards,
    Suman V

  21. Rodrigo Melgar schreef:

    Hi Michel, can you please share the code for this too. you save me 😀

    Thanks Man

  22. Brandon schreef:

    Another great post. Thanks for the quick response on the other request. Code for this too please. :)

  23. Najam schreef:

    Please share the script and the code


  24. Hello, could give me the code, including the validation if this enabled the monitoring of the service.


  25. Saqib schreef:

    I am getting following error while excuting upper script

    [oracle@tsi-admin-dev-1 tsi_dev]$ java weblogic.WLST

    Initializing WebLogic Scripting Tool (WLST) …

    Welcome to WebLogic Server Administration Scripting Shell

    Type help() for help on available commands

    Problem invoking WLST – Traceback (innermost last):
    (no code object) at line 0
    File “/u01/app/oracle/10.3.6/user_projects/domains/tsi_dev/”, line 25
    r =
    SyntaxError: invalid syntax

  26. Saqib schreef:

    It will be good if you could share script with me via email

  27. Saqib schreef:

    I just copy and paste the upper script which Amol send to you for verification

    Please send me the script and code and kindly tell me the steps how to run that. Thanks a bunch

  28. Saqib schreef:


    First of all Thanks could you please let me know the way to run the script , i am doing following procedure to run the attached script.

    1. first i run this command


    2. java weblogic.WLST

    After running the script which you sent to me i am getting following error ….. please help me in that

    Initializing WebLogic Scripting Tool (WLST) …

    Welcome to WebLogic Server Administration Scripting Shell

    Type help() for help on available commands

    Problem invoking WLST – Traceback (innermost last):
    (no code object) at line 0
    File “/u01/app/oracle/10.3.6/user_projects/domains/tsi_dev/”, line 65
    if s.getType() == StatisticType.STATUS:
    SyntaxError: invalid syntax



  29. Saqib schreef:

    Still waiting for your kind reply on above post……….

  30. Valeria Chiran schreef:

    Hi Michel,

    Thank you for this very useful article!
    May I ask you to send me the code?

    Thank you,

  31. Vadym schreef:

    Hi Michel,
    Great job! Very interesting article.
    I have some problems with writing the script like yours.
    Could you please send me your code?


Geef een reactie

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


Hebt u vragen of suggesties?


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