- Overview
- Module Description - What the module does and why it is useful
- Usage - Configuration options and additional functionality
- Installing jmxtrans
- Managing the service
- Configuring servers and queries
- 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.
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.
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 => 'http://central.maven.org/maven2/org/jmxtrans/jmxtrans/254/jmxtrans-254.rpm',
}
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',
}
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
, andCount
from themetrics: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 objectmetrics: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