Implement Gnocchi dispatcher
* Add dispatcher options to ceilometer::collector. * Create ceilometer::dispatcher::gnocchi class, with current upstream options. * Add an example of manifest. * Unit & functional tests. Note: This patch implement os_service_defaults only for the new class. For collector, it will be updated in one patch in another patchset. Change-Id: Id9364e1e1337708b1e0254b4c6268f1a0b1a42ad
This commit is contained in:
parent
0c31e5e35a
commit
f47c52f26d
34
examples/ceilometer_with_gnocchi.pp
Normal file
34
examples/ceilometer_with_gnocchi.pp
Normal file
@ -0,0 +1,34 @@
|
||||
class { '::ceilometer':
|
||||
metering_secret => 'secrete',
|
||||
rabbit_userid => 'ceilometer',
|
||||
rabbit_password => 'an_even_bigger_secret',
|
||||
rabbit_host => '127.0.0.1',
|
||||
}
|
||||
class { '::ceilometer::db::mysql':
|
||||
password => 'a_big_secret',
|
||||
}
|
||||
class { '::ceilometer::db':
|
||||
database_connection => 'mysql://ceilometer:a_big_secret@127.0.0.1/ceilometer?charset=utf8',
|
||||
}
|
||||
class { '::ceilometer::keystone::auth':
|
||||
password => 'a_big_secret',
|
||||
}
|
||||
class { '::ceilometer::client': }
|
||||
class { '::ceilometer::expirer': }
|
||||
class { '::ceilometer::agent::central': }
|
||||
class { '::ceilometer::agent::notification': }
|
||||
class { '::ceilometer::api':
|
||||
enabled => true,
|
||||
keystone_password => 'a_big_secret',
|
||||
keystone_identity_uri => 'http://127.0.0.1:35357/',
|
||||
service_name => 'httpd',
|
||||
}
|
||||
include ::apache
|
||||
class { '::ceilometer::wsgi::apache':
|
||||
ssl => false,
|
||||
}
|
||||
|
||||
class { '::ceilometer::collector':
|
||||
meter_dispatcher => ['gnocchi'],
|
||||
}
|
||||
class { '::ceilometer::dispatcher::gnocchi': }
|
@ -22,12 +22,24 @@
|
||||
# (optional) the ceilometer collector udp bind port.
|
||||
# Defaults to '4952'
|
||||
#
|
||||
# [*meter_dispatcher*]
|
||||
# (optional) dispatcher driver(s) to process meter data.
|
||||
# Can be an array or a string.
|
||||
# Defaults to 'database'
|
||||
#
|
||||
# [*event_dispatcher*]
|
||||
# (optional) dispatcher driver(s) to process event data.
|
||||
# Can be an array or a string.
|
||||
# Defaults to 'database'
|
||||
#
|
||||
class ceilometer::collector (
|
||||
$manage_service = true,
|
||||
$enabled = true,
|
||||
$package_ensure = 'present',
|
||||
$udp_address = '0.0.0.0',
|
||||
$udp_port = '4952',
|
||||
$manage_service = true,
|
||||
$enabled = true,
|
||||
$package_ensure = 'present',
|
||||
$udp_address = '0.0.0.0',
|
||||
$udp_port = '4952',
|
||||
$meter_dispatcher = 'database',
|
||||
$event_dispatcher = 'database',
|
||||
) {
|
||||
|
||||
include ::ceilometer::params
|
||||
@ -41,8 +53,10 @@ class ceilometer::collector (
|
||||
}
|
||||
|
||||
ceilometer_config {
|
||||
'collector/udp_address' : value => $udp_address;
|
||||
'collector/udp_port' : value => $udp_port;
|
||||
'collector/udp_address': value => $udp_address;
|
||||
'collector/udp_port': value => $udp_port;
|
||||
'DEFAULT/meter_dispatcher': value => join(any2array($meter_dispatcher), ',');
|
||||
'DEFAULT/event_dispatcher': value => join(any2array($event_dispatcher), ',');
|
||||
}
|
||||
|
||||
Package[$::ceilometer::params::collector_package_name] -> Service['ceilometer-collector']
|
||||
|
43
manifests/dispatcher/gnocchi.pp
Normal file
43
manifests/dispatcher/gnocchi.pp
Normal file
@ -0,0 +1,43 @@
|
||||
# Configure Gnocchi dispatcher for Ceilometer
|
||||
#
|
||||
# == Params
|
||||
#
|
||||
# [*filter_service_activity*]
|
||||
# (optional) Filter out samples generated by Gnocchi service activity.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*filter_project*]
|
||||
# (optional) Gnocchi project used to filter out samples
|
||||
# generated by Gnocchi service activity
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*url*]
|
||||
# (optional) Gnocchi URL
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*archive_policy*]
|
||||
# (optional) The archive policy to use when the dispatcher
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*resources_definition_file*]
|
||||
# (optional) The Yaml file that defines mapping between samples
|
||||
# and gnocchi resources/metrics.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
class ceilometer::dispatcher::gnocchi (
|
||||
$filter_service_activity = $::os_service_default,
|
||||
$filter_project = $::os_service_default,
|
||||
$url = $::os_service_default,
|
||||
$archive_policy = $::os_service_default,
|
||||
$resources_definition_file = $::os_service_default,
|
||||
) {
|
||||
|
||||
ceilometer_config {
|
||||
'dispatcher_gnocchi/filter_service_activity': value => $filter_service_activity;
|
||||
'dispatcher_gnocchi/filter_project': value => $filter_project;
|
||||
'dispatcher_gnocchi/url': value => $url;
|
||||
'dispatcher_gnocchi/archive_policy': value => $archive_policy;
|
||||
'dispatcher_gnocchi/resources_definition_file': value => $resources_definition_file;
|
||||
}
|
||||
|
||||
}
|
@ -83,6 +83,7 @@ describe 'ceilometer with mysql' do
|
||||
keystone_password => 'a_big_secret',
|
||||
keystone_identity_uri => 'http://127.0.0.1:35357/',
|
||||
}
|
||||
class { '::ceilometer::dispatcher::gnocchi': }
|
||||
EOS
|
||||
|
||||
|
||||
|
@ -60,6 +60,7 @@ describe 'ceilometer with mysql' do
|
||||
class { '::ceilometer::wsgi::apache':
|
||||
ssl => false,
|
||||
}
|
||||
class { '::ceilometer::dispatcher::gnocchi': }
|
||||
EOS
|
||||
|
||||
|
||||
|
@ -53,6 +53,8 @@ describe 'ceilometer::collector' do
|
||||
it 'configures ceilometer-collector server' do
|
||||
is_expected.to contain_ceilometer_config('collector/udp_address').with_value( '0.0.0.0' )
|
||||
is_expected.to contain_ceilometer_config('collector/udp_port').with_value( '4952' )
|
||||
is_expected.to contain_ceilometer_config('DEFAULT/meter_dispatcher').with_value( 'database' )
|
||||
is_expected.to contain_ceilometer_config('DEFAULT/event_dispatcher').with_value( 'database' )
|
||||
end
|
||||
|
||||
it 'installs ceilometer-collector package' do
|
||||
|
54
spec/classes/ceilometer_dispatcher_gnocchi_spec.rb
Normal file
54
spec/classes/ceilometer_dispatcher_gnocchi_spec.rb
Normal file
@ -0,0 +1,54 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'ceilometer::dispatcher::gnocchi' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'ceilometer': metering_secret => 's3cr3t' }"
|
||||
end
|
||||
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
shared_examples_for 'ceilometer-gnocchi-dispatcher' do
|
||||
it 'configures gnocchi dispatcher' do
|
||||
is_expected.to contain_ceilometer_config('dispatcher_gnocchi/filter_service_activity').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ceilometer_config('dispatcher_gnocchi/filter_project').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ceilometer_config('dispatcher_gnocchi/url').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ceilometer_config('dispatcher_gnocchi/archive_policy').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ceilometer_config('dispatcher_gnocchi/resources_definition_file').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
|
||||
context 'when overriding parameters' do
|
||||
before do
|
||||
params.merge!(:filter_service_activity => false,
|
||||
:filter_project => true,
|
||||
:url => 'http://foo',
|
||||
:archive_policy => 'high',
|
||||
:resources_definition_file => 'foo')
|
||||
end
|
||||
it { is_expected.to contain_ceilometer_config('dispatcher_gnocchi/filter_service_activity').with_value('false') }
|
||||
it { is_expected.to contain_ceilometer_config('dispatcher_gnocchi/filter_project').with_value('true') }
|
||||
it { is_expected.to contain_ceilometer_config('dispatcher_gnocchi/url').with_value('http://foo') }
|
||||
it { is_expected.to contain_ceilometer_config('dispatcher_gnocchi/archive_policy').with_value('high') }
|
||||
it { is_expected.to contain_ceilometer_config('dispatcher_gnocchi/resources_definition_file').with_value('foo') }
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
@default_facts.merge({ :osfamily => 'Debian' })
|
||||
end
|
||||
|
||||
it_configures 'ceilometer-gnocchi-dispatcher'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
@default_facts.merge({ :osfamily => 'RedHat' })
|
||||
end
|
||||
|
||||
it_configures 'ceilometer-gnocchi-dispatcher'
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue
Block a user