Oracle Service Bus 11g listing projects and services with wlst – part 1
Published on: Author: Michel Schildmeijer Category: OracleFor 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
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.
Is there any way we can extract the last modified date for any proxy or business service?
Hi Michel,
How can i monitor statusof a proxy or business services if it is disabled or enabled ?