Tuesday, March 12, 2013

Generating Weblogic server JVM report on HTML format using wlst script



Generating JVM report on HTML format using wlst script .

This wlst script source got it from google search and modified .

jvm_status.py


import os
import sys
import datetime
username='weblogic'
password='webl0gic'
ipaddr=os.environ["HOSTNAME"]
url='t3://'+ipaddr+':7001'
lmtime =str(datetime.datetime.now())
fo = open("jvm.html", "wb+")
fo.write('<html><body bgcolor="lightblue"><center><h3>Weblogic server  &quot;'+ipaddr.upper()+'&quot; Status Updated At :'+lmtime+'</h3>')
fo.write('<table border="1" style="border:1px ;width:80%;border-collapse:collapse;">')
# This module is for retrieve the JVM statistics

def monitorJVM():
     connect('weblogic', 'webl0gic',url)
     serverNames = getRunningServerNames()
     for name in serverNames:
      try:
       cd("/Servers/"+name.getName()+"/ServerStart/"+name.getName())
       jvm = str(cmo.getArguments())
       cpath = str(cmo.getClassPath())
       fo.write('<tr align="center"><h2><td>Server Name: '+ name.getName() + '</td></h2></tr>')
       fo.write('<tr align="center"><td>JVM ARGUMENTS</td></tr>')
       fo.write('<td> '+jvm+' </td>')
       fo.write('<tr align="center"><td>CLASS PATH</td></tr>')
       fo.write('<tr><td> '+cpath+' </td></tr>')
      except WLSTException,e:
       pass
# This module for managed Servers list
def getRunningServerNames():
     config()
     return cmo.getServers()

if __name__== "main":
     monitorJVM()
     fo.write('</table></html>')
     disconnect()




No comments:

Post a Comment