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.pyFor 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 socketThis 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:
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
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 ALSBConfigurationMBeanTwo important MBeans that must be used are OSB(ALSB) specific MBeans:
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
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.
Hebt u vragen of suggesties?
Mail info@qualogy.com!
De Bruyn Kopsstraat 9
2288EC Rijswijk (ZH)
The Netherlands
+31.(0)70 319 5000
Hi Michel,
This is very useful script.
Can you please send me the code?
-Ranga
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
Hi Michel,
This would come in handy in out production environment, would really appreciate the source. Thumbs up to your efforts
Cheers
Hi Nazeer
I don’t have an email of you
Kind regards
Michel
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
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
Hi,
This would be very helpful in monitoring the services. Great work. Please send the code.
Very interesting stuff! Would love to see the code complete, Great Effort!
Thanks
I’d like to see the code, thanks in advance.
Dan
nice work. please send me the code.
Excellent Read, Please share the code ,Great Work!
would like to see the code… thanks!!
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,
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
Excellent Read,Great Work!
Can you please send me the code?
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
Could you send me the code?
Thk in advance
L.
It is very useful script, could you send me the source code?
Thanks
Khang
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
There is not that much documentation about the OSB ALSB Framework itself. You can find the javadocs at http://www.oracle.com/pls/as111160/lookup?id=OSBAG739
Hello Michel,
Very nice article.. Could you please send me the code. Thanks very much..
Rao Vidadala
Thanks for sharing the nice article. Please let us have the code for SLA alerts.
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!
Can you please share the code with me?
Hi, can you please send me the code?
Thank you