Puppet Class: profile::prometheus::openstack_exporter

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

Overview

Parameters:

  • cpu_allocation_ratio (Float) (defaults to: lookup('profile::prometheus::cpu_allocation_ratio'))
  • ram_allocation_ratio (Float) (defaults to: lookup('profile::prometheus::ram_allocation_ratio'))
  • disk_allocation_ratio (Float) (defaults to: lookup('profile::prometheus::disk_allocation_ratio'))
  • listen_port (Stdlib::Port) (defaults to: lookup('profile::prometheus::listen_port'))
  • cache_refresh_interval (Integer) (defaults to: lookup('profile::prometheus::cache_refresh_interval'))
  • cache_file (Stdlib::Unixpath) (defaults to: lookup('profile::prometheus::cache_file'))
  • sched_ram_mbs (Integer) (defaults to: lookup('profile::prometheus::sched_ram_mbs'))
  • sched_vcpu (Integer) (defaults to: lookup('profile::prometheus::sched_vcpu'))
  • sched_disk_gbs (Integer) (defaults to: lookup('profile::prometheus::sched_disk_gbs'))
  • region (String) (defaults to: lookup('profile::prometheus::region'))
  • observer_password (String) (defaults to: lookup('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
# File 'modules/profile/manifests/prometheus/openstack_exporter.pp', line 1

class profile::prometheus::openstack_exporter (
    Float               $cpu_allocation_ratio   = lookup('profile::prometheus::cpu_allocation_ratio'),
    Float               $ram_allocation_ratio   = lookup('profile::prometheus::ram_allocation_ratio'),
    Float               $disk_allocation_ratio  = lookup('profile::prometheus::disk_allocation_ratio'),
    Stdlib::Port        $listen_port            = lookup('profile::prometheus::listen_port'),
    Integer             $cache_refresh_interval = lookup('profile::prometheus::cache_refresh_interval'),
    Stdlib::Unixpath    $cache_file             = lookup('profile::prometheus::cache_file'),
    Integer             $sched_ram_mbs          = lookup('profile::prometheus::sched_ram_mbs'),
    Integer             $sched_vcpu             = lookup('profile::prometheus::sched_vcpu'),
    Integer             $sched_disk_gbs         = lookup('profile::prometheus::sched_disk_gbs'),
    String              $region                 = lookup('profile::prometheus::region'),
    String              $observer_password      = lookup('profile::prometheus::observer_password'),
){

    ensure_packages('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',
    }
}