diff options
author | Christian Pointner <equinox@spreadspace.org> | 2022-03-09 23:25:28 +0100 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2022-03-09 23:25:28 +0100 |
commit | e9cad366c80a621542f57bcb9b8708b43296819b (patch) | |
tree | eb7c034e25a284d1388479f6955425772cd7d67b /roles/monitoring/prometheus/server/templates | |
parent | ch-ap: switch to WPA2 only (diff) | |
parent | prometheus/alerta: tune some severities (diff) |
Merge branch 'experiment/alerta'
Diffstat (limited to 'roles/monitoring/prometheus/server/templates')
-rw-r--r-- | roles/monitoring/prometheus/server/templates/prometheus.service.j2 | 2 | ||||
-rw-r--r-- | roles/monitoring/prometheus/server/templates/prometheus.yml.j2 | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/roles/monitoring/prometheus/server/templates/prometheus.service.j2 b/roles/monitoring/prometheus/server/templates/prometheus.service.j2 index 77a3b02a..e65e9425 100644 --- a/roles/monitoring/prometheus/server/templates/prometheus.service.j2 +++ b/roles/monitoring/prometheus/server/templates/prometheus.service.j2 @@ -6,7 +6,7 @@ After=time-sync.target [Service] Restart=on-failure User=prometheus -ExecStart=/usr/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/metrics2/ --storage.tsdb.retention.time={{ prometheus_server_retention }}{% if prometheus_server_web_external_url is defined %} --web.external-url={{ prometheus_server_web_external_url }}{% endif %}{% if prometheus_server_auth_users is defined %} --web.config.file=/etc/prometheus/prometheus-web.yml{% endif %} --web.listen-address={{ prometheus_server_web_listen_address }} +ExecStart=/usr/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/metrics2/ --storage.tsdb.retention.time={{ prometheus_server_retention }}{% if prometheus_server_web_external_url is defined %} --web.external-url={{ prometheus_server_web_external_url }}{% endif %}{% if prometheus_server_web_route_prefix is defined %} --web.route-prefix={{ prometheus_server_web_route_prefix }}{% endif %}{% if prometheus_server_auth_users is defined %} --web.config.file=/etc/prometheus/prometheus-web.yml{% endif %} --web.listen-address={{ prometheus_server_web_listen_address }} ExecReload=/bin/kill -HUP $MAINPID TimeoutStopSec=20s SendSIGKILL=no diff --git a/roles/monitoring/prometheus/server/templates/prometheus.yml.j2 b/roles/monitoring/prometheus/server/templates/prometheus.yml.j2 index 883aa223..aed69de5 100644 --- a/roles/monitoring/prometheus/server/templates/prometheus.yml.j2 +++ b/roles/monitoring/prometheus/server/templates/prometheus.yml.j2 @@ -3,6 +3,12 @@ global: scrape_interval: 15s evaluation_interval: 15s +{% if prometheus_server_external_labels is defined %} + external_labels: +{% for name, value in prometheus_server_external_labels.items() %} + {{ name }}: {{ value }} +{% endfor %} +{% endif %} rule_files: - /etc/prometheus/rules/*.yml @@ -27,8 +33,8 @@ alerting: scrape_configs: - job_name: 'prometheus' -{% if prometheus_server_web_external_url is defined %} - metrics_path: '{{ (prometheus_server_web_external_url | urlsplit('path'), 'metrics') | path_join }}' +{% if prometheus_server_web_route_prefix is defined or prometheus_server_web_external_url is defined %} + metrics_path: '{{ (prometheus_server_web_route_prefix | default(prometheus_server_web_external_url | default('') | urlsplit('path')), 'metrics') | path_join }}' {% endif %} {% if prometheus_server_selfscraping_auth is defined %} basic_auth: |