Add support for Ceilometer custom polling.yaml

By default, Ceilometer uses polling.yaml as cfg_file [1][2] that defines
the limit default numbers of metrics polled. Users may want to define
their own polled metrics.

[1] https://github.com/openstack/ceilometer/blob/master/ceilometer/polling/manager.py#L54
[2] https://github.com/openstack/ceilometer/blob/master/etc/ceilometer/polling.yaml

Change-Id: Iadd627ca3c767453e71c8a0c2044f00f30055f16
This commit is contained in:
Kien Nguyen 2018-06-04 11:13:30 +07:00
parent 5155cd1f93
commit d2f4055ce0
5 changed files with 50 additions and 3 deletions

View File

@ -7,6 +7,7 @@
ceilometer_conf: "{{ ceilometer_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
ceilometer_pipeline: "{{ ceilometer_pipelines.results|selectattr('item.key', 'equalto', service_name)|first }}"
policy_overwriting: "{{ ceilometer_policy_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}"
polling_overwriting: "{{ ceilometer_polling_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}"
ceilometer_notification_container: "{{ check_ceilometer_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
panko_conf: "{{ panko_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
kolla_docker:
@ -35,6 +36,7 @@
ceilometer_conf: "{{ ceilometer_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
ceilometer_pipeline: "{{ ceilometer_pipelines.results|selectattr('item.key', 'equalto', service_name)|first }}"
policy_overwriting: "{{ ceilometer_policy_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}"
polling_overwriting: "{{ ceilometer_polling_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}"
ceilometer_central_container: "{{ check_ceilometer_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
kolla_docker:
action: "recreate_or_restart_container"
@ -60,6 +62,7 @@
ceilometer_conf: "{{ ceilometer_confs.results|selectattr('item.key', 'equalto', service_name)|first }}"
ceilometer_pipeline: "{{ ceilometer_pipelines.results|selectattr('item.key', 'equalto', service_name)|first }}"
policy_overwriting: "{{ ceilometer_policy_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}"
polling_overwriting: "{{ ceilometer_polling_overwriting.results|selectattr('item.key', 'equalto', service_name)|first }}"
ceilometer_compute_container: "{{ check_ceilometer_containers.results|selectattr('item.key', 'equalto', service_name)|first }}"
kolla_docker:
action: "recreate_or_restart_container"

View File

@ -12,6 +12,32 @@
- item.value.enabled | bool
with_dict: "{{ ceilometer_services }}"
- name: Check custom polling.yaml exists
local_action: stat path="{{ node_custom_config }}/ceilometer/polling.yaml"
register: ceilometer_polling_file
- name: Copying over polling.yaml
copy:
src: "{{ node_custom_config }}/ceilometer/polling.yaml"
dest: "{{ node_config_directory }}/{{ item.key }}/polling.yaml"
force: True
mode: "0600"
become: true
register: ceilometer_polling_overwriting
when:
- ceilometer_polling_file.stat.exists
- inventory_hostname in groups[item.value.group]
- item.value.enabled | bool
with_dict: "{{ ceilometer_services }}"
notify:
- "Restart {{ item.key }} container"
- name: Set ceilometer polling file's path
set_fact:
ceilometer_polling_file_path: "{{ ceilometer_polling_file.stat.path }}"
when:
- ceilometer_polling_file.stat.exists
- name: Check if policies shall be overwritten
local_action: stat path="{{ item }}"
run_once: True

View File

@ -6,7 +6,13 @@
"dest": "/etc/ceilometer/ceilometer.conf",
"owner": "ceilometer",
"perm": "0600"
}{% if ceilometer_policy_file is defined %},
}{% if ceilometer_polling_file_path is defined %},
{
"source": "{{ container_config_directory }}/polling.yaml",
"dest": "/etc/ceilometer/polling.yaml",
"owner": "ceilometer",
"perm": "0600"
}{% endif %}{% if ceilometer_policy_file is defined %},
{
"source": "{{ container_config_directory }}/{{ ceilometer_policy_file }}",
"dest": "/etc/ceilometer/{{ ceilometer_policy_file }}",

View File

@ -6,7 +6,13 @@
"dest": "/etc/ceilometer/ceilometer.conf",
"owner": "ceilometer",
"perm": "0600"
}{% if ceilometer_policy_file is defined %},
}{% if ceilometer_polling_file_path is defined %},
{
"source": "{{ container_config_directory }}/polling.yaml",
"dest": "/etc/ceilometer/polling.yaml",
"owner": "ceilometer",
"perm": "0600"
}{% endif %}{% if ceilometer_policy_file is defined %},
{
"source": "{{ container_config_directory }}/{{ ceilometer_policy_file }}",
"dest": "/etc/ceilometer/{{ ceilometer_policy_file }}",

View File

@ -24,7 +24,13 @@
"dest": "/etc/ceilometer/pipeline.yaml",
"owner": "ceilometer",
"perm": "0600"
}{% if ceilometer_policy_file is defined %},
}{% if ceilometer_polling_file_path is defined %},
{
"source": "{{ container_config_directory }}/polling.yaml",
"dest": "/etc/ceilometer/polling.yaml",
"owner": "ceilometer",
"perm": "0600"
}{% endif %}{% if ceilometer_policy_file is defined %},
{
"source": "{{ container_config_directory }}/{{ ceilometer_policy_file }}",
"dest": "/etc/ceilometer/{{ ceilometer_policy_file }}",