Allow to configure the polling interval
This change allows the management of polling.yaml. This allow to configure the polling interval. Change-Id: I4e63d48e57700146ccfb6685cc1e3ad1c9e6102f
This commit is contained in:
parent
6431cca541
commit
36b2ecdd7c
@ -40,6 +40,14 @@
|
|||||||
# * libvirt_metadata: get instances from libvirt metadata
|
# * libvirt_metadata: get instances from libvirt metadata
|
||||||
# but without instance metadata (recommended for Gnocchi backend).
|
# but without instance metadata (recommended for Gnocchi backend).
|
||||||
#
|
#
|
||||||
|
# [*manage_polling*]
|
||||||
|
# (Optional) Whether to manage polling.yaml
|
||||||
|
# Defaults to false
|
||||||
|
#
|
||||||
|
# [*polling_interval*]
|
||||||
|
# (Optional) Number of seconds between polling cycle
|
||||||
|
# Defaults to 600 seconds, used only if manage_polling is true.
|
||||||
|
#
|
||||||
class ceilometer::agent::polling (
|
class ceilometer::agent::polling (
|
||||||
$manage_service = true,
|
$manage_service = true,
|
||||||
$enabled = true,
|
$enabled = true,
|
||||||
@ -49,6 +57,8 @@ class ceilometer::agent::polling (
|
|||||||
$ipmi_namespace = true,
|
$ipmi_namespace = true,
|
||||||
$coordination_url = undef,
|
$coordination_url = undef,
|
||||||
$instance_discovery_method = $::os_service_default,
|
$instance_discovery_method = $::os_service_default,
|
||||||
|
$manage_polling = false,
|
||||||
|
$polling_interval = 600,
|
||||||
) inherits ceilometer {
|
) inherits ceilometer {
|
||||||
|
|
||||||
include ::ceilometer::deps
|
include ::ceilometer::deps
|
||||||
@ -127,4 +137,13 @@ class ceilometer::agent::polling (
|
|||||||
'coordination/backend_url': value => $coordination_url
|
'coordination/backend_url': value => $coordination_url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $manage_polling {
|
||||||
|
file { 'polling':
|
||||||
|
ensure => present,
|
||||||
|
path => $::ceilometer::params::polling,
|
||||||
|
content => template('ceilometer/polling.yaml.erb'),
|
||||||
|
selinux_ignore_defaults => true,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ class ceilometer::params {
|
|||||||
$user = 'ceilometer'
|
$user = 'ceilometer'
|
||||||
$event_pipeline = '/etc/ceilometer/event_pipeline.yaml'
|
$event_pipeline = '/etc/ceilometer/event_pipeline.yaml'
|
||||||
$pipeline = '/etc/ceilometer/pipeline.yaml'
|
$pipeline = '/etc/ceilometer/pipeline.yaml'
|
||||||
|
$polling = '/etc/ceilometer/polling.yaml'
|
||||||
$client_package_name = 'python-ceilometerclient'
|
$client_package_name = 'python-ceilometerclient'
|
||||||
|
|
||||||
case $::osfamily {
|
case $::osfamily {
|
||||||
|
@ -117,6 +117,24 @@ describe 'ceilometer::agent::polling' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "with polling management enabled" do
|
||||||
|
before { params.merge!(
|
||||||
|
:manage_polling => true
|
||||||
|
) }
|
||||||
|
|
||||||
|
it { is_expected.to contain_file('polling').with(
|
||||||
|
'path' => '/etc/ceilometer/polling.yaml',
|
||||||
|
) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with polling management disabled" do
|
||||||
|
before { params.merge!(
|
||||||
|
:manage_polling => false
|
||||||
|
) }
|
||||||
|
|
||||||
|
it { is_expected.not_to contain_file('polling') }
|
||||||
|
end
|
||||||
|
|
||||||
it 'configures central agent' do
|
it 'configures central agent' do
|
||||||
is_expected.to contain_ceilometer_config('coordination/backend_url').with_value( params[:coordination_url] )
|
is_expected.to contain_ceilometer_config('coordination/backend_url').with_value( params[:coordination_url] )
|
||||||
end
|
end
|
||||||
|
6
templates/polling.yaml.erb
Normal file
6
templates/polling.yaml.erb
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
sources:
|
||||||
|
- name: all_pollsters
|
||||||
|
interval: <%= @polling_interval %>
|
||||||
|
meters:
|
||||||
|
- "*"
|
Loading…
x
Reference in New Issue
Block a user