summaryrefslogtreecommitdiff
path: root/roles/monitoring/prometheus/server/templates
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2021-10-27 23:30:04 +0200
committerChristian Pointner <equinox@spreadspace.org>2021-10-27 23:30:04 +0200
commit187894ff0d651f0f9924df9a40bc1085f4172612 (patch)
treeb8493c7f811f01e760b0d7b40c17bcef41017a62 /roles/monitoring/prometheus/server/templates
parentadd basic auth to prometheus/server (diff)
prometheus add basic auth to alert-manager
Diffstat (limited to 'roles/monitoring/prometheus/server/templates')
-rw-r--r--roles/monitoring/prometheus/server/templates/prometheus.service.j22
-rw-r--r--roles/monitoring/prometheus/server/templates/prometheus.yml.j210
2 files changed, 11 insertions, 1 deletions
diff --git a/roles/monitoring/prometheus/server/templates/prometheus.service.j2 b/roles/monitoring/prometheus/server/templates/prometheus.service.j2
index b21cceae..77a3b02a 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_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 e73ca354..98ac1aaa 100644
--- a/roles/monitoring/prometheus/server/templates/prometheus.yml.j2
+++ b/roles/monitoring/prometheus/server/templates/prometheus.yml.j2
@@ -18,6 +18,11 @@ alerting:
{% if 'path_prefix' in prometheus_server_alertmanager %}
path_prefix: '{{ prometheus_server_alertmanager.path_prefix }}'
{% endif %}
+{% if 'basic_auth' in prometheus_server_alertmanager %}
+ basic_auth:
+ username: '{{ prometheus_server_alertmanager.basic_auth.username }}'
+ password_file: '/etc/prometheus/prometheus-alertmanager.password'
+{% endif %}
{% endif %}
scrape_configs:
@@ -35,6 +40,11 @@ scrape_configs:
{% if 'path_prefix' in prometheus_server_alertmanager %}
metrics_path: '{{ (prometheus_server_alertmanager.path_prefix, 'metrics') | path_join }}'
{% endif %}
+{% if 'basic_auth' in prometheus_server_alertmanager %}
+ basic_auth:
+ username: '{{ prometheus_server_alertmanager.basic_auth.username }}'
+ password_file: '/etc/prometheus/prometheus-alertmanager.password'
+{% endif %}
static_configs:
- targets: ['{{ prometheus_server_alertmanager.url }}']
{% endif %}