Puppet Class: ganeti::prometheus

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

Overview

Parameters:



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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'modules/ganeti/manifests/prometheus.pp', line 7

class ganeti::prometheus(
    String $rapi_endpoint,
    String $rapi_ro_user,
    String $rapi_ro_password,
) {
    ensure_packages([
        'prometheus-ganeti-exporter',
        'python3-cryptography',
        'python3-prometheus-client',
    ])

    firewall::service {'ganeti-prometheus-exporter':
        proto    => 'tcp',
        port     => 8080,
        src_sets => ['PRODUCTION_NETWORKS'],
    }

    # Configuration files for Ganeti Prometheus exporter
    file { '/etc/ganeti/prometheus.ini':
        ensure  => present,
        owner   => 'prometheus',
        group   => 'prometheus',
        mode    => '0400',
        content => template('ganeti/prometheus-collector.erb')
    }

    file { '/usr/local/sbin/prometheus-ganeti-ca-exporter' :
        ensure => present,
        mode   => '0544',
        source => 'puppet:///modules/ganeti/prometheus-ganeti-ca-exporter.py',
    }

    service {'prometheus-ganeti-exporter':
        ensure => running,
    }

    profile::auto_restarts::service { 'prometheus-ganeti-exporter': }

    systemd::timer::job { 'prometheus-ganeti-ca-exporter':
        ensure      => stdlib::ensure($facts['ganeti_master'] == $facts['fqdn']),
        user        => 'root',
        description => 'Exports Prometheus metrics about the internal Ganeti CA',
        command     => "/usr/local/sbin/prometheus-ganeti-ca-exporter --outfile /var/lib/prometheus/node.d/ganeti-ca.prom --cert-path /var/lib/ganeti/server.pem --clustername ${rapi_endpoint}",
        interval    => {
            'start'    => 'OnCalendar',
            'interval' => 'daily',
        },
    }
}