Add SQLAlchemy-collectd support

The SQLAlchemy-collectd plugin is now shipped in podman
containers under Kolla, this allows heat templates
to pull the plugin into the collectd configuration when
the collectd templates are being used.

A corresponding set of template changes in tripleo-heat-templates
will enable this plugin.

Change-Id: If598da717653a383a2d3b3373c56517f8bca832f
This commit is contained in:
Mike Bayer 2019-07-17 15:30:27 -04:00
parent 8e4de1b75c
commit e2e602972f
2 changed files with 79 additions and 1 deletions

View File

@ -133,6 +133,18 @@
# (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
@ -222,6 +234,9 @@ class tripleo::profile::base::metrics::collectd (
$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,
@ -240,7 +255,10 @@ class tripleo::profile::base::metrics::collectd (
manage_repo => $collectd_manage_repo
}
include ::collectd::plugin::python
class { '::collectd::plugin::python':
logtraces => true,
}
$python_packages = concat(['collectd-python'], $python_read_plugins)
package { $python_packages:
ensure => 'present'
@ -282,6 +300,13 @@ class tripleo::profile::base::metrics::collectd (
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,

View File

@ -0,0 +1,53 @@
# Copyright 2019 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.
#
# == Define: tripleo::profile::base::metrics::collectd::sqlalchemy_collectd
#
# This is used to create configuration file for sqlalchemy-collectd plugin
#
# === Parameters
#
# [*bind_host*]
# (Optional) String. Hostname to listen on. Defaults to 0.0.0.0
#
# [*bind_port*]
# (Optional) Integer. Port to listen on. defaults to 25827.
#
# [*log_messages*]
# (Optional) String. Log level for the plugin, set to "debug" to show
# messages received.
# Defaults to 'info'
#
#
define tripleo::profile::base::metrics::collectd::sqlalchemy_collectd (
$bind_host = '0.0.0.0',
$bind_port = 25827,
$log_messages = 'info',
) {
include ::collectd
package { 'python-collectd-sqlalchemy':
ensure => 'present',
}
::collectd::plugin::python::module { 'collectd_sqlalchemy':
config => [{
'listen' => [$bind_host, $bind_port],
'loglevel' => $log_messages
}],
module_import => 'sqlalchemy_collectd.server.plugin',
}
}