Skip to content

Commit a927d01

Browse files
committed
prometheus: add extra_args support for custom prometheus command-line flags
1 parent c1774b2 commit a927d01

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

prometheus/pillar.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ prometheus:
1616
- name: prod
1717
port: 9090 # docker published port, nginx will forward /prod to it
1818
image: prom/prometheus
19-
#retention_time: 30d # optional
19+
extra_args: '--web.enable-remote-write-receiver' # optional, extra command-line flags appended to prometheus container command
20+
retention_time: 30d # optional
2021
auth:
2122
- developer1: password1
2223
- developer2: password2

prometheus/prometheus.sls

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,12 @@ prometheus_container_{{ loop.index }}_{{ i_loop.index }}:
297297
{% else %}
298298
{% set retention_time_arg = '' %}
299299
{% 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
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
302307
prometheus_container_restart_{{ loop.index }}_{{ i_loop.index }}:
303308
cmd.run:
@@ -539,4 +544,3 @@ nginx_reload_cron:
539544
- hour: 6
540545
541546
{% endif %}
542-

0 commit comments

Comments
 (0)