From b2ae79e61f4d9a979c5c6763c62b5cc1bdb4f0c4 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 11 Jan 2018 18:45:09 +0100 Subject: [PATCH] prometheus: add a new variable to add arbitrary options to the command line. --- prometheus/defaults/main.yml | 1 + prometheus/files/prometheus.upstart | 3 ++- prometheus/templates/prometheus.default.j2 | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/prometheus/defaults/main.yml b/prometheus/defaults/main.yml index f0bd08d7..0d833c86 100644 --- a/prometheus/defaults/main.yml +++ b/prometheus/defaults/main.yml @@ -11,3 +11,4 @@ prometheus_confdir: '/opt/prometheus/conf' prometheus_cmd: '{{ prometheus_dist_dir }}/{{ prometheus_dir }}/prometheus' prometheus_loglevel: info prometheus_http_port: 9090 +prometheus_opts: '--storage.tsdb.retention=120d' diff --git a/prometheus/files/prometheus.upstart b/prometheus/files/prometheus.upstart index 6f74610b..3c75a2c8 100644 --- a/prometheus/files/prometheus.upstart +++ b/prometheus/files/prometheus.upstart @@ -15,6 +15,7 @@ script export PROMETHEUS_DATADIR export PROMETHEUS_LOGLEVEL export PROMETHEUS_CONF - exec $PROMETHEUS_CMD --config.file=$PROMETHEUS_CONF --storage.tsdb.path="$PROMETHEUS_DATADIR" --log.level=$PROMETHEUS_LOGLEVEL > $PROMETHEUS_LOGDIR/prometheus.log 2>&1 + export PROMETHEUS_OPTS + exec $PROMETHEUS_CMD --config.file=$PROMETHEUS_CONF --storage.tsdb.path="$PROMETHEUS_DATADIR" --log.level=$PROMETHEUS_LOGLEVEL $PROMETHEUS_OPTS > $PROMETHEUS_LOGDIR/prometheus.log 2>&1 end script \ No newline at end of file diff --git a/prometheus/templates/prometheus.default.j2 b/prometheus/templates/prometheus.default.j2 index bef6b306..23fe2660 100644 --- a/prometheus/templates/prometheus.default.j2 +++ b/prometheus/templates/prometheus.default.j2 @@ -4,5 +4,6 @@ PROMETHEUS_LOGDIR={{ prometheus_home }}/logs PROMETHEUS_DATADIR={{ prometheus_home }}/data PROMETHEUS_LOGLEVEL={{ prometheus_loglevel }} PROMETHEUS_CONF={{ prometheus_confdir }}/prometheus.yml +PROMETHEUS_OPTS="{{ prometheus_opts }}"