Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 820
  • Last Modified:

Jython script that parses a PervServletApp XML document :wasstats

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
crazywolf2010
Asked:
crazywolf2010
  • 6
  • 4
1 Solution
 
HonorGodCommented:
What version of Python are you using?
0
 
HonorGodCommented:
ok, I was able to recreate the same error using Python 2.6.5

Investigating.
0
 
crazywolf2010Author Commented:
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!

 
HonorGodCommented:
I wish the same could be said for the wasstat.py code.  :-)
0
 
HonorGodCommented:
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
 
crazywolf2010Author Commented:
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
 
HonorGodCommented:
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
 
crazywolf2010Author Commented:
Hi,
I am not sure what means by Unicode? Is there any way to verify it?

thanks
0
 
crazywolf2010Author Commented:
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
 
HonorGodCommented:
Super.  I'm glad to hear it.

Thanks for the grade & points.

Good luck & have a great day.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now