Skip to content

Instantly share code, notes, and snippets.

@davidkeen
Created October 29, 2014 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidkeen/4038f6414d8b24b05234 to your computer and use it in GitHub Desktop.
Save davidkeen/4038f6414d8b24b05234 to your computer and use it in GitHub Desktop.
Get queue size from jmx
from pyjolokia import Jolokia
import json
# Enter the jolokia url
j4p = Jolokia('http://localhost:8778/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='org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=sms.in', attribute='QueueSize')
print json.dumps(data, indent=4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment