Puppet Class: profile::prometheus::rabbitmq_exporter

Defined in:
modules/profile/manifests/prometheus/rabbitmq_exporter.pp

Overview

Parameters:

  • prometheus_nodes (Array[Stdlib::Host]) (defaults to: lookup('prometheus_nodes'))
  • rabbit_monitor_username (String) (defaults to: lookup('profile::prometheus::rabbit_monitor_user'))
  • rabbit_monitor_password (String) (defaults to: lookup('profile::prometheus::rabbit_monitor_pass'))


1
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
33
34
35
36
37
38
39
40
# File 'modules/profile/manifests/prometheus/rabbitmq_exporter.pp', line 1

class profile::prometheus::rabbitmq_exporter (
    Array[Stdlib::Host] $prometheus_nodes        = lookup('prometheus_nodes'),
    String              $rabbit_monitor_username = lookup('profile::prometheus::rabbit_monitor_user'),
    String              $rabbit_monitor_password = lookup('profile::prometheus::rabbit_monitor_pass'),
){

    $rabbit_host = 'localhost:15672'

    file { '/etc/prometheus/':
        ensure => 'directory',
        owner  => 'root',
        group  => 'root',
    }

    file { '/etc/prometheus/rabbitmq-exporter.yaml':
        ensure  => 'present',
        owner   => 'prometheus',
        group   => 'prometheus',
        mode    => '0440',
        content => template('profile/prometheus/rabbitmq-exporter.conf.erb'),
        require => File['/etc/prometheus/'],
    }

    require_package('prometheus-rabbitmq-exporter')

    service { 'prometheus-rabbitmq-exporter':
        ensure  => running,
        require => File['/etc/prometheus/rabbitmq-exporter.yaml'],
    }

    base::service_auto_restart { 'prometheus-rabbitmq-exporter': }

    $prometheus_ferm_nodes = join($prometheus_nodes, ' ')
    $prometheus_ferm_srange = "(@resolve((${prometheus_ferm_nodes})) @resolve((${prometheus_ferm_nodes}), AAAA))"
    ferm::service { 'prometheus-rabbitmq-exporter':
        proto  => 'tcp',
        port   => '9195',
        srange => $prometheus_ferm_srange,
    }
}