Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Jython script that parses a PervServletApp XML document :wasstats

Posted on 2010-09-06
10
Medium Priority
?
815 Views
Last Modified: 2013-12-11
Gents,
I am trying to get PervServletApp output analysed thru a wasstats script. I am using WAS 6.1 under ND deployment at RHEL 5.3/5.5
Details : https://code.google.com/p/imakerobots/wiki/wasstats

Currently I am getting  : (beanModule.xml is attached : it's PERF output data)
[was61@permon]$ /usr/bin/python wasstats.py beanModule.xml
Traceback (most recent call last):
 File "wasstats.py", line 443, in ?
   sqlsrv = getStatByName( jdbc, "WebSphere embedded ConnectJDBC driver for MS SQL Server" )
 File "wasstats.py", line 366, in getStatByName
   retval = getElementByName( root, "Stat", name )
 File "wasstats.py", line 338, in getElementByName
   elements = getElementsByType( root, nodetype )
 File "wasstats.py", line 353, in getElementsByType
   items = root.getElementsByTagName( nodetype )
AttributeError: 'NoneType' object has no attribute 'getElementsByTagName'
beanModule.xml
0
Comment
Question by:crazywolf2010
  • 6
  • 4
10 Comments
 
LVL 41

Expert Comment

by:HonorGod
ID: 33610686
What version of Python are you using?
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 33610705
ok, I was able to recreate the same error using Python 2.6.5

Investigating.
0
 

Author Comment

by:crazywolf2010
ID: 33610715
Thanks HonorGod. I added this in separate thread so that it's easy for me to follow.

Regards!
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 41

Expert Comment

by:HonorGod
ID: 33611315
I wish the same could be said for the wasstat.py code.  :-)
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 33612140
Revised & refactored code.  Unfortunately, wasstats.py wasn't written to provide any kinds of stats for the specified kind of file.

When I run this revised script against the specified  beanModule.xml file, I get:

C:\Programs\Jython\wasstats>python wasstats.py beanModule.xml
Processing: beanModule.xml
No statistics found: "Servlet Session Manager"
No statistics found: "JVM Runtime"
No statistics found: "Thread Pools"
No statistics found: "JDBC Connection Pools"
No statistics found: "Servlet Session Manager"
No statistics found: "JVM Runtime"
No statistics found: "Thread Pools"
No statistics found: "JDBC Connection Pools"

C:\Programs\Jython\wasstats>
wasstats.py.txt
0
 

Author Comment

by:crazywolf2010
ID: 33612346
Hi HonorGod,
We are getting there.

The https://code.google.com/p/imakerobots/wiki/wasstats page at end says
"Currently, this script only processes JVM Runtime, Session Manager, JDBC Connection Pool and Thread Pool statistics. Adding support for more would be fairly simple."

So I created a sample.xml file with above attributes JVM Runtime, Session Manager, JDBC Connection Pool and Thread Pool statistics using

http://Server1:9080/wasPerfTool/servlet/perfservlet?node=Server1_Node01&server=server_member1&module=connectionPoolModule+jvmRuntimeModule+servletSessionsModule+systemModule+threadPoolModule

- sample.xml
FILE attached

Errors listed below :
[was61@Server1 permon]$ /usr/bin/python wasstats.py sample.xml
Processing: sample.xml
INFO|server_member1:Server1_Node01:CTI_war#CTI.war:RangeStatistic:0:0.0:1283788583899:0:0.0:LiveCount:1283528345968:N/A:0
INFO|server_member1:Server1_Node01:SuperSnoop#SuperSnoopWeb.war:RangeStatistic:0:0.0:1283788583899:0:0.0:LiveCount:1283528346720:N/A:0
INFO|server_member1:Server1_Node01:perfServletApp#perfServletApp.war:RangeStatistic:0:0.0:1283788583899:0:0.0:LiveCount:1283528346768:N/A:0
INFO|server_member1:Server1_Node01:prdbutil_war#prdbutil.war:RangeStatistic:0:0.0:1283788583899:0:0.0:LiveCount:1283528346199:N/A:0
INFO|server_member1:Server1_Node01:prpc_j2ee14#prweb.war:RangeStatistic:2:6441402.0:1283788583899:0:0.02475209353099045:LiveCount:1283528347245:N/A:0
INFO|server_member1:Server1_Node01:prsysmgmt_war#prsysmgmt.war:RangeStatistic:0:0.0:1283788583899:0:0.0:LiveCount:1283528346376:N/A:0
CHECK|OK:HeapSize:Server1_Node01:server_member1:JVM Runtime:1048576/2097152:(50%)|1048576:0.0:1283788583896:1048576:1048576:0.0:1283528313727:2097152:1048576:KILOBYTE
INFO|server_member1:Server1_Node01:JVM Runtime:BoundedRangeStatistic:1048576:0.0:1283788583896:1048576:1048576:0.0:HeapSize:1283528313727:KILOBYTE:2097152:1048576
INFO|server_member1:Server1_Node01:JVM Runtime:CountStatistic:688987:1283788583896:UsedMemory:1283528313726:KILOBYTE
INFO|server_member1:Server1_Node01:JVM Runtime:CountStatistic:260270:1283788583896:UpTime:1283528313726:SECOND
INFO|server_member1:Server1_Node01:JVM Runtime:CountStatistic:0:1283788583899:ProcessCpuUsage:1283528313723:N/A
Traceback (most recent call last):
  File "wasstats.py", line 600, in ?    analyze( xmldoc );  File "wasstats.py", line 202, in analyze    name = pool.getAttribute( 'name' );UnboundLocalError: local variable 'pool' referenced before assignment

sample.xml
0
 
LVL 41

Accepted Solution

by:
HonorGod earned 2000 total points
ID: 33612928
oops, that's a typographical error on my part.  Sorry.

Unfortunately, when I tried to use it to process the sample.xml file that you attached above, it seemed to have trouble with a Unicode file.  Is the sample.xml on your system Unicode?
wasstats.py.txt
0
 

Author Comment

by:crazywolf2010
ID: 33615728
Hi,
I am not sure what means by Unicode? Is there any way to verify it?

thanks
0
 

Author Comment

by:crazywolf2010
ID: 33615744
Excellent... it's working well.

[was61@Server1 permon]$ /usr/bin/python wasstats.py sample.xml
Processing: sample.xml
INFO|server_member1:Server1_Node01:CTI_war#CTI.war:RangeStatistic:0:0.0:1283788583899:0:0.0:LiveCount:1283528345968:N/A:0
INFO|server_member1:Server1_Node01:SuperSnoop#SuperSnoopWeb.war:RangeStatistic:0:0.0:1283788583899:0:0.0:LiveCount:1283528346720:N/A:0
INFO|server_member1:Server1_Node01:perfServletApp#perfServletApp.war:RangeStatistic:0:0.0:1283788583899:0:0.0:LiveCount:1283528346768:N/A:0
INFO|server_member1:Server1_Node01:prdbutil_war#prdbutil.war:RangeStatistic:0:0.0:1283788583899:0:0.0:LiveCount:1283528346199:N/A:0
INFO|server_member1:Server1_Node01:prpc_j2ee14#prweb.war:RangeStatistic:2:6441402.0:1283788583899:0:0.02475209353099045:LiveCount:1283528347245:N/A:0
INFO|server_member1:Server1_Node01:prsysmgmt_war#prsysmgmt.war:RangeStatistic:0:0.0:1283788583899:0:0.0:LiveCount:1283528346376:N/A:0
CHECK|OK:HeapSize:Server1_Node01:server_member1:JVM Runtime:1048576/2097152:(50%)|1048576:0.0:1283788583896:1048576:1048576:0.0:1283528313727:2097152:1048576:KILOBYTE
INFO|server_member1:Server1_Node01:JVM Runtime:BoundedRangeStatistic:1048576:0.0:1283788583896:1048576:1048576:0.0:HeapSize:1283528313727:KILOBYTE:2097152:1048576
INFO|server_member1:Server1_Node01:JVM Runtime:CountStatistic:688987:1283788583896:UsedMemory:1283528313726:KILOBYTE
INFO|server_member1:Server1_Node01:JVM Runtime:CountStatistic:260270:1283788583896:UpTime:1283528313726:SECOND
INFO|server_member1:Server1_Node01:JVM Runtime:CountStatistic:0:1283788583899:ProcessCpuUsage:1283528313723:N/A
CHECK|OK:PoolSize:Server1_Node01:server_member1:Default:5/100:(5%)|10:1.303999271E9:1283788583899:1:5:5.010175044932727:1283528313697:100:5:N/A
INFO|server_member1:Server1_Node01:Default:BoundedRangeStatistic:10:1.303999271E9:1283788583899:1:5:5.010175044932727:PoolSize:1283528313697:N/A:100:5
CHECK|CRITICAL:PoolSize:Server1_Node01:server_member1:HAManager.thread.pool:2/2:(100%)|2:5.2047867E8:1283788583899:1:2:1.9997628080374719:1283528313697:2:2:N/A
INFO|server_member1:Server1_Node01:HAManager.thread.pool:BoundedRangeStatistic:2:5.2047867E8:1283788583899:1:2:1.9997628080374719:PoolSize:1283528313697:N/A:2:2
CHECK|OK:PoolSize:Server1_Node01:server_member1:Message Listener:0/50:(0%)|10:0.0:1283788583899:10:10:0.0:1283528313697:50:0:N/A
INFO|server_member1:Server1_Node01:Message Listener:BoundedRangeStatistic:10:0.0:1283788583899:10:10:0.0:PoolSize:1283528313697:N/A:50:0
CHECK|OK:PoolSize:Server1_Node01:server_member1:Object Request Broker:0/50:(0%)|10:0.0:1283788583899:10:10:0.0:1283528313697:50:0:N/A
INFO|server_member1:Server1_Node01:Object Request Broker:BoundedRangeStatistic:10:0.0:1283788583899:10:10:0.0:PoolSize:1283528313697:N/A:50:0
CHECK|OK:PoolSize:Server1_Node01:server_member1:ProcessDiscovery:1/2:(50%)|1:2.5928954E8:1283788583899:1:1:0.9966172837551133:1283528414279:2:1:N/A
INFO|server_member1:Server1_Node01:ProcessDiscovery:BoundedRangeStatistic:1:2.5928954E8:1283788583899:1:1:0.9966172837551133:PoolSize:1283528414279:N/A:2:1
CHECK|OK:PoolSize:Server1_Node01:server_member1:SIBFAPInboundThreadPool:2/50:(4%)|4:5.20254968E8:1283788583899:1:4:1.9989522093993581:1283528320064:50:2:N/A
INFO|server_member1:Server1_Node01:SIBFAPInboundThreadPool:BoundedRangeStatistic:4:5.20254968E8:1283788583899:1:4:1.9989522093993581:PoolSize:1283528320064:N/A:50:2
CHECK|OK:PoolSize:Server1_Node01:server_member1:SIBFAPThreadPool:3/50:(6%)|4:7.60451275E8:1283788583899:1:4:2.9233778697579353:1283528456297:50:3:N/A
INFO|server_member1:Server1_Node01:SIBFAPThreadPool:BoundedRangeStatistic:4:7.60451275E8:1283788583899:1:4:2.9233778697579353:PoolSize:1283528456297:N/A:50:3
CHECK|OK:PoolSize:Server1_Node01:server_member1:SoapConnectorThreadPool:2/5:(40%)|3:5.20338761E8:1283788583899:1:3:1.999267779975942:1283528319233:5:2:N/A
INFO|server_member1:Server1_Node01:SoapConnectorThreadPool:BoundedRangeStatistic:3:5.20338761E8:1283788583899:1:3:1.999267779975942:PoolSize:1283528319233:N/A:5:2
CHECK|OK:PoolSize:Server1_Node01:server_member1:TCPChannel.DCS:4/20:(20%)|5:1.041063168E9:1283788583899:1:5:3.999951342641484:1283528314941:20:4:N/A
INFO|server_member1:Server1_Node01:TCPChannel.DCS:BoundedRangeStatistic:5:1.041063168E9:1283788583899:1:5:3.999951342641484:PoolSize:1283528314941:N/A:20:4
CHECK|OK:PoolSize:Server1_Node01:server_member1:WebContainer:8/100:(8%)|10:1.832855037E9:1283788583899:1:10:7.044842168064254:1283528414119:100:8:N/A
INFO|server_member1:Server1_Node01:WebContainer:BoundedRangeStatistic:10:1.832855037E9:1283788583899:1:10:7.044842168064254:PoolSize:1283528414119:N/A:100:8
No statistics found: "DB2 Universal JDBC Driver Provider"
No statistics found: "WebSphere embedded ConnectJDBC driver for MS SQL Server"
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 33616624
Super.  I'm glad to hear it.

Thanks for the grade & points.

Good luck & have a great day.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most of the developers using Tomcat find it easy to configure the datasource in Server.xml and use the JNDI name in the code to get the connection.  So the default connection pool using DBCP (or any other framework) is made available and the life go…
This article is about some of the basic and important steps to be used to improve the performance in web-sphere commerce application development. 1) Always leverage the Dyna-caching facility provided by the product 2) Remove the unwanted code …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Loops Section Overview
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question