Skip to main content

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.

https://travis-ci.org/cwood/pyjolokia.png?branch=master

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.
...

Metadata

Release files for pyjolokia 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyjolokia 0.3.1
File Size Uploaded Provenance Actions
pyjolokia-0.3.1.tar.gz 161.1 kB Without provenance Details for pyjolokia-0.3.1.tar.gz

Release files / pyjolokia-0.3.1.tar.gz

Download URL pyjolokia-0.3.1.tar.gz
Size 161.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3c16ca0a8526db7341df3c511142803a6c148b471e885bfdf16760c1b1ab2769
BLAKE2b-256 checksum
How to use checksums
16ae921bde64437f1fa27aa405c34c30be4456a5e9f80fe6a5fcc0ae9e36eee5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pyjolokia 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.1 This release

1 release file No provenance

0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page