Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Pure Python based Jolokia client

Project Description

pyJolokia

This 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 on pyjolokia as joloka supports.

Check -> http://www.jolokia.org/reference/html/index.html for more information.

Features

  • Post Request
  • Bulk Request
  • Proxy Support
  • Read, Write, List, Search, Exec.

Setup

$ python2.7 setup.py build
$ python2.7 setup.py install

Examples

One Request

from pyjolokia import Jolokia
# Enter the jolokia url
j4p = 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 request
data = j4p.request(type = 'read', mbean='java.lang:type=Threading', attribute='ThreadCount')

Write Request

from pyjolokia import Jolokia

j4p = 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 Request

from pyjolokia import Jolokia

j4p = 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 Request

from pyjolokia import Jolokia

j4p = 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 Request

from pyjolokia import Jolokia
j4p = 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 Requsts

from pyjolokia import Jolokia
# Enter the jolokia url
j4p = 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 here
bulkdata = j4p.getRequests()

Proxy Mode

from pyjolokia import Jolokia
j4p = 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 Authentication

from pyjolokia import Jolokia
j4p = Jolokia('http://localhost:8080/jolokia/')
j4p.auth(httpusername='this', httppassword='that')

# Do normal requests here. All requests ill have the proxy info.
...
Release History

Release History

This version
History Node

0.3.1

History Node

0.3.0

History Node

0.2.0

History Node

0.1.1

History Node

0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pyjolokia-0.3.1.tar.gz (161.1 kB) Copy SHA256 Checksum SHA256 Source Apr 7, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting