Puppet Class: alertmanager::karma

Defined in:
modules/alertmanager/manifests/karma.pp

Overview

SPDX-License-Identifier: Apache-2.0

Parameters:

  • config (Optional[String]) (defaults to: undef)

    Configuration file to use, if the default is not suitable

  • vhost (String)
  • listen_address (Stdlib::Host) (defaults to: 'localhost')
  • listen_port (Stdlib::Port) (defaults to: 19194)
  • auth_header (Optional[String]) (defaults to: undef)
  • metricsinfra_username (Optional[String[1]]) (defaults to: undef)
  • metricsinfra_password (Optional[String[1]]) (defaults to: undef)


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
36
# File 'modules/alertmanager/manifests/karma.pp', line 3

class alertmanager::karma (
    String $vhost,
    Optional[String] $config = undef,
    Stdlib::Host $listen_address = 'localhost',
    Stdlib::Port $listen_port = 19194,
    Optional[String] $auth_header = undef,
    Optional[String[1]] $metricsinfra_username = undef,
    Optional[String[1]] $metricsinfra_password = undef,
) {
    ensure_packages(['karma'])

    systemd::service { 'karma':
        ensure   => present,
        content  => init_template('karma', 'systemd_override'),
        override => true,
        restart  => true,
    }

    if $config {
        $content = $config
    } else {
        $content = template('alertmanager/karma.yml.erb')
    }

    file { '/etc/karma.yml':
        ensure       => present,
        owner        => 'root',
        group        => 'karma',
        mode         => '0440',
        content      => $content,
        validate_cmd => '/usr/bin/karma --config.file % --check-config',
        notify       => Service['karma'],
    }
}