11{% if pillar[' prometheus' ] is defined and pillar[' prometheus' ] is not none %}
22
3- {% from " acme/macros.jinja" import verify_and_issue % }
3+ {%- from " acme/macros.jinja" import verify_and_issue % }
44
55 {%- if pillar[" docker-ce" ] is not defined % }
66 {%- set docker_ce = {" version" : pillar[" prometheus" ][" docker-ce_version" ],
@@ -67,7 +67,7 @@ nginx_files_1:
6767 {%- endif % }
6868 proxy_pass http:// localhost:{{ instance[' port' ] }}/ {{ instance[' name' ] }}/ ;
6969 }
70- {% if instance[' pushgateway' ] is defined and instance[' pushgateway' ] is not none and instance[' pushgateway' ][' enabled' ] % }
70+ {%- if instance[' pushgateway' ] is defined and instance[' pushgateway' ] is not none and instance[' pushgateway' ][' enabled' ] % }
7171 location / {{ instance[' name' ] }}/ pushgateway/ {
7272 {%- if instance[' auth' ] is defined and instance[' auth' ] is not none % }
7373 auth_basic " Prometheus {{ instance['name'] }} " ;
@@ -81,7 +81,7 @@ nginx_files_1:
8181 proxy_pass http:// localhost:{{ instance[' pushgateway' ][' port' ] }}/ ;
8282 }
8383 {%- endif % }
84- {% if instance[' statsd-exporter' ] is defined and instance[' statsd-exporter' ] is not none and instance[' statsd-exporter' ][' enabled' ] % }
84+ {%- if instance[' statsd-exporter' ] is defined and instance[' statsd-exporter' ] is not none and instance[' statsd-exporter' ][' enabled' ] % }
8585 location / {{ instance[' name' ] }}/ statsd- exporter/ {
8686 {%- if instance[' auth' ] is defined and instance[' auth' ] is not none % }
8787 auth_basic " Prometheus {{ instance['name'] }} " ;
@@ -93,7 +93,7 @@ nginx_files_1:
9393 proxy_pass http:// localhost:{{ instance[' statsd-exporter' ][' port' ] }}/ ;
9494 }
9595 {%- endif % }
96- {% if instance[' blackbox-exporter' ] is defined and instance[' blackbox-exporter' ] is not none and instance[' blackbox-exporter' ][' enabled' ] % }
96+ {%- if instance[' blackbox-exporter' ] is defined and instance[' blackbox-exporter' ] is not none and instance[' blackbox-exporter' ][' enabled' ] % }
9797 location / {{ instance[' name' ] }}/ blackbox- exporter/ {
9898 {%- if instance[' auth' ] is defined and instance[' auth' ] is not none % }
9999 auth_basic " Prometheus {{ instance['name'] }} " ;
@@ -105,7 +105,7 @@ nginx_files_1:
105105 proxy_pass http:// localhost:{{ instance[' blackbox-exporter' ][' port' ] }}/ ;
106106 }
107107 {%- endif % }
108- {% if instance[' pagespeed-exporter' ] is defined and instance[' pagespeed-exporter' ] is not none and instance[' pagespeed-exporter' ][' enabled' ] % }
108+ {%- if instance[' pagespeed-exporter' ] is defined and instance[' pagespeed-exporter' ] is not none and instance[' pagespeed-exporter' ][' enabled' ] % }
109109 location / {{ instance[' name' ] }}/ pagespeed- exporter/ {
110110 {%- if instance[' auth' ] is defined and instance[' auth' ] is not none % }
111111 auth_basic " Prometheus {{ instance['name'] }} " ;
@@ -118,7 +118,7 @@ nginx_files_1:
118118 proxy_pass http:// localhost:{{ instance[' pagespeed-exporter' ][' port' ] }}/ ;
119119 }
120120 {%- endif % }
121- {% if instance[' redis-exporter' ] is defined and instance[' redis-exporter' ] is not none and instance[' redis-exporter' ][' enabled' ] % }
121+ {%- if instance[' redis-exporter' ] is defined and instance[' redis-exporter' ] is not none and instance[' redis-exporter' ][' enabled' ] % }
122122 location / {{ instance[' name' ] }}/ redis- exporter/ {
123123 {%- if instance[' auth' ] is defined and instance[' auth' ] is not none % }
124124 auth_basic " Prometheus {{ instance['name'] }} " ;
@@ -131,10 +131,10 @@ nginx_files_1:
131131 proxy_pass http:// localhost:{{ instance[' redis-exporter' ][' port' ] }}/ ;
132132 }
133133 {%- endif % }
134- {% if instance[' mailcow-exporters' ] is defined and instance[' mailcow-exporters' ] is not none % }
134+ {%- if instance[' mailcow-exporters' ] is defined and instance[' mailcow-exporters' ] is not none % }
135135 {%- set x_loop = loop % }
136136 {%- for mailcow_exporter_name, mailcow_exporter_params in instance[' mailcow-exporters' ].items() % }
137- {% if mailcow_exporter_params[' enabled' ] % }
137+ {%- if mailcow_exporter_params[' enabled' ] % }
138138 location / {{ instance[' name' ] }}/ mailcow- exporter/ {{ mailcow_exporter_name }} {
139139 {%- if instance[' auth' ] is defined and instance[' auth' ] is not none % }
140140 auth_basic " Prometheus {{ instance['name'] }} " ;
@@ -193,15 +193,15 @@ prometheus_dir_{{ loop.index }}_{{ i_loop.index }}:
193193 - mode: 755
194194 - makedirs: True
195195
196- {% if instance[' pushgateway' ] is defined and instance[' pushgateway' ] is not none and instance[' pushgateway' ][' enabled' ] % }
196+ {%- if instance[' pushgateway' ] is defined and instance[' pushgateway' ] is not none and instance[' pushgateway' ][' enabled' ] % }
197197prometheus_pushgateway_dir_{{ loop.index }}_{{ i_loop.index }}:
198198 file .directory:
199199 - name: / opt/ prometheus/ {{ domain[' name' ] }}/ {{ instance[' name' ] }}- pushgateway
200200 - mode: 755
201201 - makedirs: True
202202 {%- endif % }
203203
204- {% if instance[' statsd-exporter' ] is defined and instance[' statsd-exporter' ] is not none and instance[' statsd-exporter' ][' enabled' ] % }
204+ {%- if instance[' statsd-exporter' ] is defined and instance[' statsd-exporter' ] is not none and instance[' statsd-exporter' ][' enabled' ] % }
205205prometheus_statsd- exporter_dir_{{ loop.index }}_{{ i_loop.index }}:
206206 file .directory:
207207 - name: / opt/ prometheus/ {{ domain[' name' ] }}/ {{ instance[' name' ] }}- statsd- exporter
@@ -221,7 +221,7 @@ prometheus_statsd-exporter_config_{{ loop.index }}_{{ i_loop.index }}:
221221 - dataset: {{ instance[' statsd-exporter' ][' mapping-config' ] }}
222222 {%- endif % }
223223
224- {% if instance[' blackbox-exporter' ] is defined and instance[' blackbox-exporter' ] is not none and instance[' blackbox-exporter' ][' enabled' ] % }
224+ {%- if instance[' blackbox-exporter' ] is defined and instance[' blackbox-exporter' ] is not none and instance[' blackbox-exporter' ][' enabled' ] % }
225225prometheus_blackbox- exporter_dir_{{ loop.index }}_{{ i_loop.index }}:
226226 file .directory:
227227 - name: / opt/ prometheus/ {{ domain[' name' ] }}/ {{ instance[' name' ] }}- blackbox- exporter
@@ -241,7 +241,7 @@ prometheus_blackbox-exporter_config_{{ loop.index }}_{{ i_loop.index }}:
241241 - dataset: {{ instance[' blackbox-exporter' ][' config' ] }}
242242 {%- endif % }
243243
244- {% if instance[' redis-exporter' ] is defined and instance[' redis-exporter' ] is not none and instance[' redis-exporter' ][' enabled' ] % }
244+ {%- if instance[' redis-exporter' ] is defined and instance[' redis-exporter' ] is not none and instance[' redis-exporter' ][' enabled' ] % }
245245prometheus_redis- exporter_dir_{{ loop.index }}_{{ i_loop.index }}:
246246 file .directory:
247247 - name: / opt/ prometheus/ {{ domain[' name' ] }}/ {{ instance[' name' ] }}- redis- exporter
@@ -292,12 +292,17 @@ prometheus_container_{{ loop.index }}_{{ i_loop.index }}:
292292 - 127.0 .0.1:{{ instance[' port' ] }}:9090 / tcp
293293 - binds:
294294 - / opt/ prometheus/ {{ domain[' name' ] }}/ {{ instance[' name' ] }}:/ prometheus- data:rw
295- {% if instance[' retention_time' ] is defined and instance[' retention_time' ] is not none % }
296- {% set retention_time_arg = ' --storage.tsdb.retention.time=' + instance[' retention_time' ] % }
297- {% else % }
298- {% set retention_time_arg = ' ' % }
299- {% endif % }
300- - command: -- config.file= / prometheus- data/ etc/ prometheus.yml -- storage.tsdb.path= / prometheus- data {{ retention_time_arg }} -- web.external- url= https:// {{ domain[' name' ] }}/ {{ instance[' name' ] }}/ -- web.enable- admin- api
295+ {%- if instance[' retention_time' ] is defined and instance[' retention_time' ] is not none % }
296+ {%- set retention_time_arg = ' --storage.tsdb.retention.time=' + instance[' retention_time' ] % }
297+ {%- else % }
298+ {%- set retention_time_arg = ' ' % }
299+ {%- endif % }
300+ {%- if instance[' extra_args' ] is defined and instance[' extra_args' ] is not none % }
301+ {%- set extra_args = instance[' extra_args' ] % }
302+ {%- else % }
303+ {%- set extra_args = ' ' % }
304+ {%- endif % }
305+ - command: -- config.file= / prometheus- data/ etc/ prometheus.yml -- storage.tsdb.path= / prometheus- data {{ retention_time_arg }} -- web.external- url= https:// {{ domain[' name' ] }}/ {{ instance[' name' ] }}/ -- web.enable- admin- api {{ extra_args }}
301306
302307prometheus_container_restart_{{ loop.index }}_{{ i_loop.index }}:
303308 cmd.run:
@@ -315,7 +320,7 @@ prometheus_snapshot_cron_{{ loop.index }}_{{ i_loop.index }}:
315320 - minute: 20
316321 - hour: 6
317322
318- {% if instance[' pushgateway' ] is defined and instance[' pushgateway' ] is not none and instance[' pushgateway' ][' enabled' ] % }
323+ {%- if instance[' pushgateway' ] is defined and instance[' pushgateway' ] is not none and instance[' pushgateway' ][' enabled' ] % }
319324prometheus_pushgateway_image_{{ loop.index }}_{{ i_loop.index }}:
320325 cmd.run:
321326 - name: docker pull {{ instance[' pushgateway' ][' image' ] }}
@@ -338,7 +343,7 @@ prometheus_pushgateway_container_{{ loop.index }}_{{ i_loop.index }}:
338343 - command: -- persistence.file= / pushgateway- data/ persistence_file
339344 {%- endif % }
340345
341- {% if instance[' statsd-exporter' ] is defined and instance[' statsd-exporter' ] is not none and instance[' statsd-exporter' ][' enabled' ] % }
346+ {%- if instance[' statsd-exporter' ] is defined and instance[' statsd-exporter' ] is not none and instance[' statsd-exporter' ][' enabled' ] % }
342347prometheus_statsd- exporter_image_{{ loop.index }}_{{ i_loop.index }}:
343348 cmd.run:
344349 - name: docker pull {{ instance[' statsd-exporter' ][' image' ] }}
@@ -368,7 +373,7 @@ prometheus_statsd-exporter_container_restart_{{ loop.index }}_{{ i_loop.index }}
368373 - require:
369374 - docker_container: prometheus_statsd- exporter_container_{{ loop.index }}_{{ i_loop.index }}
370375 {%- endif % }
371- {% if instance[' blackbox-exporter' ] is defined and instance[' blackbox-exporter' ] is not none and instance[' blackbox-exporter' ][' enabled' ] % }
376+ {%- if instance[' blackbox-exporter' ] is defined and instance[' blackbox-exporter' ] is not none and instance[' blackbox-exporter' ][' enabled' ] % }
372377prometheus_blackbox- exporter_image_{{ loop.index }}_{{ i_loop.index }}:
373378 cmd.run:
374379 - name: docker pull {{ instance[' blackbox-exporter' ][' image' ] }}
@@ -396,7 +401,7 @@ prometheus_blackbox-exporter_container_restart_{{ loop.index }}_{{ i_loop.index
396401 - require:
397402 - docker_container: prometheus_blackbox- exporter_container_{{ loop.index }}_{{ i_loop.index }}
398403 {%- endif % }
399- {% if instance[' pagespeed-exporter' ] is defined and instance[' pagespeed-exporter' ] is not none and instance[' pagespeed-exporter' ][' enabled' ] % }
404+ {%- if instance[' pagespeed-exporter' ] is defined and instance[' pagespeed-exporter' ] is not none and instance[' pagespeed-exporter' ][' enabled' ] % }
400405prometheus_pagespeed- exporter_image_{{ loop.index }}_{{ i_loop.index }}:
401406 cmd.run:
402407 - name: docker pull {{ instance[' pagespeed-exporter' ][' image' ] }}
@@ -417,7 +422,7 @@ prometheus_pagespeed-exporter_container_{{ loop.index }}_{{ i_loop.index }}:
417422 {%- endif % }
418423 {%- endif % }
419424
420- {% if instance[' redis-exporter' ] is defined and instance[' redis-exporter' ] is not none and instance[' redis-exporter' ][' enabled' ] % }
425+ {%- if instance[' redis-exporter' ] is defined and instance[' redis-exporter' ] is not none and instance[' redis-exporter' ][' enabled' ] % }
421426prometheus_redis- exporter_image_{{ loop.index }}_{{ i_loop.index }}:
422427 cmd.run:
423428 - name: docker pull {{ instance[' redis-exporter' ][' image' ] }}
@@ -457,10 +462,10 @@ prometheus_redis-exporter_container_restart_{{ loop.index }}_{{ i_loop.index }}:
457462 {%- endif % }
458463 {%- endif % }
459464
460- {% if instance[' mailcow-exporters' ] is defined and instance[' mailcow-exporters' ] is not none % }
465+ {%- if instance[' mailcow-exporters' ] is defined and instance[' mailcow-exporters' ] is not none % }
461466 {%- set x_loop = loop % }
462467 {%- for mailcow_exporter_name, mailcow_exporter_params in instance[' mailcow-exporters' ].items() % }
463- {% if mailcow_exporter_params[' enabled' ] % }
468+ {%- if mailcow_exporter_params[' enabled' ] % }
464469prometheus_mailcow- exporter_image_{{ loop.index }}_{{ i_loop.index }}_{{ x_loop.index }}:
465470 cmd.run:
466471 - name: docker pull {{ mailcow_exporter_params[' image' ] }}
@@ -476,7 +481,7 @@ prometheus_mailcow-exporter_container_{{ loop.index }}_{{ i_loop.index }}_{{ x_l
476481 - prometheus- {{ domain[' name' ] }}- {{ instance[' name' ] }}
477482 - publish:
478483 - 127.0 .0.1:{{ mailcow_exporter_params[' port' ] }}:9099 / tcp
479- {% if ' env_vars' in mailcow_exporter_params % }
484+ {%- if ' env_vars' in mailcow_exporter_params % }
480485 - environment:
481486 {%- for var_key, var_val in mailcow_exporter_params[" env_vars" ].items() % }
482487 - {{ var_key }}: {{ var_val }}
@@ -499,25 +504,25 @@ nginx_domain_index_{{ loop.index }}:
499504 {%- endif % }
500505 {%- for instance in domain[' instances' ] % }
501506 < a href= " {{ instance['name'] }} /" > {{ instance[' name' ] }}< / a>< br>
502- {% if instance[' pushgateway' ] is defined and instance[' pushgateway' ] is not none and instance[' pushgateway' ][' enabled' ] % }
507+ {%- if instance[' pushgateway' ] is defined and instance[' pushgateway' ] is not none and instance[' pushgateway' ][' enabled' ] % }
503508 < a href= " {{ instance['name'] }} /pushgateway/" > {{ instance[' name' ] }}/ pushgateway< / a>< br>
504509 {%- endif % }
505- {% if instance[' statsd-exporter' ] is defined and instance[' statsd-exporter' ] is not none and instance[' statsd-exporter' ][' enabled' ] % }
510+ {%- if instance[' statsd-exporter' ] is defined and instance[' statsd-exporter' ] is not none and instance[' statsd-exporter' ][' enabled' ] % }
506511 < a href= " {{ instance['name'] }} /statsd-exporter/" > {{ instance[' name' ] }}/ statsd- exporter< / a>< br>
507512 {%- endif % }
508- {% if instance[' blackbox-exporter' ] is defined and instance[' blackbox-exporter' ] is not none and instance[' blackbox-exporter' ][' enabled' ] % }
513+ {%- if instance[' blackbox-exporter' ] is defined and instance[' blackbox-exporter' ] is not none and instance[' blackbox-exporter' ][' enabled' ] % }
509514 < a href= " {{ instance['name'] }} /blackbox-exporter/" > {{ instance[' name' ] }}/ blackbox- exporter< / a>< br>
510515 {%- endif % }
511- {% if instance[' pagespeed-exporter' ] is defined and instance[' pagespeed-exporter' ] is not none and instance[' pagespeed-exporter' ][' enabled' ] % }
516+ {%- if instance[' pagespeed-exporter' ] is defined and instance[' pagespeed-exporter' ] is not none and instance[' pagespeed-exporter' ][' enabled' ] % }
512517 < a href= " {{ instance['name'] }} /pagespeed-exporter/" > {{ instance[' name' ] }}/ pagespeed- exporter< / a>< br>
513518 {%- endif % }
514- {% if instance[' redis-exporter' ] is defined and instance[' redis-exporter' ] is not none and instance[' redis-exporter' ][' enabled' ] % }
519+ {%- if instance[' redis-exporter' ] is defined and instance[' redis-exporter' ] is not none and instance[' redis-exporter' ][' enabled' ] % }
515520 < a href= " {{ instance['name'] }} /redis-exporter/" > {{ instance[' name' ] }}/ redis- exporter< / a>< br>
516521 {%- endif % }
517- {% if instance[' mailcow-exporters' ] is defined and instance[' mailcow-exporters' ] is not none % }
522+ {%- if instance[' mailcow-exporters' ] is defined and instance[' mailcow-exporters' ] is not none % }
518523 {%- set x_loop = loop % }
519524 {%- for mailcow_exporter_name, mailcow_exporter_params in instance[' mailcow-exporters' ].items() % }
520- {% if mailcow_exporter_params[' enabled' ] % }
525+ {%- if mailcow_exporter_params[' enabled' ] % }
521526 < a href= " {{ instance['name'] }} /mailcow-exporter/" > {{ instance[' name' ] }}/ mailcow- exporter/ {{ mailcow_exporter_name }}< / a>< br>
522527 {%- endif % }
523528 {%- endfor % }
@@ -538,5 +543,4 @@ nginx_reload_cron:
538543 - minute: 15
539544 - hour: 6
540545
541- {% endif % }
542-
546+ {%- endif % }
0 commit comments