Giter Club home page Giter Club logo

jmx2munin's Introduction

jmx2munin

The jmx2munin project exposes JMX MBean attributes to Munin. Some of it's features:

  • strictly complies to the plugin format
  • exposes composite types like Lists, Maps, Set as useful as possible
  • String values can be mapped to numbers

How to use

This is what the Munin script will call. So you should test this first. Of course with your parameters. This example expose all Cassandra information to Munin.

java -jar jmx2munin.jar \
     -url service:jmx:rmi:///jndi/rmi://localhost:7199/jmxrmi \
     -query "org.apache.cassandra.*:*"

The "url" parameters specifies the JMX URL, the query selects the MBeans (and optionally also the attributes) to expose.

java -jar jmx2munin.jar \
     -url service:jmx:rmi:///jndi/rmi://localhost:7199/jmxrmi \
     -query "org.apache.cassandra.*:*" \
     -attribute org_apache_cassandra_db_storageservice_livenodes_size

The script that does the actual interaction with munin you can find in the contrib section. It's the one you should link in the your Munin plugin directory.

:/etc/munin/plugins$ ls -la cassandra_*
lrwxrwxrwx 1 root root 37 2011-04-07 19:58 cassandra_nodes_in_cluster -> /usr/share/munin/plugins/jmx2munin.sh

In the plugin conf you point to the correct configuration

[cassandra_*]
env.url service:jmx:rmi:///jndi/rmi://127.0.0.1:7199/jmxrmi
env.query org.apache.cassandra.*:*

[cassandra_nodes_in_cluster]
env.config cassandra/nodes_in_cluster

A possible configuration could look like this

graph_title Number of Nodes in Cluster
graph_vlabel org_apache_cassandra_db_storageservice_livenodes_size
org_apache_cassandra_db_storageservice_livenodes_size.label number of nodes

The script will extract the attributes from the config and caches the JMX results to reduce the load when showing many values. For testing you can run it manually just like munin would.

MUNIN_LIBDIR='/usr/share/munin'
config='cassandra/nodes_in_cluster'
query='org.apache.cassandra.*:*'
/usr/share/munin/plugins/jmx2munin.sh

More advanced

Sometimes it can be useful to track String values by mapping them into an enum as they really describe states. To find this possible candidates you can call:

java -jar jmx2munin.jar \
     -url service:jmx:rmi:///jndi/rmi://localhost:7199/jmxrmi \
     -query "org.apache.cassandra.*:*" \
     -list

It should output a list of possible candidates. This can now be turned into a enum configuration file:

[org.apache.cassandra.db.StorageService:OperationMode]
0 = ^Normal
1 = ^Client
2 = ^Joining
3 = ^Bootstrapping
4 = ^Leaving
5 = ^Decommissioned
6 = ^Starting drain
7 = ^Node is drained

Which you then can provide:

java -jar jmx2munin.jar \
     -url service:jmx:rmi:///jndi/rmi://localhost:7199/jmxrmi \
     -query "org.apache.cassandra.*:*" \
     -enums /path/to/enums.cfg

Now matching values get replaced by their numerical representation. On the left needs to be a unique number on the right side is a regular expression. If a string cannot be matched according to the spec "U" for "undefined" will be returned.

License

Licensed under the Apache License, Version 2.0 (the "License") You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

jmx2munin's People

Contributors

tcurdt avatar flameeyes avatar

Watchers

Miguel Angel Carvajal R avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.