Puppet Class: profile::prometheus::openstack_exporter

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

Overview

Parameters:

  • prometheus_nodes (Any) (defaults to: hiera('profile::prometheus::prometheus_nodes'))
  • cpu_allocation_ratio (Any) (defaults to: hiera('profile::prometheus::cpu_allocation_ratio'))
  • ram_allocation_ratio (Any) (defaults to: hiera('profile::prometheus::ram_allocation_ratio'))
  • disk_allocation_ratio (Any) (defaults to: hiera('profile::prometheus::disk_allocation_ratio'))
  • listen_port (Any) (defaults to: hiera('profile::prometheus::listen_port'))
  • cache_refresh_interval (Any) (defaults to: hiera('profile::prometheus::cache_refresh_interval'))
  • cache_file (Any) (defaults to: hiera('profile::prometheus::cache_file'))
  • sched_ram_mbs (Any) (defaults to: hiera('profile::prometheus::sched_ram_mbs'))
  • sched_vcpu (Any) (defaults to: hiera('profile::prometheus::sched_vcpu'))
  • sched_disk_gbs (Any) (defaults to: hiera('profile::prometheus::sched_disk_gbs'))
  • region (Any) (defaults to: hiera('profile::prometheus::region'))
  • keystone_host (Any) (defaults to: hiera('profile::prometheus::keystone_host'))
  • observer_password (Any) (defaults to: hiera('profile::prometheus::observer_password'))


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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'modules/profile/manifests/prometheus/openstack_exporter.pp', line 1

class profile::prometheus::openstack_exporter (
    $prometheus_nodes = hiera('profile::prometheus::prometheus_nodes'),
    $cpu_allocation_ratio = hiera('profile::prometheus::cpu_allocation_ratio'),
    $ram_allocation_ratio = hiera('profile::prometheus::ram_allocation_ratio'),
    $disk_allocation_ratio = hiera('profile::prometheus::disk_allocation_ratio'),
    $listen_port = hiera('profile::prometheus::listen_port'),
    $cache_refresh_interval = hiera('profile::prometheus::cache_refresh_interval'),
    $cache_file = hiera('profile::prometheus::cache_file'),
    $sched_ram_mbs = hiera('profile::prometheus::sched_ram_mbs'),
    $sched_vcpu = hiera('profile::prometheus::sched_vcpu'),
    $sched_disk_gbs = hiera('profile::prometheus::sched_disk_gbs'),
    $region = hiera('profile::prometheus::region'),
    $keystone_host = hiera('profile::prometheus::keystone_host'),
    $observer_password = hiera('profile::prometheus::observer_password'),
) {
    require_package('prometheus-openstack-exporter')

    file { '/etc/prometheus-openstack-exporter.yaml':
        ensure  => 'present',
        owner   => 'prometheus',
        group   => 'prometheus',
        mode    => '0440',
        content => template('profile/prometheus/openstack-exporter.yaml.erb'),
    }

    file { '/usr/local/sbin/prometheus-openstack-exporter-wrapper':
        ensure  => 'present',
        owner   => 'root',
        group   => 'root',
        mode    => '0554',
        source  => 'puppet:///modules/profile/prometheus/prometheus-openstack-exporter-wrapper.sh',
        require => File['/etc/prometheus-openstack-exporter.yaml'],
    }

    systemd::service { 'prometheus-openstack-exporter':
        ensure         => present,
        content        => systemd_template('prometheus-openstack-exporter'),
        restart        => true,
        override       => false,
        require        => File['/usr/local/sbin/prometheus-openstack-exporter-wrapper'],
        service_params => {
            ensure     => 'running',
        },
        subscribe      => [
            File['/etc/prometheus-openstack-exporter.yaml'],
            File['/usr/local/sbin/prometheus-openstack-exporter-wrapper'],
        ],
    }

    # perhaps this should go in the package
    file { '/var/cache/prometheus-openstack-exporter':
        ensure => directory,
        force  => true,
        mode   => '0775',
        owner  => 'prometheus',
        group  => 'prometheus',
    }

    ferm::service { 'prometheus-openstack-exporter':
        proto  => 'tcp',
        port   => $listen_port,
        srange => "@resolve((${prometheus_nodes}))",
    }
}