From e7fc3bc4419125623c69361628e0727ac6a60226 Mon Sep 17 00:00:00 2001 From: Juan Pablo Suazo Date: Mon, 11 Apr 2022 12:10:08 -0400 Subject: [PATCH] Configure Prometheus Pushgateway Options Adds the ability to configure the Prometheus Pushgateway options alongside the rest of kolla-ansible's configurations. Closes-Bug: #1968597 Signed-off-by: Juan Pablo Suazo Change-Id: I2d20288267ceda95076229628db10299ddbde31f --- ansible/roles/ceilometer/defaults/main.yml | 6 ++++ .../ceilometer/templates/pipeline.yaml.j2 | 2 +- .../feature-1968597-4b414566f82c90fa.yaml | 28 +++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/feature-1968597-4b414566f82c90fa.yaml diff --git a/ansible/roles/ceilometer/defaults/main.yml b/ansible/roles/ceilometer/defaults/main.yml index 6e06a290b0..5b6adbfb38 100644 --- a/ansible/roles/ceilometer/defaults/main.yml +++ b/ansible/roles/ceilometer/defaults/main.yml @@ -193,3 +193,9 @@ ceilometer_upgrade_params: "" #################### ceilometer_prometheus_pushgateway_host: "127.0.0.1" ceilometer_prometheus_pushgateway_port: "9091" +## Options +ceilometer_prometheus_pushgateway_options: +# timeout: 180 +# max_retries: 5 +# batch: no +# verify_ssl: no diff --git a/ansible/roles/ceilometer/templates/pipeline.yaml.j2 b/ansible/roles/ceilometer/templates/pipeline.yaml.j2 index b215e364f9..fd5fad24e6 100644 --- a/ansible/roles/ceilometer/templates/pipeline.yaml.j2 +++ b/ansible/roles/ceilometer/templates/pipeline.yaml.j2 @@ -12,5 +12,5 @@ sinks: - gnocchi:// {% endif %} {% if enable_ceilometer_prometheus_pushgateway | bool %} - - prometheus://{{ ceilometer_prometheus_pushgateway_host }}:{{ ceilometer_prometheus_pushgateway_port }}/metrics/job/openstack-telemetry + - prometheus://{{ ceilometer_prometheus_pushgateway_host }}:{{ ceilometer_prometheus_pushgateway_port }}/metrics/job/openstack-telemetry{% if ceilometer_prometheus_pushgateway_options %}/?{{ (ceilometer_prometheus_pushgateway_options|dict2items|rejectattr("value", "equalto", None)|list|items2dict).items() | map("join", "=") | join("&")}}{% endif %} {% endif %} diff --git a/releasenotes/notes/feature-1968597-4b414566f82c90fa.yaml b/releasenotes/notes/feature-1968597-4b414566f82c90fa.yaml new file mode 100644 index 0000000000..0697080c4b --- /dev/null +++ b/releasenotes/notes/feature-1968597-4b414566f82c90fa.yaml @@ -0,0 +1,28 @@ +--- +features: + - | + Adds ability to configure the Prometheus pushgateway options of its URL. + + Adds a new variable ``ceilometer_prometheus_pushgateway_options``. This is + a dictionary whose keys are the options to be set and its values contain + what to set them to. + + These options and respective values are then added to the pushgateway's + URL, checking that no "None" value is being set. + + For example, the following configurations: + + .. code-block:: yaml + + ceilometer_prometheus_pushgateway_host: "127.0.0.1" + ceilometer_prometheus_pushgateway_port: "9091" + ceilometer_prometheus_pushgateway_options: + timeout: 180 + max_retries: + verify_ssl: yes + + Result in the following URL: + ``prometheus://127.0.0.1:9091/ \ + metrics/job/openstack-telemetry/?timeout=180&verify_ssl=True`` + + `LP#1968597 `__