Project

jolokia

0.01
No commit activity in last 3 years
No release in over 3 years
The Jolokia ruby library
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Jolokia

The Jolokia Ruby library provides a ruby API to the to the Jolokia Agent.

Installation

Add this line to your application's Gemfile:

gem 'jolokia'

And then execute:

$ bundle

Or install it yourself as:

$ gem install jolokia

Usage

First of all, you need to create an instance of Jolokia::Client to comunicate with the remote Jolokia Agent. You just need to pass the url of the Jolokia Agent to the constructor for creating the client.

jolokia = Jolokia.new(url: 'http://localhost:8080/jolokia')

And then, you can use the created client to read or write the attributes of the MBeans, or execute the operations of the MBeans.

response = jolokia.request(:post, type: 'read',
                                  mbean: 'java.lang:type=Memory',
                                  attribute: 'HeapMemoryUsage')
pp response

# =>
  {"timestamp"=>1340783789,
   "status"=>200,
   "request"=>
    {"mbean"=>"java.lang:type=Memory",
     "attribute"=>"HeapMemoryUsage",
     "type"=>"read"},
   "value"=>
    {"max"=>477233152,
     "committed"=>190382080,
     "init"=>134217728,
     "used"=>116851464}}

API

  • get_attribute(mbean, attribute, path = nil)
  • set_attribute(mbean, attribute, value, path = nil)
  • execute(mbean, operations, args)

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request