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

add env vars and env file path #616

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions manifests/bind_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@
# Optional proxy server, with port number if needed. ie: https://example.com:8080
# @param proxy_type
# Optional proxy server type (none|http|https|ftp)
# @param env_vars_sensitive
# Do not show diff in case environment variables are sensitive
# @param env_vars
# Hash with custom environment variables that's passed to the exporter via init script / unit file
# @param env_file_path
# The path to the file with the environment variable that is read from the init script/systemd unit
class prometheus::bind_exporter (
Optional[Stdlib::HTTPSUrl] $download_url = undef,
Array[String[1]] $extra_groups = [],
Expand All @@ -114,7 +120,9 @@
Boolean $manage_user = true,
String[1] $os = $prometheus::os,
Optional[String[1]] $extra_options = undef,
Boolean $env_vars_sensitive = false,
Hash[String, Scalar] $env_vars = {},
Stdlib::Absolutepath $env_file_path = $prometheus::env_file_path,
String $download_extension = 'tar.gz',
Stdlib::HTTPSUrl $download_url_base = 'https://github.com/prometheus-community/bind_exporter/releases',
String[1] $config_mode = $prometheus::config_mode,
Expand Down Expand Up @@ -152,7 +160,9 @@
manage_group => $manage_group,
purge => $purge_config_dir,
options => $extra_options,
env_vars_sensitive => $env_vars_sensitive,
env_vars => $env_vars,
env_file_path => $env_file_path,
init_style => $init_style,
service_ensure => $service_ensure,
service_enable => $service_enable,
Expand Down
8 changes: 6 additions & 2 deletions manifests/bird_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@
# User which runs the service
# @param version
# The binary release version
# @param env_vars_sensitive
# Do not show diff in case environment variables are sensitive
# @param env_vars
# hash with custom environment variables thats passed to the exporter via init script / unit file
# Hash with custom environment variables that's passed to the exporter via init script / unit file
# @param env_file_path
# The path to the file with the environmetn variable that is read from the init script/systemd unit
# The path to the file with the environment variable that is read from the init script/systemd unit
# @param proxy_server
# Optional proxy server, with port number if needed. ie: https://example.com:8080
# @param proxy_type
Expand Down Expand Up @@ -96,6 +98,7 @@
String[1] $scrape_job_name = 'bird',
Optional[Hash] $scrape_job_labels = undef,
Optional[String[1]] $bin_name = undef,
Boolean $env_vars_sensitive = false,
Hash[String[1], Scalar] $env_vars = {},
Stdlib::Absolutepath $env_file_path = $prometheus::env_file_path,
Optional[String[1]] $proxy_server = undef,
Expand Down Expand Up @@ -136,6 +139,7 @@
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
bin_name => $bin_name,
env_vars_sensitive => $env_vars_sensitive,
env_vars => $env_vars,
env_file_path => $env_file_path,
proxy_server => $proxy_server,
Expand Down
18 changes: 13 additions & 5 deletions manifests/daemon.pp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
# Optional proxy server, with port number if needed. ie: https://example.com:8080
# @param proxy_type
# Optional proxy server type (none|http|https|ftp)
# @param env_vars_sensitive
# Do not show diff in case environment variables are sensitive
# @param env_vars
# Hash with custom environment variables that's passed to the exporter via init script / unit file
# @param env_file_path
# The path to the file with the environment variable that is read from the init script/systemd unit
define prometheus::daemon (
String[1] $version,
Prometheus::Uri $real_download_url,
Expand All @@ -72,6 +78,7 @@
Stdlib::Ensure::Service $service_ensure = 'running',
Boolean $service_enable = true,
Boolean $manage_service = true,
Boolean $env_vars_sensitive = false,
duonghoangle marked this conversation as resolved.
Show resolved Hide resolved
Hash[String[1], Scalar] $env_vars = {},
Stdlib::Absolutepath $env_file_path = $prometheus::env_file_path,
Optional[String[1]] $extract_command = $prometheus::extract_command,
Expand Down Expand Up @@ -248,16 +255,17 @@
# those files to be present, even if empty, so it's critical that
# the file not get removed
file { "${env_file_path}/${name}":
mode => '0644',
owner => 'root',
group => '0', # Darwin uses wheel
content => epp(
mode => '0644',
owner => 'root',
group => '0', # Darwin uses wheel
content => epp(
'prometheus/daemon.env.epp',
{
'env_vars' => $env_vars_merged,
}
),
notify => $notify_service,
notify => $notify_service,
show_diff => !$env_vars_sensitive,
}
}

Expand Down
12 changes: 12 additions & 0 deletions manifests/elasticsearch_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
# Optional proxy server, with port number if needed. ie: https://example.com:8080
# @param proxy_type
# Optional proxy server type (none|http|https|ftp)
# @param env_vars_sensitive
# Do not show diff in case environment variables are sensitive
# @param env_vars
# Hash with custom environment variables that's passed to the exporter via init script / unit file
# @param env_file_path
# The path to the file with the environment variable that is read from the init script/systemd unit
class prometheus::elasticsearch_exporter (
String[1] $cnf_uri,
String[1] $cnf_timeout,
Expand Down Expand Up @@ -89,6 +95,9 @@
Optional[Hash] $scrape_job_labels = undef,
Optional[String[1]] $proxy_server = undef,
Optional[Enum['none', 'http', 'https', 'ftp']] $proxy_type = undef,
Boolean $env_vars_sensitive = false,
duonghoangle marked this conversation as resolved.
Show resolved Hide resolved
Hash[String[1], Scalar] $env_vars = {},
Stdlib::Absolutepath $env_file_path = $prometheus::env_file_path,
) inherits prometheus {
#Please provide the download_url for versions < 0.9.0
$real_download_url = pick($download_url,"${download_url_base}/download/v${version}/${package_name}-${version}.${os}-${arch}.${download_extension}")
Expand Down Expand Up @@ -134,5 +143,8 @@
scrape_job_labels => $scrape_job_labels,
proxy_server => $proxy_server,
proxy_type => $proxy_type,
env_vars_sensitive => $env_vars_sensitive,
env_vars => $env_vars,
env_file_path => $env_file_path,
}
}
8 changes: 8 additions & 0 deletions manifests/nginx_prometheus_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
# Optional proxy server, with port number if needed. ie: https://example.com:8080
# @param proxy_type
# Optional proxy server type (none|http|https|ftp)
# @param env_vars_sensitive
# Do not show diff in case environment variables are sensitive
# @param env_vars
# Hash with custom environment variables that's passed to the exporter via init script / unit file
# @param env_file_path
# The path to the file with the environment variable that is read from the init script/systemd unit
class prometheus::nginx_prometheus_exporter (
String[1] $scrape_uri = 'http://localhost:8080/stub_status',
String $download_extension = 'tar.gz',
Expand Down Expand Up @@ -85,6 +91,7 @@
String[1] $scrape_job_name = 'nginx',
Optional[Hash] $scrape_job_labels = undef,
String[1] $bin_name = 'nginx-prometheus-exporter',
Boolean $env_vars_sensitive = false,
Hash[String[1], Scalar] $env_vars = {},
Stdlib::Absolutepath $env_file_path = $prometheus::env_file_path,
Optional[String[1]] $proxy_server = undef,
Expand Down Expand Up @@ -158,6 +165,7 @@
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
bin_name => $bin_name,
env_vars_sensitive => $env_vars_sensitive,
env_vars => $env_vars,
env_file_path => $env_file_path,
proxy_server => $proxy_server,
Expand Down
8 changes: 6 additions & 2 deletions manifests/node_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@
# User which runs the service
# @param version
# The binary release version
# @param env_vars_sensitive
# Do not show diff in case environment variables are sensitive
# @param env_vars
# hash with custom environment variables thats passed to the exporter via init script / unit file
# Hash with custom environment variables that's passed to the exporter via init script / unit file
# @param env_file_path
# The path to the file with the environmetn variable that is read from the init script/systemd unit
# The path to the file with the environment variable that is read from the init script/systemd unit
# @param proxy_server
# Optional proxy server, with port number if needed. ie: https://example.com:8080
# @param proxy_type
Expand Down Expand Up @@ -95,6 +97,7 @@
String[1] $scrape_job_name = 'node',
Optional[Hash] $scrape_job_labels = undef,
Optional[String[1]] $bin_name = undef,
Boolean $env_vars_sensitive = false,
Hash[String[1], Scalar] $env_vars = {},
Stdlib::Absolutepath $env_file_path = $prometheus::env_file_path,
Optional[String[1]] $proxy_server = undef,
Expand Down Expand Up @@ -157,6 +160,7 @@
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
bin_name => $bin_name,
env_vars_sensitive => $env_vars_sensitive,
env_vars => $env_vars,
env_file_path => $env_file_path,
proxy_server => $proxy_server,
Expand Down
8 changes: 8 additions & 0 deletions manifests/openldap_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
# Optional proxy server, with port number if needed. ie: https://example.com:8080
# @param proxy_type
# Optional proxy server type (none|http|https|ftp)
# @param env_vars_sensitive
# Do not show diff in case environment variables are sensitive
# @param env_file_path
# The path to the file with the environment variable that is read from the init script/systemd unit
class prometheus::openldap_exporter (
String $download_extension = '',
Array[String] $extra_groups = [],
Expand Down Expand Up @@ -81,6 +85,8 @@
Optional[String[1]] $ldap_password = undef,
Optional[String[1]] $proxy_server = undef,
Optional[Enum['none', 'http', 'https', 'ftp']] $proxy_type = undef,
Boolean $env_vars_sensitive = false,
Stdlib::Absolutepath $env_file_path = $prometheus::env_file_path,
) inherits prometheus {
$release = "v${version}"
$real_download_url = pick($download_url,"${download_url_base}/download/${release}/${package_name}-${os}")
Expand Down Expand Up @@ -117,7 +123,9 @@
service_ensure => $service_ensure,
service_enable => $service_enable,
manage_service => $manage_service,
env_vars_sensitive => $env_vars_sensitive,
env_vars => $env_vars,
env_file_path => $env_file_path,
export_scrape_job => $export_scrape_job,
scrape_host => $scrape_host,
scrape_port => $scrape_port,
Expand Down
8 changes: 8 additions & 0 deletions manifests/php_fpm_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
# Optional proxy server, with port number if needed. ie: https://example.com:8080
# @param proxy_type
# Optional proxy server type (none|http|https|ftp)
# @param env_vars_sensitive
# Do not show diff in case environment variables are sensitive
# @param env_vars
# Hash with custom environment variables that's passed to the exporter via init script / unit file
# @param env_file_path
# The path to the file with the environment variable that is read from the init script/systemd unit
class prometheus::php_fpm_exporter (
String[1] $scrape_uri = 'tcp://127.0.0.1:9000/status',
String $download_extension = 'tar.gz',
Expand Down Expand Up @@ -85,6 +91,7 @@
String[1] $scrape_job_name = 'php-fpm',
Optional[Hash] $scrape_job_labels = undef,
String[1] $bin_name = 'php-fpm_exporter',
Boolean $env_vars_sensitive = false,
Hash[String[1], Scalar] $env_vars = {},
Stdlib::Absolutepath $env_file_path = $prometheus::env_file_path,
Optional[String[1]] $proxy_server = undef,
Expand Down Expand Up @@ -159,6 +166,7 @@
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
bin_name => $bin_name,
env_vars_sensitive => $env_vars_sensitive,
env_vars => $env_vars,
env_file_path => $env_file_path,
proxy_server => $proxy_server,
Expand Down
8 changes: 8 additions & 0 deletions manifests/postgres_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
# Optional proxy server, with port number if needed. ie: https://example.com:8080
# @param proxy_type
# Optional proxy server type (none|http|https|ftp)
# @param env_vars_sensitive
# Do not show diff in case environment variables are sensitive
# @param env_file_path
# The path to the file with the environment variable that is read from the init script/systemd unit
class prometheus::postgres_exporter (
String $download_extension,
Prometheus::Uri $download_url_base,
Expand Down Expand Up @@ -95,6 +99,8 @@
Optional[Hash] $scrape_job_labels = undef,
Optional[String[1]] $proxy_server = undef,
Optional[Enum['none', 'http', 'https', 'ftp']] $proxy_type = undef,
Boolean $env_vars_sensitive = false,
Stdlib::Absolutepath $env_file_path = $prometheus::env_file_path,
) inherits prometheus {
$release = "v${version}"

Expand Down Expand Up @@ -169,7 +175,9 @@
install_method => $exporter_install_method,
version => $version,
download_extension => $download_extension,
env_vars_sensitive => $env_vars_sensitive,
env_vars => $env_vars,
env_file_path => $env_file_path,
os => $os,
arch => $arch,
bin_dir => $bin_dir,
Expand Down
10 changes: 9 additions & 1 deletion manifests/pushprox_client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,12 @@
# User which runs the service
# @param version
# The binary release version
# @param env_vars_sensitive
# Do not show diff in case environment variables are sensitive
# @param env_vars
# The environment variable to pass to the daemon
# Hash with custom environment variables that's passed to the exporter via init script / unit file
# @param env_file_path
# The path to the file with the environment variable that is read from the init script/systemd unit
# @param proxy_server
# Optional proxy server, with port number if needed. ie: https://example.com:8080
# @param proxy_type
Expand Down Expand Up @@ -79,7 +83,9 @@
String[1] $config_mode = $prometheus::config_mode,
String[1] $arch = $prometheus::real_arch,
Stdlib::Absolutepath $bin_dir = $prometheus::bin_dir,
Boolean $env_vars_sensitive = false,
Hash[String, Scalar] $env_vars = {},
Stdlib::Absolutepath $env_file_path = $prometheus::env_file_path,
Optional[String[1]] $proxy_server = undef,
Optional[Enum['none', 'http', 'https', 'ftp']] $proxy_type = undef,
) inherits prometheus {
Expand Down Expand Up @@ -115,7 +121,9 @@
service_ensure => $service_ensure,
service_enable => $service_enable,
manage_service => $manage_service,
env_vars_sensitive => $env_vars_sensitive,
env_vars => $env_vars,
env_file_path => $env_file_path,
proxy_server => $proxy_server,
proxy_type => $proxy_type,
}
Expand Down
8 changes: 8 additions & 0 deletions manifests/rabbitmq_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,13 @@
# @param rabbit_exporters
# Which exporter modules should be loaded by default
# (default 'exchange,node,overview,queue')
# @param env_vars_sensitive
# Do not show diff in case environment variables are sensitive
# @param extra_env_vars
# Additional environment variables that should be supplied to the exporter, as a hash of key:value
# (default {})
# @param env_file_path
# The path to the file with the environment variable that is read from the init script/systemd unit
# @param proxy_server
# Optional proxy server, with port number if needed. ie: https://example.com:8080
# @param proxy_type
Expand Down Expand Up @@ -99,7 +103,9 @@
Boolean $restart_on_change = true,
Boolean $service_enable = true,
Stdlib::Ensure::Service $service_ensure = 'running',
Boolean $env_vars_sensitive = false,
Hash[String,String] $extra_env_vars = {},
Stdlib::Absolutepath $env_file_path = $prometheus::env_file_path,
Boolean $export_scrape_job = false,
Optional[Stdlib::Host] $scrape_host = undef,
Stdlib::Port $scrape_port = 9090,
Expand Down Expand Up @@ -148,7 +154,9 @@
service_ensure => $service_ensure,
service_enable => $service_enable,
manage_service => $manage_service,
env_vars_sensitive => $env_vars_sensitive,
env_vars => $real_env_vars,
env_file_path => $env_file_path,
export_scrape_job => $export_scrape_job,
scrape_host => $scrape_host,
scrape_port => $scrape_port,
Expand Down
10 changes: 10 additions & 0 deletions manifests/unbound_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
# Optional proxy server, with port number if needed. ie: https://example.com:8080
# @param proxy_type
# Optional proxy server type (none|http|https|ftp)
# @param env_vars_sensitive
# Do not show diff in case environment variables are sensitive
# @param env_vars
# Hash with custom environment variables that's passed to the exporter via init script / unit file
# @param env_file_path
# The path to the file with the environment variable that is read from the init script/systemd unit
#
# @see https://github.com/kumina/unbound_exporter
#
Expand Down Expand Up @@ -85,7 +91,9 @@
String[1] $scrape_job_name = 'unbound',
Optional[Hash] $scrape_job_labels = undef,
Optional[String[1]] $bin_name = undef,
Boolean $env_vars_sensitive = false,
Hash $env_vars = { 'GODEBUG' => 'x509ignoreCN=0' },
Stdlib::Absolutepath $env_file_path = $prometheus::env_file_path,
Optional[String[1]] $proxy_server = undef,
Optional[Enum['none', 'http', 'https', 'ftp']] $proxy_type = undef,
) inherits prometheus {
Expand Down Expand Up @@ -123,7 +131,9 @@
scrape_job_name => $scrape_job_name,
scrape_job_labels => $scrape_job_labels,
bin_name => $bin_name,
env_vars_sensitive => $env_vars_sensitive,
env_vars => $env_vars,
env_file_path => $env_file_path,
proxy_server => $proxy_server,
proxy_type => $proxy_type,
}
Expand Down