File: evaluator.pp

package info (click to toggle)
puppet-module-aodh 27.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,160 kB
  • sloc: ruby: 2,381; python: 33; makefile: 10; sh: 10
file content (74 lines) | stat: -rw-r--r-- 2,302 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
# Installs the aodh evaluator service
#
# == Params
#  [*enabled*]
#    (optional) Should the service be enabled.
#    Defaults to true.
#
#  [*manage_service*]
#    (optional)  Whether the service should be managed by Puppet.
#    Defaults to true.
#
#  [*package_ensure*]
#    (optional) ensure state for package.
#    Defaults to 'present'
#
#  [*workers*]
#    (optional) Number of workers for evaluator service.
#    Defaults to $facts['os_workers'].
#
#  [*evaluation_interval*]
#    (optional) Period of evaluation cycle
#    Defaults to $facts['os_service_default'].
#
#  [*event_alarm_cache_ttl*]
#    (optional) TTL of event alarm caches, in seconds.
#    Defaults to $facts['os_service_default'].
#
#  [*additional_ingestion_lag*]
#    (optional) The number of seconds to extend the evaluation windows to
#    compensate the reporting/ingestion lag.
#    Defaults to $facts['os_service_default'].
#
class aodh::evaluator (
  Boolean $manage_service                 = true,
  Boolean $enabled                        = true,
  Stdlib::Ensure::Package $package_ensure = 'present',
  $workers                                = $facts['os_workers'],
  $evaluation_interval                    = $facts['os_service_default'],
  $event_alarm_cache_ttl                  = $facts['os_service_default'],
  $additional_ingestion_lag               = $facts['os_service_default'],
) {
  include aodh::deps
  include aodh::params

  aodh_config {
    'evaluator/evaluation_interval':    value => $evaluation_interval;
    'DEFAULT/event_alarm_cache_ttl':    value => $event_alarm_cache_ttl;
    'DEFAULT/additional_ingestion_lag': value => $additional_ingestion_lag;
    'evaluator/workers':                value => $workers;
  }

  package { 'aodh-evaluator':
    ensure => $package_ensure,
    name   => $aodh::params::evaluator_package_name,
    tag    => ['openstack', 'aodh-package'],
  }

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

    service { 'aodh-evaluator':
      ensure     => $service_ensure,
      name       => $aodh::params::evaluator_service_name,
      enable     => $enabled,
      hasstatus  => true,
      hasrestart => true,
      tag        => ['aodh-service','aodh-db-sync-service'],
    }
  }
}