Puppet Class: profile::prometheus::statsd_exporter

Defined in:
modules/profile/manifests/prometheus/statsd_exporter.pp

Overview

Parameters:

  • prometheus_nodes (Array[Stdlib::Host]) (defaults to: lookup('prometheus_nodes'))
  • mappings (Array[Hash]) (defaults to: lookup('profile::prometheus::statsd_exporter::mappings'))
  • enable_relay (Boolean) (defaults to: lookup('profile::prometheus::statsd_exporter::enable_relay', { 'default_value' => true }))
  • relay_address (String) (defaults to: lookup('statsd'))


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'modules/profile/manifests/prometheus/statsd_exporter.pp', line 1

class profile::prometheus::statsd_exporter (
    Array[Stdlib::Host] $prometheus_nodes = lookup('prometheus_nodes'),
    Array[Hash]         $mappings         = lookup('profile::prometheus::statsd_exporter::mappings'),
    Boolean             $enable_relay     = lookup('profile::prometheus::statsd_exporter::enable_relay', { 'default_value' => true }),
    String              $relay_address    = lookup('statsd'),
){

    if $enable_relay {
        $relay_addr = $relay_address
    } else {
        $relay_addr = ''
    }

    class { '::prometheus::statsd_exporter':
        mappings      => $mappings,
        relay_address => $relay_addr,
    }

    $prometheus_ferm_nodes = join($prometheus_nodes, ' ')
    $ferm_srange = "(@resolve((${prometheus_ferm_nodes})) @resolve((${prometheus_ferm_nodes}), AAAA))"

    # Don't spam conntrack with localhost statsd clients
    ferm::client { 'statsd-exporter-client':
        proto   => 'udp',
        notrack => true,
        port    => '9125',
        drange  => '127.0.0.1',
    }

    ferm::service { 'prometheus-statsd-exporter':
        proto  => 'tcp',
        port   => '9112',
        srange => $ferm_srange,
    }
}