Forge Home


Configure metrics data with jmxtrans


668 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.1.5 (latest)
  • 0.1.4
  • 0.1.3
  • 0.1.2
released Jul 29th 2021
This version is compatible with:
  • Puppet Enterprise 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x
  • Puppet >= 6.1.0 < 8.0.0
  • , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'dodevops-jmxtrans', '0.1.5'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add dodevops-jmxtrans
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install dodevops-jmxtrans --version 0.1.5

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.



dodevops/jmxtrans — version 0.1.5 Jul 29th 2021

Table of Contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Usage - Configuration options and additional functionality
  4. Installing jmxtrans
  5. Managing the service
  6. Configuring servers and queries
  7. Development - Guide for contributing to the module


Configure jmxtrans for collecting and exporting JVM metrics data.

This module was adopted from PLoperations and was available as ploperations/jmxtrans before.

Module Description

This module can be used to install and manage the jmxtrans service, as well as configure how it connects to JVM processes, what data it pulls out, and where it sends the data it collects.

For more information on jmxtrans, see the source repo.


This module is not dependent on any java puppet module, however without any java on the system, the startup of jmxtrans will fail. Please take care to have a working java installation on the server (recommended of course with the puppetlabs/java module) and the java binary in the PATH or at least a JAVA_HOME set. The jmxtrans startup script will try to detect the java via one of these ways.

Installing jmxtrans

If you have a repository configured on the system with a jmxtrans package available, you can install jmxtrans by setting the package_name parameter on the main jmxtrans class.

class { '::jmxtrans':
  package_name => 'jmxtrans',

If you have a package available on the local filesystem or remotely over HTTP (if your package manager supports it), you can set the package_source parameter. Note that if you are on anything other than a Debian or EL-based operating system, you will also need to set package_provider.

class { '::jmxtrans':
  package_name   => 'jmxtrans',
  package_source => '',

Managing the service

If you want to manage the service, you can set the service_name parameter, which will set ensure => running on the service.

class { '::jmxtrans':
  package_name => 'jmxtrans',
  service_name => 'jmxtrans',

Configuring servers and queries

The jmxtrans::query defined type is used to configure "servers" and "queries" as described in the jmxtrans documentation.

Example usage:

jmxtrans::query { 'puppetserver':
  host     => 'localhost',
  port     => 1099,
  queries  => [
      object       => "metrics:name=puppetlabs.${facts['hostname']}.compiler.compile",
      attributes   => ['Max', 'Min', 'Mean', 'StdDev', 'Count'],
      result_alias => 'puppetlabs.puppetmaster.compiler.compile',
      writers      => [
          '@class'          => 'com.googlecode.jmxtrans.model.output.KeyOutWriter',
          outputFile        => '/tmp/puppetserver-compile-metrics.txt',
          maxLogFileSize    => '10MB',
          maxLogBackupFiles => '200',
          debug             => true,
      object       => "metrics:name=puppetlabs.${facts['hostname']}.jruby.num-free-jrubies",
      attributes   => ['Value'],
      result_alias => 'puppetlabs.puppetmaster.jruby.num-free-jrubies',
      writers      => [
          '@class'          => 'com.googlecode.jmxtrans.model.output.KeyOutWriter',
          outputFile        => '/tmp/puppetserver-jruby-metrics.txt',
          maxLogFileSize    => '10MB',
          maxLogBackupFiles => '200',
          debug             => true,

This will configure jmxtrans to connect to a JMX RMI on localhost listening on port 1099, and it will:

  • extract the values for Max, Min, Mean, StdDev, and Count from the metrics:name=puppetlabs.${facts['hostname']}.compiler.compile object and write them to /tmp/puppetserver-compile-metrics.txt.
  • extract the value of the Value attribute for the object metrics:name=puppetlabs.${facts['hostname']}.jruby.num-free-jrubies and write it to /tmp/puppetserver-jruby-metrics.txt.

If you intend to use the GraphiteWriter, StdoutWriter or GelfWriter on all the objects for the server, there are top level parameters that you can set which will be inherited by all the query objects.


Pull Requests on GitHub are welcome. Please include tests for any new features or functionality change. See rspec-puppet for details on writing unit tests for Puppet.

Always keep the reference up to date by running

bundle exec puppet strings generate --format markdown