Package: pyjolokia
pyJolokiaThis is a pure pyhon jolokia client. I moduled its usage after the javascript version.
Currently this will only support the protocol version 6.Check the jolokia users guide for more information on how jolokia works. All options are available
onpyjolokiaas joloka supports.Check ->http://www.jolokia.org/reference/html/index.htmlfor more information.FeaturesPost RequestBulk RequestProxy SupportRead, Write, List, Search, Exec.Setup$python2.7setup.pybuild$python2.7setup.pyinstallExamplesOne RequestfrompyjolokiaimportJolokia# Enter the jolokia urlj4p=Jolokia('http://localhost:8080/jolokia/')# Put in the type, the mbean, or other options. Check the jolokia users guide for more info# This then will return back a python dictionary of what happend to the requestdata=j4p.request(type='read',mbean='java.lang:type=Threading',attribute='ThreadCount')Write RequestfrompyjolokiaimportJolokiaj4p=Jolokia('http://localhost:8080/jolokia/')j4p.request(type='write',mbean='java.lang:type=Memory',attribute='verbose',value='true')>>{u'request':{u'attribute':u'Verbose',u'mbean':u'java.lang:type=Memory',u'type':u'write',u'value':u'true'},u'status':200,u'timestamp':1324256998,u'value':False}Exec RequestfrompyjolokiaimportJolokiaj4p=Jolokia('http://localhost:8080/jolokia/')j4p.request(type='exec',mbean='java.lang:type=Threading',operation='dumpAllThreads',arguments=[True,True])>>{u'request':{u'arguments':[True,True],u'mbean':u'java.lang:type=Threading',u'operation':u'dumpAllThreads',u'type':u'exec'},u'status':200,u'timestamp':1324257601,u'value':[{u'blockedCount':34,u'blockedTime':-1,...Search RequestfrompyjolokiaimportJolokiaj4p=Jolokia('http://localhost:8080/jolokia/')j4p.request(type='search',mbean='java.lang:*')>>{u'request':{u'mbean':u'java.lang:*',u'type':u'search'},u'status':200,u'timestamp':1324257899,u'value':[u'java.lang:name=CMS Old Gen,type=MemoryPool',u'java.lang:type=Memory',u'java.lang:name=Code Cache,type=MemoryPool',u'java.lang:type=Runtime',u'java.lang:type=ClassLoading',u'java.lang:name=ConcurrentMarkSweep,type=GarbageCollector',u'java.lang:type=Threading',u'java.lang:name=ParNew,type=GarbageCollector',u'java.lang:type=Compilation',u'java.lang:name=Par Eden Space,type=MemoryPool',u'java.lang:name=CMS Perm Gen,type=MemoryPool',u'java.lang:type=OperatingSystem',u'java.lang:name=Par Survivor Space,type=MemoryPool',u'java.lang:name=CodeCacheManager,type=MemoryManager']}List RequestfrompyjolokiaimportJolokiaj4p=Jolokia('http://localhost:8080/jolokia/')j4p.request(type='list',path='java.lang/type=Memory')>>{u'request':{u'path':u'java.lang/type=Memory',u'type':u'list'},u'status':200,u'timestamp':1324258206,u'value':{u'attr':{u'HeapMemoryUsage':{u'desc':u'HeapMemoryUsage',u'rw':False,u'type':u'javax.management.openmbean.CompositeData'},...Bulk RequstsfrompyjolokiaimportJolokia# Enter the jolokia urlj4p=Jolokia('http://localhost:8080/jolokia/')'''
    Put as many requests as you want.
'''j4p.add_request(type='read',mbean='java.lang:type=Memory')j4p.add_request(type='read',mbean='java.lang:type=Threading',attribute='ThreadCount')# Actull json request will be sent herebulkdata=j4p.getRequests()Proxy ModefrompyjolokiaimportJolokiaj4p=Jolokia('http://localhost:8080/jolokia/')j4p.proxy(url='service:jmx:rmi://localhost:8080',user='SomeUser',password='somePassword')# Do normal requests here. All requests ill have the proxy info....HTTP Basic AuthenticationfrompyjolokiaimportJolokiaj4p=Jolokia('http://localhost:8080/jolokia/')j4p.auth(httpusername='this',httppassword='that')# Do normal requests here. All requests ill have the proxy info....