Home | Previous | Next
3.8.4 Monitoring MBeans statistics with wsadmin
Overview
When WXS is deployed with WAS, the wsadmin tool can be used to...
- Get a reference to the WXS MBeans using the AdminControl scripting object
- Invoke the exposed operations on WXS MBeans using AdminControl scripting object
For example, to get statistics for a cache instance...
nodeSpecification = ",node=" + nodeName queryString = "type=DynaCache,process=" + serverName + nodeSpecification + ",*" mbean = AdminControl.queryNames(queryString) cacheInstances = AdminControl.invoke(mbean,"getCacheInstanceNames").split(linesep) stats = AdminControl.invoke(mbean, "getAllCacheStatistics", cacheInstance).split(linesep)
DynaCacheStatisticsCSV.py
To collect cache statistics using MBeans, and store data to a CSV file, you can run...
$ ./wsadmin.sh -user wasadmin \ -password wasadmin \ -lang jython \ -f DynaCacheStatisticsCSV.py \ server1 \ dyna_cache.log \ "-cacheInstance baseCache -sleepUnit seconds -sleepInterval 10" *sys-package-mgr*: processing modified jar, 'C:\Program Files\IBM\WebSphere\AppServer\lib\wsobjectgrid.jar' *sys-package-mgr*: processing modified jar, 'C:\Program Files\IBM\WebSphere\AppServer\lib\wsogclient.jar' WASX7209I: Connected to process "dmgr" on node deepkhanCellManager01 using SOAP connector; The type of process is: DeploymentManager WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[server1, dy na_out.log, -cacheInstance baseCache -sleepUnit seconds -sleepInterval 10]" ['-cacheInstance', 'baseCache', '-sleepUnit', 'seconds', '-sleepInterval', '10'] DEBUG INFO: serverName= server1 version= majorVersion= minorVersion= fileName= dyna_out.log nodeName= thinkNode01 instanceName= baseCache sleepUnit= seconds sleepInterval= 10 sleepMilliseconds= 10000 fileAppend= false instance: baseCache
The script sends output to a CSV file every ten seconds, and uses the baseCache cache instance (Default cache instance in WAS).
Paste CSV file output into a spreadsheet such as eXcel to create graphs.