Manage /etc/ceilometer/polling.yaml

This adds management of /etc/ceilometer/polling.yaml which defines which metrics
to poll and how often. This pulls in the default configuration which the same
for both RHEL and Ubuntu and adds two new attributes for configuring the file.

In addition, restart various services related to the configuration file.

Change-Id: I69ed0a8933a971d9cac20dbd4133197a7e4274af
Signed-off-by: Lance Albertson <lance@osuosl.org>
This commit is contained in:
Lance Albertson 2019-10-24 09:45:25 -07:00 committed by Jens Harbott (frickler)
parent 0a6f1d840a
commit 2e36b048fc
10 changed files with 108 additions and 0 deletions

View File

@ -72,6 +72,33 @@ default['openstack']['telemetry_metric']['gnocchi-upgrade-options'] = ''
# Configuration for /etc/ceilometer/pipeline.yaml
default['openstack']['telemetry']['pipeline']['publishers'] = ['gnocchi://']
# Configuration for /etc/ceilometer/polling.yaml
default['openstack']['telemetry']['polling']['interval'] = 300
default['openstack']['telemetry']['polling']['meters'] =
%w(
cpu
cpu_l3_cache
memory.usage
network.incoming.bytes
network.incoming.packets
network.outgoing.bytes
network.outgoing.packets
disk.device.read.bytes
disk.device.read.requests
disk.device.write.bytes
disk.device.write.requests
hardware.cpu.util
hardware.memory.used
hardware.memory.total
hardware.memory.buffer
hardware.memory.cached
hardware.memory.swap.avail
hardware.memory.swap.total
hardware.system_stats.io.outgoing.blocks
hardware.system_stats.io.incoming.blocks
hardware.network.ip.incoming.datagrams
hardware.network.ip.outgoing.datagrams
)
%w(telemetry_metric aodh).each do |ts|
# specify whether to enable SSL for ceilometer API endpoint

View File

@ -33,5 +33,6 @@ service 'ceilometer-agent-central' do
service_name platform['agent_central_service']
subscribes :restart, "template[#{node['openstack']['telemetry']['conf_file']}]"
subscribes :restart, "template[#{::File.join(node['openstack']['telemetry']['conf_dir'], 'pipeline.yaml')}]"
subscribes :restart, "template[#{::File.join(node['openstack']['telemetry']['conf_dir'], 'polling.yaml')}]"
action [:enable, :start]
end

View File

@ -33,5 +33,6 @@ service 'ceilometer-agent-compute' do
service_name platform['agent_compute_service']
subscribes :restart, "template[#{node['openstack']['telemetry']['conf_file']}]"
subscribes :restart, "template[#{::File.join(node['openstack']['telemetry']['conf_dir'], 'pipeline.yaml')}]"
subscribes :restart, "template[#{::File.join(node['openstack']['telemetry']['conf_dir'], 'polling.yaml')}]"
action [:enable, :start]
end

View File

@ -32,5 +32,6 @@ service 'ceilometer-agent-notification' do
service_name platform['agent_notification_service']
subscribes :restart, "template[#{node['openstack']['telemetry']['conf_file']}]"
subscribes :restart, "template[#{::File.join(node['openstack']['telemetry']['conf_dir'], 'pipeline.yaml')}]"
subscribes :restart, "template[#{::File.join(node['openstack']['telemetry']['conf_dir'], 'polling.yaml')}]"
action [:enable, :start]
end

View File

@ -109,3 +109,14 @@ template ::File.join(node['openstack']['telemetry']['conf_dir'], 'pipeline.yaml'
publishers: node['openstack']['telemetry']['pipeline']['publishers']
)
end
template ::File.join(node['openstack']['telemetry']['conf_dir'], 'polling.yaml') do
source 'polling.yaml.erb'
owner node['openstack']['telemetry']['user']
group node['openstack']['telemetry']['group']
mode 0o0640
variables(
interval: node['openstack']['telemetry']['polling']['interval'],
meters: node['openstack']['telemetry']['polling']['meters']
)
end

View File

@ -27,6 +27,9 @@ describe 'openstack-telemetry::agent-central' do
it 'subscribes to /etc/ceilometer/pipeline.yaml' do
expect(chef_run.service('ceilometer-agent-central')).to subscribe_to('template[/etc/ceilometer/pipeline.yaml]').delayed
end
it 'subscribes to /etc/ceilometer/polling.yaml' do
expect(chef_run.service('ceilometer-agent-central')).to subscribe_to('template[/etc/ceilometer/polling.yaml]').delayed
end
end
end
end

View File

@ -27,6 +27,9 @@ describe 'openstack-telemetry::agent-compute' do
it 'subscribes to /etc/ceilometer/pipeline.yaml' do
expect(chef_run.service('ceilometer-agent-compute')).to subscribe_to('template[/etc/ceilometer/pipeline.yaml]').delayed
end
it 'subscribes to /etc/ceilometer/polling.yaml' do
expect(chef_run.service('ceilometer-agent-compute')).to subscribe_to('template[/etc/ceilometer/polling.yaml]').delayed
end
end
end
end

View File

@ -27,6 +27,9 @@ describe 'openstack-telemetry::agent-notification' do
it 'subscribes to /etc/ceilometer/pipeline.yaml' do
expect(chef_run.service('ceilometer-agent-notification')).to subscribe_to('template[/etc/ceilometer/pipeline.yaml]').delayed
end
it 'subscribes to /etc/ceilometer/polling.yaml' do
expect(chef_run.service('ceilometer-agent-notification')).to subscribe_to('template[/etc/ceilometer/polling.yaml]').delayed
end
end
end
end

View File

@ -50,6 +50,55 @@ EOL
end
end
describe '/etc/ceilometer/polling.yaml' do
polling_yaml = <<-EOL
# This file is automatically generated by Chef
# Any changes will be overwritten
---
sources:
- name: some_pollsters
interval: 300
meters:
- cpu
- cpu_l3_cache
- memory.usage
- network.incoming.bytes
- network.incoming.packets
- network.outgoing.bytes
- network.outgoing.packets
- disk.device.read.bytes
- disk.device.read.requests
- disk.device.write.bytes
- disk.device.write.requests
- hardware.cpu.util
- hardware.memory.used
- hardware.memory.total
- hardware.memory.buffer
- hardware.memory.cached
- hardware.memory.swap.avail
- hardware.memory.swap.total
- hardware.system_stats.io.outgoing.blocks
- hardware.system_stats.io.incoming.blocks
- hardware.network.ip.incoming.datagrams
- hardware.network.ip.outgoing.datagrams
EOL
it do
expect(chef_run).to create_template('/etc/ceilometer/polling.yaml')
.with(
source: 'polling.yaml.erb',
owner: 'ceilometer',
group: 'ceilometer',
mode: 0o0640
)
end
it do
expect(chef_run).to render_file('/etc/ceilometer/polling.yaml').with_content(polling_yaml)
end
end
describe '/etc/ceilometer' do
let(:dir) { chef_run.directory('/etc/ceilometer') }

View File

@ -0,0 +1,9 @@
<%= node['openstack']['common']['custom_template_banner'] %>
---
sources:
- name: some_pollsters
interval: <%= @interval %>
meters:
<% @meters.each do |meter| -%>
- <%= meter %>
<% end -%>