Puppet Class: profile::elasticsearch::logstash

Defined in:
modules/profile/manifests/elasticsearch/logstash.pp

Overview

vim:sw=4 ts=4 sts=4 et:

Class: role::logstash::elasticsearch

Provisions Elasticsearch backend node for a Logstash cluster.

Parameters:

  • prometheus_nodes (Array[String]) (defaults to: hiera('prometheus_nodes'))


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
36
37
38
39
40
41
# File 'modules/profile/manifests/elasticsearch/logstash.pp', line 6

class profile::elasticsearch::logstash(
    Array[String] $prometheus_nodes = hiera('prometheus_nodes'),
) {
    include ::profile::elasticsearch

    # the logstash cluster has 3 data nodes, and each shard has 3 replica (each
    # shard is present on each node). If one node is lost, 1/3 of the shards
    # will be unassigned, with no way to reallocate them on another node, which
    # is fine and should not raise an alert. So threshold needs to be > 1/3.
    icinga::monitor::elasticsearch::base_checks { $::hostname:
        threshold           => '>=0.34',
        shard_size_warning  => 150,
        shard_size_critical => 200,
    }

    file { '/usr/share/elasticsearch/plugins':
        ensure => 'directory',
        force  => true,
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    } -> Class['elasticsearch']

    $::profile::elasticsearch::configured_instances.reduce(9108) |$prometheus_port, $kv_pair| {
        $cluster_name = $kv_pair[0]
        $cluster_params = $kv_pair[1]
        $http_port = $cluster_params['http_port']

        profile::prometheus::elasticsearch_exporter { "${::hostname}:${http_port}":
            prometheus_nodes   => $prometheus_nodes,
            prometheus_port    => $prometheus_port,
            elasticsearch_port => $http_port,
        }
        $prometheus_port + 1
    }
}