From 6cf03122ee6caf51546f673c2899a1fff6fe9f12 Mon Sep 17 00:00:00 2001 From: Juan Pablo Suazo Date: Tue, 8 Mar 2022 11:59:27 -0300 Subject: [PATCH] Support Prometheus as metrics database for Ceilometer This commit adds support for pushing Ceilometer metrics to Prometheus instead of Gnocchi or alongside it. Closes-Bug: #1964135 Signed-off-by: Juan Pablo Suazo Change-Id: I9fd32f63913a534c59e2d17703702074eea5dd76 --- ansible/group_vars/all.yml | 1 + ansible/roles/ceilometer/defaults/main.yml | 8 +++++++- ansible/roles/ceilometer/tasks/precheck.yml | 2 +- ansible/roles/ceilometer/templates/pipeline.yaml.j2 | 5 +++++ releasenotes/notes/bug-1964135-383c8bf4fad16618.yaml | 8 ++++++++ 5 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/bug-1964135-383c8bf4fad16618.yaml diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 286bd56b30..9544c2d568 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -605,6 +605,7 @@ enable_barbican: "no" enable_blazar: "no" enable_ceilometer: "no" enable_ceilometer_ipmi: "no" +enable_ceilometer_prometheus_pushgateway: "no" enable_cells: "no" enable_central_logging: "no" enable_ceph_rgw: "no" diff --git a/ansible/roles/ceilometer/defaults/main.yml b/ansible/roles/ceilometer/defaults/main.yml index 3a7fa76e7b..6bc75b3a5e 100644 --- a/ansible/roles/ceilometer/defaults/main.yml +++ b/ansible/roles/ceilometer/defaults/main.yml @@ -182,6 +182,12 @@ ceilometer_ks_users: # Backend #################### -ceilometer_database_type: "gnocchi" +ceilometer_database_type: "{{ 'gnocchi' if (enable_gnocchi | bool) else '' }}" ceilometer_upgrade_params: "" + +#################### +# Pushgateway +#################### +ceilometer_prometheus_pushgateway_host: "127.0.0.1" +ceilometer_prometheus_pushgateway_port: "9091" diff --git a/ansible/roles/ceilometer/tasks/precheck.yml b/ansible/roles/ceilometer/tasks/precheck.yml index dd5d430ee6..96240ca94d 100644 --- a/ansible/roles/ceilometer/tasks/precheck.yml +++ b/ansible/roles/ceilometer/tasks/precheck.yml @@ -12,4 +12,4 @@ changed_when: false when: - enable_ceilometer | bool - - not enable_gnocchi | bool + - not (enable_gnocchi | bool or enable_ceilometer_prometheus_pushgateway | bool) diff --git a/ansible/roles/ceilometer/templates/pipeline.yaml.j2 b/ansible/roles/ceilometer/templates/pipeline.yaml.j2 index 452bbdbbab..b215e364f9 100644 --- a/ansible/roles/ceilometer/templates/pipeline.yaml.j2 +++ b/ansible/roles/ceilometer/templates/pipeline.yaml.j2 @@ -8,4 +8,9 @@ sources: sinks: - name: meter_sink publishers: +{% if enable_gnocchi | bool %} - gnocchi:// +{% endif %} +{% if enable_ceilometer_prometheus_pushgateway | bool %} + - prometheus://{{ ceilometer_prometheus_pushgateway_host }}:{{ ceilometer_prometheus_pushgateway_port }}/metrics/job/openstack-telemetry +{% endif %} diff --git a/releasenotes/notes/bug-1964135-383c8bf4fad16618.yaml b/releasenotes/notes/bug-1964135-383c8bf4fad16618.yaml new file mode 100644 index 0000000000..9d943f7554 --- /dev/null +++ b/releasenotes/notes/bug-1964135-383c8bf4fad16618.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + Adds the ability to use Prometheus as the metrics database for Ceilometer. + + Adapts Ceilometer configurations so metrics can be pushed to a Prometheus + Pushgateway. + `LP#1964135 `__