digital-shokunin / wsadmin_utilities

Utility scripts for use with wsadmin in WebSphere Application Server
MIT License
0 stars 0 forks source link

Add mbean/activation spec monitor #3

Open digital-shokunin opened 9 years ago

digital-shokunin commented 9 years ago

Ex:

import sys

mbeanTypes = ["J2CMessageEndpoint", "SIBMessagingEngine"]

for mbeanType in mbeanTypes:
    mbeanListAsString = AdminControl.queryNames("type=" + mbeanType + ",*")
    if mbeanListAsString:
        mbeanList = mbeanListAsString.split('\n')
        for mbean in mbeanList:
            if mbeanType == "J2CMessageEndpoint":
                type = "MBEANAS"
                mbeanAttributeList = mbean.split(',')
                name = mbeanAttributeList[1].split('=')[1]
                asName = mbeanAttributeList[2].split('=')[1]
                rc = AdminControl.invoke(mbean, "getStatus")
                if rc == "1":
                    okko = "ok"
                    msg = asName + " is active"
                else:
                    okko = "ko"
                    msg = asName + " is stopped"
            elif mbeanType == "SIBMessagingEngine":
                type = "MBEANME"
                mbeanName = mbean.split(',')[0].split('=')[1]
                name = mbeanName[0:mbeanName.find(".000-")]
                busName = mbeanName[len(name)+5:]
                state = AdminControl.invoke(mbean, "state")
                msg = busName + " is " + state
                if state == "Started":
                    okko = "ok"
                else:
                    okko = "ko"

            print type + ":" + name + ":" + okko + ":" + msg
digital-shokunin commented 9 years ago

ability to stop/restart it

AdminControl.invoke(mbean, "resume") AdminControl.invoke(mbean, "pause")