Service Bus Pipeline Alerts
The Oracle Service Bus provides several monitoring mechanisms. These can be tweaked in the Enterprise Manager.
When I call this service with 'Maarten' and with 'John', I can see the created pipeline alerts in the Enterprise Manager.
Next I want to find the requests done by 'Maarten'. I'm not interested in John. I can search for the summary, but this only indicates the location in the pipeline where the alert occurred. I want to search the contents or description as it is called in the Enterprise Manager. Since clicking on every entry is not very time efficient, I want to use a script for that.
Search for pipeline alerts using WLST
At first I thought I could use a method like on: http://docs.oracle.com/cd/E21764_01/web.1111/e13701/store.htm#CNFGD275 in combination with the location of the file-store which is used for the alerts; servers/[servername]/data/store/diagnostics. The dump however of this filestore was not readable enough for me and this method required access to the filesystem of the applicationserver. I decided to walk the WLST path.
The below WLST lists the pipeline alerts where 'Maarten' is in the contents / description. I used the following script. The script works on Service Bus 11.1.1.6 and 12.1.3. You should of course replace the obvious variables like username, password, url, servername and searchfor.
import datetime
#Conditionally import wlstModule only when script is executed with jython
if __name__ == '__main__':
from wlstModule import *#@UnusedWildImport
print 'starting the script ....'
username = 'weblogic'
password = 'Welcome01'
url='t3://localhost:7101'
servername='DefaultServer'
searchfor='Maarten'
connect(username,password,url)
def get_children():
return ls(returnMap='true')
domainRuntime()
cd('ServerRuntimes')
servers=get_children()
for server in servers:
#print server
cd(server)
if server == servername:
cd('WLDFRuntime/WLDFRuntime/WLDFAccessRuntime/Accessor/DataAccessRuntimes/CUSTOM/com.bea.wli.monitoring.pipeline.alert')
end = cmo.getLatestAvailableTimestamp()
start = cmo.getEarliestAvailableTimestamp()
cursorname = cmo.openCursor(start,end,"")
if cmo.hasMoreData(cursorname):
records=cmo.fetch(cursorname)
for record in records:
#print record
if searchfor in record[9]:
print datetime.datetime.fromtimestamp(record[1]/1000).strftime('%Y-%m-%d %H:%M:%S')+' : '+record[3]+' : '+record[13]
cmo.closeCursor(cursorname)
cd('..')
The output in my case looks like:
2015-04-18 12:59:21 : Pipeline$HelloWorld$HelloWorldPipeline : HelloWorldPipelineRequest
2015-04-18 12:59:21 : Pipeline$HelloWorld$HelloWorldPipeline : HelloWorldPipelineResponse
2015-04-18 13:18:39 : Pipeline$HelloWorld$HelloWorldPipeline : HelloWorldPipelineRequest
2015-04-18 13:18:39 : Pipeline$HelloWorld$HelloWorldPipeline : HelloWorldPipelineResponse
Now you can extend the script to provide more information or lookup the relevant requests in the Enterprise Manager.
No comments:
Post a Comment