Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow to set prometheus server config filename #200

Merged
merged 1 commit into from
May 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/defaults.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
prometheus::configname: 'prometheus.yaml'
prometheus::bin_dir: '/usr/local/bin'
prometheus::version: '1.5.2'
prometheus::install_method: 'url'
Expand Down
6 changes: 3 additions & 3 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
fail('remote_write_configs requires prometheus 2.X')
}
$daemon_flags = [
"-config.file=${prometheus::server::config_dir}/prometheus.yaml",
"-config.file=${prometheus::server::config_dir}/${prometheus::server::configname}",
"-storage.local.path=${prometheus::server::localstorage}",
"-storage.local.retention=${prometheus::server::storage_retention}",
"-web.console.templates=${prometheus::shared_dir}/consoles",
Expand All @@ -25,7 +25,7 @@
# helper variable indicating prometheus version, so we can use on this information in the template
$prometheus_v2 = true
$daemon_flags = [
"--config.file=${prometheus::server::config_dir}/prometheus.yaml",
"--config.file=${prometheus::server::config_dir}/${prometheus::server::configname}",
"--storage.tsdb.path=${prometheus::server::localstorage}",
"--storage.tsdb.retention=${prometheus::server::storage_retention}",
"--web.console.templates=${prometheus::server::shared_dir}/consoles",
Expand Down Expand Up @@ -112,7 +112,7 @@

file { 'prometheus.yaml':
ensure => present,
path => "${prometheus::server::config_dir}/prometheus.yaml",
path => "${prometheus::server::config_dir}/${prometheus::server::configname}",
owner => $prometheus::server::user,
group => $prometheus::server::group,
mode => $prometheus::server::config_mode,
Expand Down
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#
# Parameters:
#
# [*configname*]
# the name of the configfile, defaults to prometheus.yaml or prometheus.yml on most operating systems
#
# [*manage_user*]
# Whether to create user for prometheus or rely on external code for that
#
Expand Down Expand Up @@ -129,6 +132,7 @@
# Sample Usage:
#
class prometheus (
String $configname,
String $user,
String $group,
Array $extra_groups,
Expand Down
1 change: 1 addition & 0 deletions manifests/server.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# class to manage the actual prometheus server
# this is a private class that gets called from the init.pp
class prometheus::server (
String $configname = $prometheus::configname,
String $user = $prometheus::user,
String $group = $prometheus::group,
Array $extra_groups = $prometheus::extra_groups,
Expand Down
2 changes: 1 addition & 1 deletion templates/prometheus.sles.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
rc_reset

PROMETHEUS_BIN=<%= scope.lookupvar('prometheus::bin_dir') %>/prometheus
CONFIG_FILE=<%= scope.lookupvar('prometheus::config_dir') %>/prometheus.yaml
CONFIG_FILE=<%= scope.lookupvar('prometheus::config_dir') %>/<%= scope.lookupvar('prometheus::server::configname') %>
LOG_FILE=/var/log/prometheus


Expand Down