Skip to content

Commit

Permalink
Merge pull request #428 from unki/add-service-name-parameter-to-hapro…
Browse files Browse the repository at this point in the history
…xy-exporter

add service_name parameter to haproxy-exporter
  • Loading branch information
bastelfreak authored Feb 18, 2020
2 parents 2c022fd + f67d0ab commit bb377e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions data/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ prometheus::haproxy_exporter::extra_groups: []
prometheus::haproxy_exporter::group: 'haproxy-exporter'
prometheus::haproxy_exporter::package_ensure: 'latest'
prometheus::haproxy_exporter::package_name: 'haproxy_exporter'
prometheus::haproxy_exporter::service_name: 'haproxy_exporter'
prometheus::haproxy_exporter::user: 'haproxy-user'
prometheus::haproxy_exporter::version: '0.10.0'
prometheus::nginx_vts_exporter::nginx_scrape_uri: 'http://localhost/status/format/json'
Expand Down
9 changes: 6 additions & 3 deletions manifests/haproxy_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,20 @@
# Whether to enable the service from puppet (default true)
# @param service_ensure
# State ensured for the service (default 'running')
# @param service_name
# Name of the haproxy exporter service (default 'haproxy_exporter')
# @param user
# User which runs the service
# @param version
# The binary release version
class prometheus::haproxy_exporter(
class prometheus::haproxy_exporter (
Variant[Stdlib::HTTPUrl, Pattern[/unix:(?:\/.+)+/]] $cnf_scrape_uri,
String $download_extension,
Array $extra_groups,
String $group,
String $package_ensure,
String $package_name,
String[1] $service_name,
String $user,
String $version,
Prometheus::Uri $download_url_base,
Expand All @@ -77,13 +80,13 @@

$real_download_url = pick($download_url,"${download_url_base}/download/v${version}/${package_name}-${version}.${os}-${arch}.${download_extension}")
$notify_service = $restart_on_change ? {
true => Service['haproxy_exporter'],
true => Service[$service_name],
default => undef,
}

$options = "--haproxy.scrape-uri=\"${cnf_scrape_uri}\" ${extra_options}"

prometheus::daemon { 'haproxy_exporter':
prometheus::daemon { $service_name:
install_method => $install_method,
version => $version,
download_extension => $download_extension,
Expand Down

0 comments on commit bb377e2

Please sign in to comment.