Monday, August 24, 2009

Anotherway of Application Status discovery

try:
    print '---------------------- Application status ---------------------'
    mBeans=adminHome.getMBeansByType("ApplicationRuntime")
    for bean in mBeans:
        if server_name != bean.getObjectName().getLocation():
            continue
        components= bean.lookupComponents()
        for componentRTList in components:
            app = componentRTList.getParent().getName()
            istate=componentRTList.getDeploymentState()

            if istate == 0:
                istate='UNPREPARED'
            if istate == 1:
                istate='PREPARED'
            if istate == 2:
                istate='ACTIVE'
            if istate == 3:
                istate='NEW'

            print "%65s %65s %20s" % (str(componentRTList.getName()), app, istate)

except:
    print "This Server has no Applications"

No comments: