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

Michel started his career as a medical officer in the Royal Dutch Airforce, with a focus on pharma. After the air force, he continued in pharma, followed by time working in clinical pharmacology. While there, he transitioned to IT by learning UNIX and MUMPS, and developed a system for managing patients’ medical records. As his career developed, his responsibility shifted from a deep technical perspective to a more visionary role. At the end of 2011, Michel authored a book on WebLogic Administration for beginners. He joined Qualogy in April 2012 where he expanded his repertoire significantly, serving a wide range of customers with his knowledge about Java Application Servers, Middleware and Application Integration. He also increased his multiple-industry knowledge in his role as Solutions or IT architect by working for customers in a range of sectors, including financials, telecom, public transportation and government organizations. In 2012, he received the IT Industry-recognized title of Oracle ACE for being an ambassador and community leader in his area of expertise. In 2019, this was enhanced to Oracle ACE Director. Michel is asked regularly to speak about technology and the impact of innovation at national and international conferences such as KubeCon, Oracle OpenWorld, Groundbreakers Developers Tours and others. He contributes actively to the OpenSource community and solutions regarding containerization, CI/CD and DevOps. In October 2021, Michel took an exciting step in his career by becoming Business Unit Manager for Qualogy Managed Services. While he still has a finger on the pulse in terms of technology, he is expanding his scope by combining his experience with the new insights gained in his new position. Read more via blog: https://bit.ly/3fAxrqf | Medium: https://mschildmeijer.medium.com/ | Books: Oracle Weblogic Server 11gR1 PS2: Administration Essentials: https://bit.ly/3IhALmf | Oracle WebLogic Server 12c: First Look1: https://bit.ly/31olbpj

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