diff --git a/ansible/roles/prometheus/defaults/main.yml b/ansible/roles/prometheus/defaults/main.yml index 99e04a9109..cf99d2c039 100644 --- a/ansible/roles/prometheus/defaults/main.yml +++ b/ansible/roles/prometheus/defaults/main.yml @@ -109,6 +109,12 @@ prometheus_services: volumes: "{{ prometheus_libvirt_exporter_default_volumes + prometheus_libvirt_exporter_extra_volumes }}" dimensions: "{{ prometheus_libvirt_exporter_dimensions }}" +#################### +# Prometheus Server +#################### +prometheus_external_labels: +# : + #################### # Database #################### diff --git a/ansible/roles/prometheus/templates/prometheus.yml.j2 b/ansible/roles/prometheus/templates/prometheus.yml.j2 index 1346badb2e..85483cc918 100644 --- a/ansible/roles/prometheus/templates/prometheus.yml.j2 +++ b/ansible/roles/prometheus/templates/prometheus.yml.j2 @@ -2,8 +2,12 @@ global: scrape_interval: {{ prometheus_scrape_interval }} scrape_timeout: 10s evaluation_interval: 15s +{% if prometheus_external_labels %} external_labels: - monitor: 'kolla' +{% for label, value in prometheus_external_labels.items() %} + {{ label }}: {{ value }} +{% endfor %} +{% endif %} {% if prometheus_alert_rules.files is defined and prometheus_alert_rules.files | length > 0 %} rule_files: diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml index f80dc13c2f..0912ee0c3a 100644 --- a/etc/kolla/globals.yml +++ b/etc/kolla/globals.yml @@ -709,6 +709,12 @@ workaround_ansible_issue_8743: yes #enable_prometheus_libvirt_exporter: "{{ enable_prometheus | bool and enable_nova | bool and nova_compute_virt_type in ['kvm', 'qemu'] }}" #enable_prometheus_etcd_integration: "{{ enable_prometheus | bool and enable_etcd | bool }}" +# The labels to add to any time series or alerts when communicating with external systems (federation, remote storage, Alertmanager). +# prometheus_external_labels: +# : +# By default, prometheus_external_labels is empty +#prometheus_external_labels: + # List of extra parameters passed to prometheus. You can add as many to the list. #prometheus_cmdline_extras: diff --git a/releasenotes/notes/make-external-labels-optional-744f5454bcfa70f7.yaml b/releasenotes/notes/make-external-labels-optional-744f5454bcfa70f7.yaml new file mode 100644 index 0000000000..e3708a955b --- /dev/null +++ b/releasenotes/notes/make-external-labels-optional-744f5454bcfa70f7.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + Fixes `monitor: kolla` be added in `external_labels` by default. + Prometheus default config should not include environment-specific + details. In this patch, modify `external_labels` be optional, we + can add any `: ` in `external_labels`. + `LP#1944699 `__