Puppet Class: prometheus::postgres_exporter

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

Overview

Class prometheus::postgres_exporter

Install/configure postgresql prometheus exporter

Parameters:

  • prometheus_user (Any) (defaults to: 'prometheus')
  • prometheus_db (Any) (defaults to: 'postgres')
  • ensure (Any) (defaults to: 'present')


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
37
38
39
# File 'modules/prometheus/manifests/postgres_exporter.pp', line 4

class prometheus::postgres_exporter(
    $prometheus_user = 'prometheus',
    $prometheus_db = 'postgres',
    $ensure='present'
) {
    package { 'prometheus-postgres-exporter':
        ensure => $ensure,
    }

    if debian::codename::eq('stretch') {
        $postgres_exporter_extra_args = '-extend.query-path /etc/postgres-prometheus-exporter-queries.yaml'
    }

    file { '/etc/default/prometheus-postgres-exporter':
        ensure  => $ensure,
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => template('prometheus/prometheus-postgres-exporter.default.erb'),
    }

    file { '/etc/postgres-prometheus-exporter-queries.yaml':
        ensure => $ensure,
        owner  => 'root',
        group  => 'root',
        mode   => '0444',
        source => 'puppet:///modules/prometheus/postgres/postgres-prometheus-exporter-queries.yaml',
    }

    service { 'prometheus-postgres-exporter':
        ensure => running,
        enable => true,
    }

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