forked from redhat-openstack/openstack-puppet-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TTL mechanism support with expirer service
Aims to support a TTL mechanism for data entering Ceilometer collector database. TTL is very useful to configure when getting a lot of meters. implement blueprint ttl-support Change-Id: I9d98e8b833ad94fd79722dee7226e7f4f03aaa2e Signed-off-by: Emilien Macchi <[email protected]>
- Loading branch information
Emilien Macchi
committed
Dec 7, 2013
1 parent
0fb3b8f
commit 0af2249
Showing
4 changed files
with
168 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# | ||
# Copyright (C) 2013 eNovance SAS <[email protected]> | ||
# | ||
# Author: Emilien Macchi <[email protected]> | ||
# | ||
# 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::expirer | ||
# | ||
# Setups Ceilometer Expirer service to enable TTL feature. | ||
# | ||
# === Parameters | ||
# | ||
# [*time_to_live*] | ||
# (optional) Number of seconds that samples are kept in the database. | ||
# Should be a valid integer | ||
# Defaults to '-1' to disable TTL and keep forever the datas. | ||
# | ||
# [*minute*] | ||
# (optional) Defaults to '1'. | ||
# | ||
# [*hour*] | ||
# (optional) Defaults to '0'. | ||
# | ||
# [*monthday*] | ||
# (optional) Defaults to '*'. | ||
# | ||
# [*month*] | ||
# (optional) Defaults to '*'. | ||
# | ||
# [*weekday*] | ||
# (optional) Defaults to '*'. | ||
# | ||
|
||
class ceilometer::expirer ( | ||
$time_to_live = '-1', | ||
$minute = 1, | ||
$hour = 0, | ||
$monthday = '*', | ||
$month = '*', | ||
$weekday = '*', | ||
) { | ||
|
||
include ceilometer::params | ||
|
||
Package<| title == 'ceilometer-common' |> -> Class['ceilometer::expirer'] | ||
|
||
ceilometer_config { | ||
'database/time_to_live': value => $time_to_live; | ||
} | ||
|
||
cron { 'ceilometer-expirer': | ||
command => $ceilometer::params::expirer_command, | ||
environment => 'PATH=/bin:/usr/bin:/usr/sbin', | ||
user => 'ceilometer', | ||
minute => $minute, | ||
hour => $hour, | ||
monthday => $monthday, | ||
month => $month, | ||
weekday => $weekday | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# | ||
# Copyright (C) 2013 eNovance SAS <[email protected]> | ||
# | ||
# Author: Emilien Macchi <[email protected]> | ||
# | ||
# 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. | ||
# | ||
# Unit tests for ceilometer::expirer | ||
# | ||
|
||
require 'spec_helper' | ||
|
||
describe 'ceilometer::expirer' do | ||
|
||
let :pre_condition do | ||
"class { 'ceilometer': metering_secret => 's3cr3t' }" | ||
end | ||
|
||
let :params do | ||
{ :time_to_live => '-1' } | ||
end | ||
|
||
shared_examples_for 'ceilometer-expirer' do | ||
|
||
it { should include_class('ceilometer::params') } | ||
|
||
it 'installs ceilometer common package' do | ||
should contain_package('ceilometer-common').with( | ||
:ensure => 'present', | ||
:name => platform_params[:common_package_name] | ||
) | ||
end | ||
|
||
it 'configures a cron' do | ||
should contain_cron('ceilometer-expirer').with( | ||
:command => 'ceilometer-expirer', | ||
:environment => 'PATH=/bin:/usr/bin:/usr/sbin', | ||
:user => 'ceilometer', | ||
:minute => 1, | ||
:hour => 0, | ||
:monthday => '*', | ||
:month => '*', | ||
:weekday => '*' | ||
) | ||
end | ||
|
||
it 'configures database section in ceilometer.conf' do | ||
should contain_ceilometer_config('database/time_to_live').with_value( params[:time_to_live] ) | ||
end | ||
|
||
end | ||
|
||
context 'on Debian platforms' do | ||
let :facts do | ||
{ :osfamily => 'Debian' } | ||
end | ||
|
||
let :platform_params do | ||
{ :common_package_name => 'ceilometer-common' } | ||
end | ||
|
||
it_configures 'ceilometer-expirer' | ||
end | ||
|
||
context 'on RedHat platforms' do | ||
let :facts do | ||
{ :osfamily => 'RedHat' } | ||
end | ||
|
||
let :platform_params do | ||
{ :common_package_name => 'openstack-ceilometer-common' } | ||
end | ||
|
||
it_configures 'ceilometer-expirer' | ||
end | ||
|
||
end |