Skip to content

Commit

Permalink
Merge pull request voxpupuli#137 from RegioHelden/make_retention_conf…
Browse files Browse the repository at this point in the history
…igurable

add explicit parameter for retention
  • Loading branch information
bastelfreak committed Jan 4, 2018
2 parents 65e9a07 + ae5aa99 commit cd2baa8
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
$remote_read_configs,
$purge = true,
$config_template = $::prometheus::params::config_template,
$storage_retention = $::prometheus::params::storage_retention,
) {

if $prometheus::init_style {
Expand All @@ -19,6 +20,7 @@
$daemon_flags = [
"-config.file=${::prometheus::config_dir}/prometheus.yaml",
"-storage.local.path=${::prometheus::localstorage}",
"-storage.local.retention=${storage_retention}",
"-web.console.templates=${::prometheus::shared_dir}/consoles",
"-web.console.libraries=${::prometheus::shared_dir}/console_libraries",
]
Expand All @@ -28,6 +30,7 @@
$daemon_flags = [
"--config.file=${::prometheus::config_dir}/prometheus.yaml",
"--storage.tsdb.path=${::prometheus::localstorage}",
"--storage.tsdb.retention=${storage_retention}",
"--web.console.templates=${::prometheus::shared_dir}/consoles",
"--web.console.libraries=${::prometheus::shared_dir}/console_libraries",
]
Expand Down
7 changes: 7 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@
# [*alertmanagers_config*]
# Prometheus managers config under alerting
#
# [*storage_retention*]
# How long to keep timeseries data. This is given as a duration like "100h" or "14d". Until
# prometheus 1.8.*, only durations understood by golang's time.ParseDuration are supported. Starting
# with prometheus 2, durations can also be given in days, weeks and years.
#
# Actions:
#
# Requires: see Modulefile
Expand Down Expand Up @@ -151,6 +156,7 @@
$alerts = $::prometheus::params::alerts,
Array $alert_relabel_config = $::prometheus::params::alert_relabel_config,
Array $alertmanagers_config = $::prometheus::params::alertmanagers_config,
String $storage_retention = $::prometheus::params::storage_retention,
) inherits prometheus::params {

if( versioncmp($::prometheus::version, '1.0.0') == -1 ){
Expand All @@ -177,6 +183,7 @@
remote_read_configs => $remote_read_configs,
purge => $purge_config_dir,
config_template => $config_template,
storage_retention => $storage_retention,
}
-> class { '::prometheus::alerts':
location => $config_dir,
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
$statsd_exporter_package_name = 'statsd_exporter'
$statsd_exporter_user = 'statsd-exporter'
$statsd_exporter_version = '0.3.0'
$storage_retention = '360h' # 15d; "d" suffix is only supported with prom >= 2.*
$blackbox_exporter_user = 'blackbox-exporter'
$blackbox_exporter_group = 'blackbox-exporter'
$blackbox_exporter_download_extension = 'tar.gz'
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/files/prometheus1.debian
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ DAEMON=/usr/local/bin/$NAME
PIDFILE=/var/run/$NAME/$NAME.pid
DAEMON_ARGS="-config.file=/etc/prometheus/prometheus.yaml
-storage.local.path=/var/lib/prometheus
-storage.local.retention=360h
-web.console.templates=/usr/local/share/prometheus/consoles
-web.console.libraries=/usr/local/share/prometheus/console_libraries
"
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/files/prometheus1.systemd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Group=prometheus
ExecStart=/usr/local/bin/prometheus \
-config.file=/etc/prometheus/prometheus.yaml \
-storage.local.path=/var/lib/prometheus \
-storage.local.retention=360h \
-web.console.templates=/usr/local/share/prometheus/consoles \
-web.console.libraries=/usr/local/share/prometheus/console_libraries \

Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/files/prometheus1.sysv
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ start() {
--pidfile="$PID_FILE" \
"$DAEMON" -log.format logger:stdout -config.file=/etc/prometheus/prometheus.yaml \
-storage.local.path=/var/lib/prometheus \
-storage.local.retention=360h \
-web.console.templates=/usr/local/share/prometheus/consoles \
-web.console.libraries=/usr/local/share/prometheus/console_libraries \
>> "$LOG_FILE" &
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/files/prometheus1.upstart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ script
export GOMAXPROCS=${GOMAXPROCS:-2}
exec start-stop-daemon -c $USER -g $GROUP -p $PID_FILE -x $PROMETHEUS -S -- -config.file=/etc/prometheus/prometheus.yaml \
-storage.local.path=/var/lib/prometheus \
-storage.local.retention=360h \
-web.console.templates=/usr/local/share/prometheus/consoles \
-web.console.libraries=/usr/local/share/prometheus/console_libraries \

Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/files/prometheus2.debian
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ DAEMON=/usr/local/bin/$NAME
PIDFILE=/var/run/$NAME/$NAME.pid
DAEMON_ARGS="--config.file=/etc/prometheus/prometheus.yaml
--storage.tsdb.path=/var/lib/prometheus
--storage.tsdb.retention=360h
--web.console.templates=/usr/local/share/prometheus/consoles
--web.console.libraries=/usr/local/share/prometheus/console_libraries
"
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/files/prometheus2.systemd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Group=prometheus
ExecStart=/usr/local/bin/prometheus \
--config.file=/etc/prometheus/prometheus.yaml \
--storage.tsdb.path=/var/lib/prometheus \
--storage.tsdb.retention=360h \
--web.console.templates=/usr/local/share/prometheus/consoles \
--web.console.libraries=/usr/local/share/prometheus/console_libraries \

Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/files/prometheus2.sysv
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ start() {
--pidfile="$PID_FILE" \
"$DAEMON" -log.format logger:stdout --config.file=/etc/prometheus/prometheus.yaml \
--storage.tsdb.path=/var/lib/prometheus \
--storage.tsdb.retention=360h \
--web.console.templates=/usr/local/share/prometheus/consoles \
--web.console.libraries=/usr/local/share/prometheus/console_libraries \
>> "$LOG_FILE" &
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/files/prometheus2.upstart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ script
export GOMAXPROCS=${GOMAXPROCS:-2}
exec start-stop-daemon -c $USER -g $GROUP -p $PID_FILE -x $PROMETHEUS -S -- --config.file=/etc/prometheus/prometheus.yaml \
--storage.tsdb.path=/var/lib/prometheus \
--storage.tsdb.retention=360h \
--web.console.templates=/usr/local/share/prometheus/consoles \
--web.console.libraries=/usr/local/share/prometheus/console_libraries \

Expand Down

0 comments on commit cd2baa8

Please sign in to comment.