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

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

Gepubliceerd: Categorie: Oracle

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:

  1. 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:

  1. # Set some constants
  2. username='weblogic'
  3. password='<>'
  4. import socket
  5. localhost = socket.gethostname()
  6. import os
  7. domain = os.getenv('WL_DOMAIN')
  8. domain_dir= os.getenv('WL_DOMAIN_DIR')
  9. mwHome = os.getenv('MW_HOME')
  10. print mwHome
  11. url = 't3://' + localhost + ':<>'
  12. 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:

  1. 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

  1. connect(username, password,url)
  2. from com.bea.wli.sb.management.configuration import ALSBConfigurationMBean
  3. from com.bea.wli.config import Ref
  4. from java.lang import String
  5. from com.bea.wli.config import Ref
  6. from com.bea.wli.sb.util import Refs
  7. from com.bea.wli.sb.management.configuration import CommonServiceConfigurationMBean
  8. from com.bea.wli.sb.management.configuration import SessionManagementMBean
  9. from com.bea.wli.sb.management.configuration import ProxyServiceConfigurationMBean
  10. from com.bea.wli.monitoring import StatisticType
  11. from com.bea.wli.monitoring import ServiceDomainMBean
  12. from com.bea.wli.monitoring import ServiceResourceStatistic
  13. from com.bea.wli.monitoring import StatisticValue
  14. from com.bea.wli.monitoring import ResourceType

Important MBeans

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.

Michel Schildmeijer
Over auteur Michel Schildmeijer

Having made his start in the pharmacy sector, Michel transitioned to IT in 1996, working on a UNIX TTY terminal-based system and the MUMPS language. He currently works as a solutions architect at Qualogy, with a focus on middleware, application integration and service-oriented architecture. His passion for middleware started in 2000 when working as a support analyst for a financial institute with BEA WebLogic and Tuxedo. Michel is an expert on the WebLogic platform. He serves customers in his role as architect and advises them in all aspects of their IT landscape. He became an Oracle ACE in 2012 and wrote two books about WebLogic: Oracle WebLogic Server 11gR1 PS2: Administration Essentials and Oracle WebLogic Server 12c: First Look. He is a well-known speaker at national and international conferences and is recognised as an official Oracle Speaker. Read his blog: https://community.oracle.com/blogs/mnemonic

Meer posts van Michel Schildmeijer
Reacties (2)
  1. om 08:08

    Is there any way we can extract the last modified date for any proxy or business service?

  2. om 21:09

    Hi Michel,

    How can i monitor statusof a proxy or business services if it is disabled or enabled ?

Reactie plaatsen