Puppet Class: ceilometer::agent::notification

Defined in:
manifests/agent/notification.pp

Overview

Copyright © 2014 eNovance SAS <licensing@enovance.com>

Author: Emilien Macchi <emilien.macchi@enovance.com>

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Class: ceilometer::agent::notification

Configure the ceilometer notification agent. This configures the plugin for the API server, but does nothing about configuring the agents that must also run and share a config file with the OVS plugin if both are on the same machine.

Parameters:

enabled

(Optional) Should the service be enabled. Defaults to true.

manage_service

(Optional) Whether the service should be managed by Puppet. Defaults to true.

ack_on_event_error

(Optional) Acknowledge message when event persistence fails. Defaults to $facts.

disable_non_metric_meters

(Optional) Disable or enable the collection of non-metric meters. Default to $facts.

workers

(Optional) Number of workers for notification service (integer value). Defaults to $facts.

messaging_urls

(Optional) Messaging urls to listen for notifications. (Array of urls) The format should be transport://user:pass@host1:port/virtual_host Defaults to $facts.

batch_size

(Optional) Number of notification messages to wait before publishing them. Defaults to $facts.

batch_timeout

(Optional) Number of seconds to wait before dispatching samples when batch_size is not reached. Defaults to $facts.

package_ensure

(Optional) ensure state for package. Defaults to ‘present’.

manage_event_pipeline

(Optional) Whether to manage event_pipeline.yaml Defaults to false

event_pipeline_config

(Optional) A hash of the event_pipeline.yaml configuration. This is used only if manage_event_pipeline is true. Defaults to undef

event_pipeline_publishers

(Optional) A list of publishers to put in event_pipeline.yaml Add ‘notifier://?topic=alarm.all’ to the list if you are using Aodh for alarms. Defaults to [‘gnocchi://’],

manage_pipeline

(Optional) Whether to manage pipeline.yaml Defaults to false

pipeline_config

(Optional) A hash of the pipeline.yaml configuration. This is used only if manage_pipeline is true. Defaults to undef

pipeline_publishers

(Optional) A list of publishers to put in pipeline.yaml. By default all the data is dispatched to gnocchi Defaults to [‘gnocchi://’], If you are using collector override this to notifier:// instead.

Parameters:

  • manage_service (Any) (defaults to: true)
  • enabled (Any) (defaults to: true)
  • ack_on_event_error (Any) (defaults to: $facts['os_service_default'])
  • disable_non_metric_meters (Any) (defaults to: $facts['os_service_default'])
  • workers (Any) (defaults to: $facts['os_service_default'])
  • messaging_urls (Any) (defaults to: $facts['os_service_default'])
  • batch_size (Any) (defaults to: $facts['os_service_default'])
  • batch_timeout (Any) (defaults to: $facts['os_service_default'])
  • package_ensure (Any) (defaults to: 'present')
  • manage_event_pipeline (Any) (defaults to: false)
  • event_pipeline_publishers (Any) (defaults to: ['gnocchi://'])
  • event_pipeline_config (Any) (defaults to: undef)
  • manage_pipeline (Any) (defaults to: false)
  • pipeline_publishers (Any) (defaults to: ['gnocchi://'])
  • pipeline_config (Any) (defaults to: undef)


96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'manifests/agent/notification.pp', line 96

class ceilometer::agent::notification (
  $manage_service            = true,
  $enabled                   = true,
  $ack_on_event_error        = $facts['os_service_default'],
  $disable_non_metric_meters = $facts['os_service_default'],
  $workers                   = $facts['os_service_default'],
  $messaging_urls            = $facts['os_service_default'],
  $batch_size                = $facts['os_service_default'],
  $batch_timeout             = $facts['os_service_default'],
  $package_ensure            = 'present',
  $manage_event_pipeline     = false,
  $event_pipeline_publishers = ['gnocchi://'],
  $event_pipeline_config     = undef,
  $manage_pipeline           = false,
  $pipeline_publishers       = ['gnocchi://'],
  $pipeline_config           = undef,
) {

  include ceilometer::deps
  include ceilometer::params

  validate_legacy(Boolean, 'validate_bool', $manage_service)
  validate_legacy(Boolean, 'validate_bool', $enabled)
  validate_legacy(Boolean, 'validate_bool', $manage_event_pipeline)
  validate_legacy(Boolean, 'validate_bool', $manage_pipeline)


  package { 'ceilometer-notification':
    ensure => $package_ensure,
    name   => $::ceilometer::params::agent_notification_package_name,
    tag    => ['openstack', 'ceilometer-package']
  }

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

    service { 'ceilometer-agent-notification':
      ensure     => $service_ensure,
      name       => $::ceilometer::params::agent_notification_service_name,
      enable     => $enabled,
      hasstatus  => true,
      hasrestart => true,
      tag        => 'ceilometer-service'
    }
  }

  if $manage_event_pipeline {
    if $event_pipeline_config {
      validate_legacy(Hash, 'validate_hash', $event_pipeline_config)
      $event_pipeline_content = to_yaml($event_pipeline_config)
    } else {
      validate_legacy(Array, 'validate_array', $event_pipeline_publishers)
      $event_pipeline_content = template('ceilometer/event_pipeline.yaml.erb')
    }

    file { 'event_pipeline':
      ensure                  => present,
      path                    => $::ceilometer::params::event_pipeline,
      content                 => $event_pipeline_content,
      selinux_ignore_defaults => true,
      mode                    => '0640',
      owner                   => 'root',
      group                   => $::ceilometer::params::group,
      tag                     => 'ceilometer-yamls',
    }
  }

  if $manage_pipeline {
    if $pipeline_config {
      validate_legacy(Hash, 'validate_hash', $pipeline_config)
      $pipeline_content = to_yaml($pipeline_config)
    } else {
      validate_legacy(Array, 'validate_array', $pipeline_publishers)
      $pipeline_content = template('ceilometer/pipeline.yaml.erb')
    }

    file { 'pipeline':
      ensure                  => present,
      path                    => $::ceilometer::params::pipeline,
      content                 => $pipeline_content,
      selinux_ignore_defaults => true,
      mode                    => '0640',
      owner                   => 'root',
      group                   => $::ceilometer::params::group,
      tag                     => 'ceilometer-yamls',
    }
  }

  ceilometer_config {
    'notification/ack_on_event_error'       : value => $ack_on_event_error;
    'notification/disable_non_metric_meters': value => $disable_non_metric_meters;
    'notification/workers'                  : value => $workers;
    'notification/messaging_urls'           : value => $messaging_urls, secret => true;
    'notification/batch_size'               : value => $batch_size;
    'notification/batch_timeout'            : value => $batch_timeout;
  }
}