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

v0.0.9

Published

execute queries agains the jolokia JMX bridge

Downloads

426

Readme

Overview

A node.js client for retrieving information from the JXM bridge provided by Roland Huss at http://www.jolokia.org/.

Usage

Currently, only a subset of commands is supported. Please Please file a case at https://github.com/jolira/jolokia-client/issues if you want a particular command to be added.

Create a new client

var jolokia = require("jolokia-client");
var util = require('util'); // used by the examples below

var client = new jolokia("http://my.server.com/jolokia");

List the available mbeans

client.list(mbeans, callback)

mbeans is a string that identifies one particular mbean or domain name (such as "JMImplementation" or "JMImplementation:type=MBeanServerDelegate") or an array or such names (such as ["JMImplementation", "Catalina"]). The parameter may also omitted to retrieve information about all mbeans available on the server.

The callback method takes one parameter. It is called when data was received from the server. The data is return as a JavaScript object.

// lists all available attributes and operations
client.list(function(response){
  console.log(util.inspect(response, true, 10));
});
// lists available attributes and operations for all JMImplementation mbeans
client.list("JMImplementation", function(response){
  console.log(util.inspect(response, true, 10));
});
// lists available attributes and operations for the JMImplementation:type=MBeanServerDelegate mbean
client.list("JMImplementation:type=MBeanServerDelegate", function(response){
  console.log(util.inspect(response, true, 10));
});
// lists available attributes and operations for all JMImplementation and Catalina mbeans
client.list(["JMImplementation", "Catalina"], function(response){
  console.log(util.inspect(response, true, 10));
});

Read mbean attribute values

client.read(mbean, attribute, callback)

mbean is a string that identifies one particular (qualified) mbean (such "JMImplementation:type=MBeanServerDelegate")

atrribute is a string that identifies one particular attribute (such as "ImplementationVersion"). This parameter may be omitted to return all attributes of an mbean.

The callback method takes one parameter. It is called when data was received from the server. The data is return as a JavaScript object.

// read all attributes of "JMImplementation:type=MBeanServerDelegate"
client.read("JMImplementation:type=MBeanServerDelegate", function(response){
  console.log(util.inspect(response, true, 10));
});
// read the "ImplementationVersion" attribute of "JMImplementation:type=MBeanServerDelegate"
client.read("JMImplementation:type=MBeanServerDelegate", "ImplementationVersion", function(response){
  console.log(util.inspect(response, true, 10));
});

It is also possible to read multiple metric at the same time:

// read all attributes of "JMImplementation:type=MBeanServerDelegate"
client.read(["JMImplementation:type=MBeanServerDelegate", "java.lang:type=Memory"], function(response){
  console.log(util.inspect(response, true, 10));
});
// read the "ImplementationVersion" attribute of "JMImplementation:type=MBeanServerDelegate"
client.read([{mbean: "JMImplementation:type=MBeanServerDelegate", attribute="ImplementationVersion"}], function(response){
  console.log(util.inspect(response, true, 10));
});

jmx4node

There is also a jxm2node command line utility included to access JMX information.

Usage: jxm2node <url> <command> [params]

The utility must be invoked with a valid , such as http://my.server.com/jolokia. Also, a command must be provided. Valid commands are documented below.

list [<mbean>]

Describe all mbeans for the given server. If no parameter is passed, all available mbeans of the server are part of the output.

Examples are:

jmx4node http://my.server.com/jolokia list
jmx4node http://my.server.com/jolokia list JMImplementation
jmx4node http://my.server.com/jolokia list JMImplementation:type=MBeanServerDelegate

read <mbean> [<attribute>]

Read the attributes of all mbeans for the given server. If no parameter is passed, all available attributes of the mbean are part of the output.

Examples are:

jmx4node http://my.server.com/jolokia read JMImplementation:type=MBeanServerDelegate
jmx4node http://my.server.com/jolokia read JMImplementation ImplementationVersion:

dump [<mbean>]

Read all the values of an , if a bean is provide, or all the values on the server otherwise

Examples are:

jmx4node http://my.server.com/jolokia dump
jmx4node http://my.server.com/jolokia dump JMImplementation
jmx4node http://my.server.com/jolokia dump JMImplementation:type=MBeanServerDelegate