File: processor.pp

package info (click to toggle)
puppet-module-cloudkitty 14.0.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,056 kB
  • sloc: ruby: 2,270; python: 38; sh: 10; makefile: 10
file content (116 lines) | stat: -rw-r--r-- 3,289 bytes parent folder | download
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# == Class: cloudkitty::processor
#
# Installs & configure the cloudkitty processor service
#
# === Parameters
#
# [*package_ensure*]
#   (Optional) Ensure state for package.
#   Defaults to 'present'.
#
# [*enabled*]
#   (optional) Should the service be enabled.
#   Defaults to 'true'.
#
# [*manage_service*]
#   (optional) Whether the service should be managed by Puppet.
#   Defaults to 'true'.
#
# [*collector*]
#   (Optional) Data collector.
#   Defaults to 'gnocchi'.
#
# [*window*]
#   (Optional) Number of samples to collect per call.
#   Defaults to $facts['os_service_default'].
#
# [*period*]
#   (Optional) Rating period in seconds.
#   Defaults to $facts['os_service_default'].
#
# [*wait_periods*]
#   (optional) Wait for N periods before collecting new data.
#   Defaults to $facts['os_service_default'].
#
# [*services*]
#   (optional) Services to monitor.
#   Defaults to $facts['os_service_default'].
#
# [*auth_type*]
#   (optional) Authentication type to load.
#   Default to 'password'.
#
# [*auth_section*]
#   (optional) Config Section from which to load plugin specific options
#   Default to 'keystone_authtoken'.
#
# [*region_name*]
#   (optional) Region name for gnocchi collector
#   Default to $facts['os_service_default']
#
# [*interface*]
#   (optional) Endpoint URL type
#   Default to $facts['os_service_default']
#
class cloudkitty::processor (
  $package_ensure         = 'present',
  Boolean $manage_service = true,
  Boolean $enabled        = true,
  $collector              = 'gnocchi',
  $window                 = $facts['os_service_default'],
  $period                 = $facts['os_service_default'],
  $wait_periods           = $facts['os_service_default'],
  $services               = $facts['os_service_default'],
  $auth_type              = 'password',
  $auth_section           = 'keystone_authtoken',
  $region_name            = $facts['os_service_default'],
  $interface              = $facts['os_service_default'],
) {

  include cloudkitty::deps
  include cloudkitty::params

  package { 'cloudkitty-processor':
    ensure => $package_ensure,
    name   => $::cloudkitty::params::processor_package_name,
    tag    => ['openstack', 'cloudkitty-package'],
  }

  if $manage_service {
    if $enabled {
      $service_ensure = 'running'
    } else {
      $service_ensure = 'stopped'
    }

    service { 'cloudkitty-processor':
      ensure     => $service_ensure,
      name       => $::cloudkitty::params::processor_service_name,
      enable     => $enabled,
      hasstatus  => true,
      hasrestart => true,
      tag        => 'cloudkitty-service',
    }
  }

  cloudkitty_config {
    'collect/window':       value => $window;
    'collect/period':       value => $period;
    'collect/wait_periods': value => $wait_periods;
    'collect/services':     value => $services;
  }

  if $collector != 'gnocchi' {
    warning('Valid value of the collector option is gnocchi')
    $collector = 'gnocchi'
  }

  cloudkitty_config {
    'collect/collector':              value => $collector;
    'collector_gnocchi/auth_type':    value => $auth_type;
    'collector_gnocchi/auth_section': value => $auth_section;
    'collector_gnocchi/region_name':  value => $region_name;
    'collector_gnocchi/interface':    value => $interface;
  }

}