Puppet Class: datadog_agent::integrations::twemproxy

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

Overview

Class: datadog_agent::integrations::twemproxy

This class will install the necessary configuration for the twemproxy aka nutcracker integration

See the sample twemproxy.d/conf.yaml for all available configuration options github.com/DataDog/integrations-core/blob/master/twemproxy/datadog_checks/twemproxy/data/conf.yaml.example

Parameters:

$host:
    The host twemproxy is running on. Defaults to '127.0.0.1'
$port
    The twemproxy password for the datadog user. Defaults to 22222

Sample Usage:

class { 'datadog_agent::integrations::twemproxy' :
  instances => [
    {
      'host' => 'localhost',
      'port' => '22222',
    },
    {
      'host' => 'localhost',
      'port' => '22223',
    },
  ]
}

Parameters:

  • host (String) (defaults to: 'localhost')
  • port (String) (defaults to: '22222')
  • instances (Optional[Array]) (defaults to: undef)


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'manifests/integrations/twemproxy.pp', line 29

class datadog_agent::integrations::twemproxy (
  String $host               = 'localhost',
  String $port               = '22222',
  Optional[Array] $instances = undef,
) inherits datadog_agent::params {
  require datadog_agent

  if !$instances and $host {
    $_instances = [{
        'host' => $host,
        'port' => $port,
    }]
  } elsif !$instances {
    $_instances = []
  } else {
    $_instances = $instances
  }

  $dst_dir = "${datadog_agent::params::conf_dir}/twemproxy.d"

  file { $dst_dir:
    ensure  => directory,
    owner   => $datadog_agent::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"

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