npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jolokia

v1.0.7

Published

Implementation of jolokia JMX client

Downloads

424

Readme

Jolokia JavaScript client

JavaScript client for Jolokia server for both Node.js and browser.

Build Status

To install via npm, please run

npm install jolokia

Or via bower

bower install jolokia

Important If you use this library in browser without using browserify or equivalent tool, please use dist/jolokia.js (or dist/jolokia.min.js) instead of main file declared in package.json.

Important If you use this library in browser, you need to include your own jQuery.

Usage

For jolokia documentation please check their offical website.

// In Node.js or using Browserify
var Jolokia = require('jolokia');

// In browser
var Jolokia = window.Jolokia;

// Or using RequireJs
require(['./path/to/jolokia'], function(Jolokia) {
   // code below
});

var jolokia = new Jolokia({
    url: '/jmx', // use full url when in Node.js environment
    method: 'post', // force specific HTTP method
});

jolokia.list().then(function(value) {
   // do something with list of JMX domains
}, function(error) {
   // handle error
});

API

new Jolokia(options)

Constructor.

options String|Object [optional] Instance configuration. If String, it will be used as endpoint URL. You can rewrite these default options when calling individual methods.

options.url String [optional] Endpoint URL. You have to provide an URL either to constructor or when calling any method.

options.method String [optional] Force HTTP method to use. Must be one of GET, POST (case-insensitive). If not specified, HTTP method will be guessed base on JMX request:

  • GET for single requests
  • POST for multiple requests or requests for multiple attributes

options.query Object [optional] URL query parameters to add to query. Especially useful to pass jolokia configuration options such as maxCollectionSize. Please see official documentation for list of supported values.

options.auth Object [optional] Hash containing username and password Strings used for Basic authentication.

Other options will be passed to either jQuery.ajax() (in browser) or request (in Node.js).

jolokia.request(request, options)

Perform arbitrary JMX request or requests.

request Object|Array Definition of JMX requests.

request.type String Type of JMX request. Can be one of read, write, exec, search and list.

request.mbean String JMX bean name (or name regex for search requests).

request.attribute String|Array Name of bean attribute, used for read and write requests.

request.value Object Value of bean attribute, used for write requests.

request.operation String Name of bean operation, used for exec requests.

request.arguments Array Arguments for operation, used for exec requests.

request.path String Path to append to url to access inner attributes of responses. See official documentation for more information on accessing inner paths.

Returns Promise resolved with JMX responses.

jolokia.get(mbean, attribute, options)

Sharthand method for creating read requests.

Returns Promise resolved with attribute value.

jolokia.set(mbean, attribute, value, options)

Sharthand method for creating write requests.

Returns Promise.

jolokia.list(options)

Sharthand method for creating list requests.

Returns Promise resolved with hash containing available JMX domains.

jolokia.search(mbean, options)

Sharthand method for creating search requests.

Returns Promise resolved with array of available JMX beans.

jolokia.version(options)

Sharthand method for creating version requests.

Returns Promise resolved with Jolokia agent version definition.