Puppet Class: prometheus::mini_textfile_exporter

Defined in:
modules/prometheus/manifests/mini_textfile_exporter.pp

Overview

Parameters:

  • ensure (Wmflib::Ensure) (defaults to: 'present')
  • glob (String) (defaults to: '/var/lib/prometheus/mini-textfile.d/*.prom')


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
42
43
44
# File 'modules/prometheus/manifests/mini_textfile_exporter.pp', line 10

class prometheus::mini_textfile_exporter(
    Wmflib::Ensure $ensure = 'present',
    String         $glob   = '/var/lib/prometheus/mini-textfile.d/*.prom',
) {
    ensure_packages(['python3-prometheus-client'])

    $script_path = '/usr/local/bin/prometheus-mini-textfile-exporter'

    file { dirname($glob):
        ensure => directory,
        owner  => 'root',
        group  => 'root',
        mode   => '0555',
    }

    file { $script_path:
        ensure => $ensure,
        source => 'puppet:///modules/prometheus/usr/local/bin/prometheus-mini-textfile-exporter.py',
        owner  => 'root',
        group  => 'root',
        mode   => '0555',
    }

    $service_name = 'mini-textfile-exporter'
    systemd::service { $service_name:
        ensure    => $ensure,
        content   => systemd_template('prometheus-mini-textfile-exporter'),
        restart   => true,
        subscribe => File[$script_path],
    }

    profile::auto_restarts::service { $service_name:
        ensure => $ensure,
    }
}