Puppet Class: profile::wmcs::metricsinfra::thanos_query

Defined in:
modules/profile/manifests/wmcs/metricsinfra/thanos_query.pp

Overview

SPDX-License-Identifier: Apache-2.0

Parameters:

  • prometheus_hosts (Array[Stdlib::Fqdn]) (defaults to: lookup('profile::wmcs::metricsinfra::prometheus_hosts'))
  • thanos_fe_hosts (Array[Stdlib::Fqdn]) (defaults to: lookup('profile::wmcs::metricsinfra::thanos_fe_hosts'))


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
# File 'modules/profile/manifests/wmcs/metricsinfra/thanos_query.pp', line 2

class profile::wmcs::metricsinfra::thanos_query (
    Array[Stdlib::Fqdn] $prometheus_hosts = lookup('profile::wmcs::metricsinfra::prometheus_hosts'),
    Array[Stdlib::Fqdn] $thanos_fe_hosts  = lookup('profile::wmcs::metricsinfra::thanos_fe_hosts'),
) {
    $sd_files = '/etc/thanos-query/stores/*.yml'
    $sd_files_path = dirname($sd_files)
    $http_port = 10902

    class { 'thanos::query':
        http_port => $http_port,
        sd_files  => $sd_files,
    }

    $prometheus_targets = [ { 'targets' => $prometheus_hosts.map |$h| { "${h}:29900" } } ]
    file { "${sd_files_path}/prometheus.yml":
        ensure  => present,
        mode    => '0444',
        owner   => 'root',
        group   => 'root',
        content => to_yaml($prometheus_targets),
    }

    $rule_targets = [ { 'targets' => $thanos_fe_hosts.map |$h| { "${h}:17901" } } ]
    file { "${sd_files_path}/rule.yml":
        ensure  => present,
        mode    => '0444',
        owner   => 'root',
        group   => 'root',
        content => to_yaml($rule_targets),
    }
}