Puppet Class: datadog_agent::integrations::jmx

Inherits:
datadog_agent::params
Defined in:
manifests/integrations/jmx.pp

Overview

Class: datadog_agent::integrations::jmx

This class will install the necessary configuration for the jmx integration

Parameters:

$init_config:
    Hash of inital configuration, consisting of the following keys:

  custom_jar_paths:
    Array of paths to jars. Optional.

$instances:
    Array of instance hashes, consisting of the following keys:

  name:
    Used in conjunction with jmx_url. Optional.
  tags:
    Hash of tags { 'env' =>  'prod' }. Optional.
  host:
    The host jmx is running on.
  port:
    The JMX port.
  jmx_url:
    If the agent needs to connect to a non-default JMX URL, specify it here
    instead of a host and a port. If you use this you need to specify a 'name'
    for the instance. Optional.
  user:
    The username for connecting to the running JVM. Optional.
  password:
    The password for connecting to the running JVM. Optional.
  process_name_regex:
    Instead of specifying a host and port or jmx_url, the agent can
    connect using the attach api. This requires the JDK to be installed
    and the path to tools.jar to be set. Optional.
  tools_jar_path:
    To be set when process_name_regex is set. Optional.
  java_bin_path:
    The path to the Java binary. Should be set if the agent cannot find your java executable. Optional.
  java_options:
    Java JVM options. Optional.
  trust_store_path:
    The path to the trust store. Should be set if ssl is enabled. Optional.
  trust_store_password:
    The trust store password. Should be set if ssl is enabled. Optional.
  conf:
    Array of include/exclude hash pairs. Optional.
    Read http://docs.datadoghq.com/integrations/java/ to learn how to customize it.

Sample Usage:

class { 'datadog_agent::integrations::jmx':
  init_config        => {
    custom_jar_paths => ['/path/to/custom.jar']
  },
  instances  => [{
    host     => 'localhost',
    port     => 7199,
    user     => 'username',
    password => 'password',
    jmx_url  => 'service:jmx:rmi:///jndi/rmi://myhost.host:9999/custompath'
  }],
}

Parameters:

  • init_config (Any) (defaults to: {})
  • instances (Any) (defaults to: [])


64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'manifests/integrations/jmx.pp', line 64

class datadog_agent::integrations::jmx(
  $init_config = {},
  $instances   = [],
) inherits datadog_agent::params {
  require ::datadog_agent

  $legacy_dst = "${datadog_agent::params::legacy_conf_dir}/jmx.yaml"
  if $::datadog_agent::_agent_major_version > 5 {
    $dst_dir = "${datadog_agent::params::conf_dir}/jmx.d"
    file { $legacy_dst:
      ensure => 'absent'
    }

    file { $dst_dir:
      ensure  => directory,
      owner   => $datadog_agent::params::dd_user,
      group   => $datadog_agent::params::dd_group,
      mode    => $datadog_agent::params::permissions_directory,
      require => Package[$datadog_agent::params::package_name],
      notify  => Service[$datadog_agent::params::service_name]
    }
    $dst = "${dst_dir}/conf.yaml"
  } else {
    $dst = $legacy_dst
  }

  file { $dst:
    ensure  => file,
    owner   => $datadog_agent::params::dd_user,
    group   => $datadog_agent::params::dd_group,
    mode    => $datadog_agent::params::permissions_protected_file,
    content => template('datadog_agent/agent-conf.d/jmx.yaml.erb'),
    require => Package[$datadog_agent::params::package_name],
    notify  => Service[$datadog_agent::params::service_name]
  }

}