Collectd QDR connection
This patch enables to configure collectd to QDR by utilizing collectd-amqp1 plugin. Change-Id: I4cb6aa95e253b7fd19ed265fbcba0dfe6663592d
This commit is contained in:
parent
95e677eb3a
commit
6c60a0f21f
@ -74,10 +74,9 @@ mod 'pacemaker',
|
||||
:git => 'https://github.com/openstack/puppet-pacemaker',
|
||||
:ref => 'master'
|
||||
|
||||
# Note(bandini): Pinned due to LP#1756890
|
||||
mod 'collectd',
|
||||
:git => 'https://github.com/voxpupuli/puppet-collectd',
|
||||
:ref => '93c8d0bd32bb5610652f30e785ba6644fc82a8b6'
|
||||
:ref => 'master'
|
||||
|
||||
# see https://github.com/rdo-packages/puppet-keepalived-distgit/blob/rpm-master/puppet-keepalived.spec
|
||||
mod 'keepalived',
|
||||
|
@ -142,6 +142,52 @@
|
||||
# (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 {}.
|
||||
class tripleo::profile::base::metrics::collectd (
|
||||
$step = Integer(hiera('step')),
|
||||
|
||||
@ -171,6 +217,15 @@ class tripleo::profile::base::metrics::collectd (
|
||||
$gnocchi_keystone_endpoint = undef,
|
||||
$gnocchi_resource_type = 'collectd',
|
||||
$gnocchi_batch_size = 10,
|
||||
$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,
|
||||
$service_names = hiera('service_names', []),
|
||||
$collectd_manage_repo = false
|
||||
) {
|
||||
@ -221,6 +276,20 @@ class tripleo::profile::base::metrics::collectd (
|
||||
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,
|
||||
}
|
||||
} elsif !empty($gnocchi_server) or !empty($gnocchi_keystone_auth_url) {
|
||||
if !empty($gnocchi_server) {
|
||||
$gci_server = $gnocchi_server
|
||||
|
@ -18,42 +18,68 @@ require 'spec_helper'
|
||||
|
||||
describe 'tripleo::profile::base::metrics::collectd' do
|
||||
shared_examples_for 'tripleo::profile::base::metrics::collectd' do
|
||||
context 'with step less than 3' do
|
||||
let(:params) { { :step => 2 } }
|
||||
it 'should do nothing' do
|
||||
context 'with step less than 3' do
|
||||
let(:params) { { :step => 2, :gnocchi_server => 'localhost' } }
|
||||
it 'should do nothing' do
|
||||
is_expected.to_not contain_class('collectd')
|
||||
is_expected.to_not contain_class('collectd::plugin::logfile')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with defaults and step greater than 3' do
|
||||
let(:params) { { :step => 3 } }
|
||||
it 'only have the collectd' do
|
||||
context 'with defaults and step greater than 3, gnocchi deploy' do
|
||||
let(:params) { { :step => 3, :gnocchi_server => 'localhost' } }
|
||||
it 'has collectd class with gnocchi plugin and python plugin' do
|
||||
is_expected.to compile.with_all_deps
|
||||
is_expected.to contain_class('collectd').with(
|
||||
:manage_repo => false,
|
||||
)
|
||||
is_expected.to contain_service('collectd').with(
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
)
|
||||
is_expected.to contain_package('python-collectd-gnocchi').with(
|
||||
:ensure => 'present',
|
||||
)
|
||||
is_expected.to contain_package('collectd-python').with(
|
||||
:ensure => 'present',
|
||||
)
|
||||
is_expected.to_not contain_class('epel')
|
||||
is_expected.to_not contain_class('collectd::plugin::amqp1')
|
||||
is_expected.to_not contain_class('collectd::plugin::logfile')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with enabled file_logging and step greater than 3' do
|
||||
let(:params) do
|
||||
{ :step => 3,
|
||||
:enable_file_logging => true,
|
||||
:gnocchi_server => 'localhost' }
|
||||
end
|
||||
it 'Contains both' do
|
||||
is_expected.to compile.with_all_deps
|
||||
is_expected.to contain_class('collectd')
|
||||
is_expected.to contain_class('collectd::plugin::logfile')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with defaults and step greater than 3, amqp deploy' do
|
||||
let(:params) do
|
||||
{ :step => 3,
|
||||
:amqp_host => 'localhost',
|
||||
}
|
||||
end
|
||||
|
||||
it 'has amqp class' do
|
||||
is_expected.to compile.with_all_deps
|
||||
is_expected.to contain_class('collectd')
|
||||
is_expected.to_not contain_class('collectd::plugin::logfile')
|
||||
is_expected.to contain_class('collectd').with(
|
||||
:manage_repo => false,
|
||||
is_expected.to contain_class('collectd::plugin::amqp1').with(
|
||||
:manage_package => true,
|
||||
)
|
||||
is_expected.to contain_service('collectd').with(
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
)
|
||||
is_expected.to_not contain_class('epel')
|
||||
end
|
||||
end
|
||||
|
||||
context 'Enabled file_logging and step greater than 3' do
|
||||
let(:params) { {
|
||||
:step => 3,
|
||||
:enable_file_logging => true
|
||||
} }
|
||||
it 'Contains both' do
|
||||
is_expected.to compile.with_all_deps
|
||||
is_expected.to contain_class('collectd')
|
||||
is_expected.to contain_class('collectd::plugin::logfile')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os.each do |os, facts|
|
||||
|
Loading…
x
Reference in New Issue
Block a user