Puppet Class: tripleo::profile::base::metrics::collectd

Defined in:
manifests/profile/base/metrics/collectd.pp

Overview

Copyright 2016 Red Hat, Inc.

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: tripleo::profile::base::metrics::collectd

Collectd configuration for TripleO

Parameters

step

(Optional) The current step in deployment. See tripleo-heat-templates for more details. Defaults to hiera(‘step’)

enable_file_logging

(Optional) Boolean. Whether to enable logfile plugin. which we should send metrics. Defaults to false

collectd_server

(Optional) String. The name or address of a collectd server to which we should send metrics.

collectd_port

(Optional) Integer. The port to which we will connect on the collectd server.

collectd_username

(Optional) String. Username for authenticating to the remote collectd server.

collectd_password

(Optional) String. Password for authenticating to the remote collectd server.

collectd_securitylevel

(Optional) String.

gnocchi_auth_mode

(Optional) String. Type of authentication Gnocchi server is using. Supported values are ‘basic’ and ‘keystone’. Defaults to ‘basic’

gnocchi_protocol

(Optional) String. API protocol Gnocchi server is using. Defaults to ‘http’

gnocchi_server

(Optional) String. The name or address of a gnocchi endpoint to which we should send metrics. Defaults to undef

gnocchi_port

(Optional) Integer. The port to which we will connect on the Gnocchi server. Defaults to 8041

gnocchi_user

(Optional) String. Username for authenticating to the remote Gnocchi server using simple authentication. Defaults to undef

gnocchi_keystone_auth_url

(Optional) String. Keystone endpoint URL to authenticate to. Defaults to undef

gnocchi_keystone_user_name

(Optional) String. Username for authenticating to Keystone. Defaults to undef

gnocchi_keystone_user_id

(Optional) String. User ID for authenticating to Keystone. Defaults to undef

gnocchi_keystone_password

(Optional) String. Password for authenticating to Keystone Defaults to undef

gnocchi_keystone_project_id

(Optional) String. Project ID for authenticating to Keystone. Defaults to undef

gnocchi_keystone_project_name

(Optional) String. Project name for authenticating to Keystone. Defaults to undef

gnocchi_keystone_user_domain_id

(Optional) String. User domain ID for authenticating to Keystone. Defaults to undef

gnocchi_keystone_user_domain_name

(Optional) String. User domain name for authenticating to Keystone. Defaults to undef

gnocchi_keystone_project_domain_id

(Optional) String. Project domain ID for authenticating to Keystone. Defaults to undef

gnocchi_keystone_project_domain_name

(Optional) String. Project domain name for authenticating to Keystone. Defaults to undef

gnocchi_keystone_region_name

(Optional) String. Region name for authenticating to Keystone. Defaults to undef

gnocchi_keystone_interface

(Optional) String. Type of Keystone endpoint to authenticate to. Defaults to undef

gnocchi_keystone_endpoint

(Optional) String. Explicitly state Gnocchi server URL if you want to override Keystone value Defaults to undef

gnocchi_resource_type

(Optional) String. Default resource type created by the collectd-gnocchi plugin in Gnocchi to store hosts. Defaults to ‘collectd’

gnocchi_batch_size

(Optional) String. Minimum number of values Gnocchi should batch. Defaults to 10

enable_sqlalchemy_collectd

(Optional) boolean. enable SQLAlchemy-collectd plugin defaults to false

sqlalchemy_collectd_bind_host

(Optional) String. Hostname to listen on. Defaults to 0.0.0.0

sqlalchemy_collectd_log_messages

(Optional) String. Log level for the plugin, set to “debug” to show messages received. Defaults to ‘info’

service_names

(Optional) List of strings. A list of active services in this tripleo deployment. This is used to look up service-specific plugins that need to be installed.

collectd_manage_repo

(Optional) Boolean. Whether let collectd enable manage repositories. If it is set to true the epel repository will be used

amqp_transport_name

(Optional) String. Name of the transport. Default to ‘metrics’

amqp_host

(Optional) String. Hostname or IP address of the AMQP 1.0 intermediary. Defaults to the undef

amqp_port

(Optional) String. Service name or port number on which the AMQP 1.0 intermediary accepts connections. This argument must be a string, even if the numeric form is used. Defaults to undef

amqp_user

(Optional) String. User part of credentials used to authenticate to the AMQP 1.0 intermediary. Defaults to undef

amqp_password

(Optional) String. Password part of credentials used to authenticate to the AMQP 1.0 intermediary. Defaults to undef

amqp_address

(Optional) String. This option specifies the prefix for the send-to value in the message. Defaults to ‘collectd’

amqp_retry_delay

(Optional) Number. When the AMQP1 connection is lost, defines the time in seconds to wait before attempting to reconnect. If not set 1 second is the implicit default. Defaults to undef

amqp_interval

(Optional) Number. Interval on which metrics should be sent to AMQP intermediary. If not set the default for all collectd plugins is used. Defaults to undef

amqp_instances

(Optional) Hash of hashes. Each inner hash represent Instance block in plugin configuration file. Key of outter hash represents instance name. The ‘address’ value concatenated with the ‘name’ given will be used as the send-to address for communications over the messaging link. Defaults to {}.

amqp_send_queue_limit

(Optional) Number. Number of data sets to be kept in memory, older sets will be discarded; if set to undef, this feature is disabled. Defaults to undef

qdr_mode

(Optional) String. Mode in which the QDR service, to which collectd should be connected, is running. Defaults to hiera(‘tripleo::profile::base::metrics::qdr::router_mode’, ‘edge’)

python_read_plugins

(Optional) List of strings. List of third party python packages to install. Defaults to [].

enable_sensubility

(Optional) Boolean. Set to true if sensubility should be executed by exec plugin. Defaults to false.

enable_libpodstats

(Optional) Boolean. Set to true if the collectd libpodstats plugin should be loaded Defaults to false.

Parameters:

  • step (Any) (defaults to: Integer(hiera('step')))
  • enable_file_logging (Any) (defaults to: false)
  • collectd_server (Any) (defaults to: undef)
  • collectd_port (Any) (defaults to: undef)
  • collectd_username (Any) (defaults to: undef)
  • collectd_password (Any) (defaults to: undef)
  • collectd_securitylevel (Any) (defaults to: undef)
  • gnocchi_auth_mode (Any) (defaults to: 'basic')
  • gnocchi_protocol (Any) (defaults to: 'http')
  • gnocchi_server (Any) (defaults to: undef)
  • gnocchi_port (Any) (defaults to: 8041)
  • gnocchi_user (Any) (defaults to: undef)
  • gnocchi_keystone_auth_url (Any) (defaults to: undef)
  • gnocchi_keystone_user_name (Any) (defaults to: undef)
  • gnocchi_keystone_user_id (Any) (defaults to: undef)
  • gnocchi_keystone_password (Any) (defaults to: undef)
  • gnocchi_keystone_project_id (Any) (defaults to: undef)
  • gnocchi_keystone_project_name (Any) (defaults to: undef)
  • gnocchi_keystone_user_domain_id (Any) (defaults to: undef)
  • gnocchi_keystone_user_domain_name (Any) (defaults to: undef)
  • gnocchi_keystone_project_domain_id (Any) (defaults to: undef)
  • gnocchi_keystone_project_domain_name (Any) (defaults to: undef)
  • gnocchi_keystone_region_name (Any) (defaults to: undef)
  • gnocchi_keystone_interface (Any) (defaults to: undef)
  • gnocchi_keystone_endpoint (Any) (defaults to: undef)
  • gnocchi_resource_type (Any) (defaults to: 'collectd')
  • gnocchi_batch_size (Any) (defaults to: 10)
  • enable_sqlalchemy_collectd (Any) (defaults to: false)
  • sqlalchemy_collectd_bind_host (Any) (defaults to: undef)
  • sqlalchemy_collectd_log_messages (Any) (defaults to: undef)
  • amqp_transport_name (Any) (defaults to: 'metrics')
  • amqp_host (Any) (defaults to: undef)
  • amqp_port (Any) (defaults to: undef)
  • amqp_user (Any) (defaults to: undef)
  • amqp_password (Any) (defaults to: undef)
  • amqp_address (Any) (defaults to: 'collectd')
  • amqp_instances (Any) (defaults to: {})
  • amqp_retry_delay (Any) (defaults to: undef)
  • amqp_interval (Any) (defaults to: undef)
  • amqp_send_queue_limit (Any) (defaults to: undef)
  • qdr_mode (Any) (defaults to: hiera('tripleo::profile::base::metrics::qdr::router_mode', 'edge'))
  • service_names (Any) (defaults to: hiera('service_names', []))
  • collectd_manage_repo (Any) (defaults to: false)
  • python_read_plugins (Any) (defaults to: [])
  • enable_sensubility (Any) (defaults to: false)
  • enable_libpodstats (Any) (defaults to: false)


227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'manifests/profile/base/metrics/collectd.pp', line 227

class tripleo::profile::base::metrics::collectd (
  $step = Integer(hiera('step')),
  $enable_file_logging = false,
  $collectd_server = undef,
  $collectd_port = undef,
  $collectd_username = undef,
  $collectd_password = undef,
  $collectd_securitylevel = undef,
  $gnocchi_auth_mode = 'basic',
  $gnocchi_protocol = 'http',
  $gnocchi_server = undef,
  $gnocchi_port = 8041,
  $gnocchi_user = undef,
  $gnocchi_keystone_auth_url = undef,
  $gnocchi_keystone_user_name = undef,
  $gnocchi_keystone_user_id = undef,
  $gnocchi_keystone_password = undef,
  $gnocchi_keystone_project_id = undef,
  $gnocchi_keystone_project_name = undef,
  $gnocchi_keystone_user_domain_id = undef,
  $gnocchi_keystone_user_domain_name = undef,
  $gnocchi_keystone_project_domain_id = undef,
  $gnocchi_keystone_project_domain_name = undef,
  $gnocchi_keystone_region_name = undef,
  $gnocchi_keystone_interface = undef,
  $gnocchi_keystone_endpoint = undef,
  $gnocchi_resource_type = 'collectd',
  $gnocchi_batch_size = 10,
  $enable_sqlalchemy_collectd = false,
  $sqlalchemy_collectd_bind_host = undef,
  $sqlalchemy_collectd_log_messages = undef,
  $amqp_transport_name = 'metrics',
  $amqp_host = undef,
  $amqp_port = undef,
  $amqp_user = undef,
  $amqp_password = undef,
  $amqp_address = 'collectd',
  $amqp_instances = {},
  $amqp_retry_delay = undef,
  $amqp_interval = undef,
  $amqp_send_queue_limit = undef,
  $qdr_mode = hiera('tripleo::profile::base::metrics::qdr::router_mode', 'edge'),
  $service_names = hiera('service_names', []),
  $collectd_manage_repo = false,
  $python_read_plugins = [],
  $enable_sensubility = false,
  $enable_libpodstats = false,
) {

  if $step >= 3 {
    if $enable_libpodstats {
        $typesdb = ['/usr/share/collectd/types.db', '/usr/share/collectd/types.db.libpodstats']
        include tripleo::profile::base::metrics::collectd::libpodstats
    } else {
        $typesdb = ['/usr/share/collectd/types.db']
    }

    class {'collectd':
      manage_repo => $collectd_manage_repo,
      typesdb     => $typesdb,
    }

    class { 'collectd::plugin::python':
      logtraces   => true,
    }

    $python_packages = $python_read_plugins
    package { $python_packages:
      ensure => 'present'
    }

    if $enable_file_logging {
      include collectd::plugin::logfile
    }

    if ! ($collectd_securitylevel in [undef, 'None', 'Sign', 'Encrypt']) {
      fail('collectd_securitylevel must be one of (None, Sign, Encrypt).')
    }

    # Load per-service plugin configuration
    ::tripleo::profile::base::metrics::collectd::collectd_service {
      $service_names: }

    # Because THT doesn't allow us to default values to undef, we need
    # to perform a number of transformations here to avoid passing a bunch of
    # empty strings to the collectd plugins.

    $_collectd_username = empty($collectd_username) ? {
      true    => undef,
      default => $collectd_username
    }

    $_collectd_password = empty($collectd_password) ? {
      true    => undef,
      default => $collectd_password
    }

    $_collectd_port = empty($collectd_port) ? {
      true    => undef,
      default => $collectd_port
    }

    $_collectd_securitylevel = empty($collectd_securitylevel) ? {
      true    => undef,
      default => $collectd_securitylevel
    }

    if $enable_sqlalchemy_collectd {
      ::tripleo::profile::base::metrics::collectd::sqlalchemy_collectd { 'sqlalchemy_collectd':
          bind_host    => $sqlalchemy_collectd_bind_host,
          log_messages => $sqlalchemy_collectd_log_messages,
      }
    }

    if ! empty($collectd_server) {
      ::collectd::plugin::network::server { $collectd_server:
        username      => $_collectd_username,
        password      => $_collectd_password,
        port          => $_collectd_port,
        securitylevel => $_collectd_securitylevel,
      }
    } elsif !empty($amqp_host) {
      class { 'collectd::plugin::amqp1':
        ensure           => 'present',
        manage_package   => true,
        transport        => $amqp_transport_name,
        host             => $amqp_host,
        port             => $amqp_port,
        user             => $amqp_user,
        password         => $amqp_password,
        address          => $amqp_address,
        instances        => $amqp_instances,
        retry_delay      => $amqp_retry_delay,
        interval         => $amqp_interval,
        send_queue_limit => $amqp_send_queue_limit,
      }
    } elsif !empty($gnocchi_server) or !empty($gnocchi_keystone_auth_url) {
      if !empty($gnocchi_server) {
        $gci_server = $gnocchi_server
      } else {
        $gci_server = $gnocchi_keystone_auth_url
      }
      ::tripleo::profile::base::metrics::collectd::gnocchi { $gci_server:
        auth_mode                    => $gnocchi_auth_mode,
        protocol                     => $gnocchi_protocol,
        server                       => $gnocchi_server,
        port                         => $gnocchi_port,
        user                         => $gnocchi_user,
        keystone_auth_url            => $gnocchi_keystone_auth_url,
        keystone_user_name           => $gnocchi_keystone_user_name,
        keystone_user_id             => $gnocchi_keystone_user_id,
        keystone_password            => $gnocchi_keystone_password,
        keystone_project_id          => $gnocchi_keystone_project_id,
        keystone_project_name        => $gnocchi_keystone_project_name,
        keystone_user_domain_id      => $gnocchi_keystone_user_domain_id,
        keystone_user_domain_name    => $gnocchi_keystone_user_domain_name,
        keystone_project_domain_id   => $gnocchi_keystone_project_domain_id,
        keystone_project_domain_name => $gnocchi_keystone_project_domain_name,
        keystone_region_name         => $gnocchi_keystone_region_name,
        keystone_interface           => $gnocchi_keystone_interface,
        keystone_endpoint            => $gnocchi_keystone_endpoint,
        resource_type                => $gnocchi_resource_type,
        batch_size                   => $gnocchi_batch_size,
      }
    }

    if $enable_sensubility {
      include tripleo::profile::base::metrics::collectd::sensubility
    }
  }
}