Puppet Class: datadog_agent::integrations::elasticsearch

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

Overview

Class: datadog_agent::integrations::elasticsearch

This class will install the necessary configuration for the elasticsearch integration

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

Parameters:

$url:
  The URL for Elasticsearch

Sample Usage:

class { 'datadog_agent::integrations::elasticsearch' :
  instances => [{
    url  => "http://localhost:9201"
  },
  {
    url  => "http://elastic.acme.com:9201"
  }]
}

Or for a single instance:

class { 'datadog_agent::integrations::elasticsearch' :
  url  => "http://localhost:9201"
}

Parameters:

  • cluster_stats (Boolean) (defaults to: false)
  • index_stats (Boolean) (defaults to: false)
  • password (Optional[String]) (defaults to: undef)
  • pending_task_stats (Boolean) (defaults to: true)
  • pshard_stats (Boolean) (defaults to: false)
  • ssl_cert (Optional[String]) (defaults to: undef)
  • ssl_key (Optional[String]) (defaults to: undef)
  • ssl_verify (Boolean) (defaults to: true)
  • tls_verify (Boolean) (defaults to: $ssl_verify)
  • tls_use_host_header (Boolean) (defaults to: false)
  • tls_ignore_warning (Boolean) (defaults to: false)
  • tls_cert (Optional[String]) (defaults to: undef)
  • tls_private_key (Optional[String]) (defaults to: undef)
  • tls_ca_cert (Optional[String]) (defaults to: undef)
  • tls_protocols_allowed (Array) (defaults to: [])
  • tls_ciphers (Array) (defaults to: [])
  • tags (Array) (defaults to: [])
  • url (String) (defaults to: 'http://localhost:9200')
  • username (Optional[String]) (defaults to: undef)
  • 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
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
101
# File 'manifests/integrations/elasticsearch.pp', line 29

class datadog_agent::integrations::elasticsearch (
  Boolean $cluster_stats     = false,
  Boolean $index_stats       = false,
  Optional[String] $password = undef,
  Boolean$pending_task_stats = true,
  Boolean $pshard_stats      = false,
  Optional[String] $ssl_cert = undef,
  Optional[String] $ssl_key  = undef,
  Boolean $ssl_verify        = true, # kept for backwards compatibility
  Boolean $tls_verify        = $ssl_verify,
  Boolean $tls_use_host_header = false,
  Boolean $tls_ignore_warning  = false,
  Optional[String] $tls_cert = undef,
  Optional[String] $tls_private_key = undef,
  Optional[String] $tls_ca_cert = undef,
  Array $tls_protocols_allowed = [],
  Array $tls_ciphers         = [],
  Array $tags                = [],
  String $url                = 'http://localhost:9200',
  Optional[String] $username = undef,
  Optional[Array] $instances = undef
) inherits datadog_agent::params {
  require datadog_agent

  if !$instances and $url {
    $_instances = [{
        'cluster_stats'      => $cluster_stats,
        'index_stats'        => $index_stats,
        'password'           => $password,
        'pending_task_stats' => $pending_task_stats,
        'pshard_stats'       => $pshard_stats,
        'ssl_cert'           => $ssl_cert,
        'ssl_key'            => $ssl_key,
        'tls_verify'         => $tls_verify,
        'tags'               => $tags,
        'url'                => $url,
        'username'           => $username,
        'tls_use_host_header' => $tls_use_host_header,
        'tls_ignore_warning'  => $tls_ignore_warning,
        'tls_cert'            => $tls_cert,
        'tls_private_key'     => $tls_private_key,
        'tls_ca_cert'         => $tls_ca_cert,
        'tls_protocols_allowed' => $tls_protocols_allowed,
        'tls_ciphers'         => $tls_ciphers,
    }]
  } elsif !$instances {
    $_instances = []
  } else {
    $_instances = $instances
  }

  $dst_dir = "${datadog_agent::params::conf_dir}/elastic.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_file,
    content => template('datadog_agent/agent-conf.d/elastic.yaml.erb'),
    require => Package[$datadog_agent::params::package_name],
    notify  => Service[$datadog_agent::params::service_name],
  }
}