When I need to monitor some realtime stats on WAS using wsadmin, this is the process I go through....
- Fire up a wsadmin command line, you'll now be at the wsadmin> prompt
- Grab an array full of the particular objects you want to monitor. In this example I need to get stats from ThreadPools, so I run tps = AdminControl.queryNames('type=ThreadPool,*').splitlines()
- tps is now a PyList containing a shed load of ThreadPool objects
- So let's pull a random one out for investigation by running tp = tps[1]
- if you type tp the object will be printed to the screen.. it'll look something like this ...
'WebSphere:name=BPESchedulerWorkManager.Alarm Pool,process=PSUAT003.AppTarget_2.plbpmu07psuat003node001.0,platform=dynamicproxy,node=plbpmu07psuat003node001,version=7.0.0.25,type=ThreadPool,mbeanIdentifier=BPESchedulerWorkManager.Alarm Pool,cell=psuat003cell001,spec=1.0'
- Let's see what type of attributes this type of object has by running print Help.attributes(tp). This gives the following output...
Attribute Type Access
name java.lang.String RO
maximumSize int RW
minimumSize int RW
inactivityTimeout long RW
growable boolean RW
stats javax.management.j2ee.statistics.Stats RO
- Let's also see what type of operations we can invoke on this type of object has by running
print Help.operations(tp). This gives the following output...
java.lang.String getName()
int getMaximumPoolSize()
void setMaximumPoolSize(int)
int getMinimumPoolSize()
void setMinimumPoolSize(int)
long getKeepAliveTime()
void setKeepAliveTime(long)
boolean isGrowAsNeeded()
void setGrowAsNeeded(boolean)
javax.management.j2ee.statistics.Stats getStats()
- Seems to me that the stats attribute might be interesting... we can take a look with print AdminControl.getAttribute(tp, 'stats')
- This will return a horibly formatted PyString simiolar to the one below. Put this through a splash of regex to pull out the stats you need and you're done.
'\n
Stats
name=BPESchedulerWorkManager.Alarm Pool, type=threadPoolModule\n
{
\n
name=ActiveCount,
ID=3,
description=The number of concurrently active threads.,
unit=N/A,
type=BoundedRangeStatistic,
lowWaterMark=0,
highWaterMark=1,
current=0,
integral=10121.0,
lowerBound=0,
upperBound=0
\n\n
name=PoolSize,
ID=4,
description=The average number of threads in a pool.,
unit=N/A,
type=BoundedRangeStatistic,
lowWaterMark=1,
highWaterMark=10,
current=1,
integral=0.0,
lowerBound=10,
upperBound=10\n
}'
No comments:
Post a Comment