Puppet Class: datadog_agent::integrations::redis

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

Overview

Class: datadog_agent::integrations::redis

This class will install the necessary configuration for the redis integration

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

Parameters:

$host:
    The host redis is running on
$password
    The redis password (optional)
$port
    The main redis port.
$ports
    Array of redis ports: overrides port (optional)
$ssl
    Enable SSL/TLS encryption for the check (optional)
$ssl_keyfile
    The path to the client-side private keyfile (optional)
$ssl_certfile
    The path to the client-side certificate file (optional)
$ssl_ca_certs
    The path to the ca_certs file (optional)
$ssl_cert_reqs
    Specifies whether a certificate is required from the
    other side of the connection, and whether it's validated if provided (optional)
      * 0 for ssl.CERT_NONE (certificates ignored)
      * 1 for ssl.CERT_OPTIONAL (not required, but validated if provided)
      * 2 for ssl.CERT_REQUIRED (required and validated)
$slowlog_max_len
    The max length of the slow-query log (optional)
$tags
    Optional array of tags
$keys
    Optional array of keys to check length
$command_stats
    Collect INFO COMMANDSTATS output as metrics
$instances
    Optional array of hashes should you wish to specify multiple instances.
    If this option is specified all other parameters will be overriden.
    This parameter may also be used to specify instances with hiera.

Sample Usage:

class { 'datadog_agent::integrations::redis' :
  host => 'localhost',
}

Hiera Usage:

datadog_agent::integrations::redis::instances:
  - host: 'localhost'
    password: 'datadog'
    port: 6379
    slowlog_max_len: 1000
    warn_on_missing_keys: true
    command_stats: false

Parameters:

  • host (String) (defaults to: 'localhost')
  • password (String) (defaults to: '')
  • port (Variant[String, Integer]) (defaults to: '6379')
  • ports (Optional[Array]) (defaults to: undef)
  • ssl (Boolean) (defaults to: false)
  • ssl_keyfile (String) (defaults to: '')
  • ssl_certfile (String) (defaults to: '')
  • ssl_ca_certs (String) (defaults to: '')
  • ssl_cert_reqs (Optional[Integer]) (defaults to: undef)
  • slowlog_max_len (Variant[String, Integer]) (defaults to: '')
  • tags (Array) (defaults to: [])
  • keys (Array) (defaults to: [])
  • warn_on_missing_keys (Boolean) (defaults to: true)
  • command_stats (Boolean) (defaults to: false)
  • instances (Optional[Array]) (defaults to: undef)


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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'manifests/integrations/redis.pp', line 60

class datadog_agent::integrations::redis (
  String $host                              = 'localhost',
  String $password                          = '',
  Variant[String, Integer] $port            = '6379',
  Optional[Array] $ports                    = undef,
  Boolean $ssl                              = false,
  String $ssl_keyfile                       = '',
  String $ssl_certfile                      = '',
  String $ssl_ca_certs                      = '',
  Optional[Integer] $ssl_cert_reqs          = undef,
  Variant[String, Integer] $slowlog_max_len = '',
  Array $tags                               = [],
  Array $keys                               = [],
  Boolean $warn_on_missing_keys             = true,
  Boolean $command_stats                    = false,
  Optional[Array] $instances                = undef,

) inherits datadog_agent::params {
  require datadog_agent

  if $ports == undef {
    $_ports = [$port]
  } else {
    $_ports = $ports
  }

  $_port_instances = $_ports.map |$instance_port| {
    {
      'host'                 => $host,
      'password'             => $password,
      'port'                 => $instance_port,
      'ssl'                  => $ssl,
      'ssl_keyfile'          => $ssl_keyfile,
      'ssl_certfile'         => $ssl_certfile,
      'ssl_ca_certs'         => $ssl_ca_certs,
      'ssl_cert_reqs'        => $ssl_cert_reqs,
      'slowlog_max_len'      => $slowlog_max_len,
      'tags'                 => $tags,
      'keys'                 => $keys,
      'warn_on_missing_keys' => $warn_on_missing_keys,
      'command_stats'        => $command_stats,
    }
  }

  $dst_dir = "${datadog_agent::params::conf_dir}/redisdb.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"

  if !$instances and $host {
    $_instances = $_port_instances
  } elsif !$instances {
    $_instances = []
  } else {
    $_instances = $instances
  }

  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/redisdb.yaml.erb'),
    require => Package[$datadog_agent::params::package_name],
    notify  => Service[$datadog_agent::params::service_name],
  }
}