Skip to content

Commit

Permalink
Make it possible for mongodb exporter to be used even with version fr…
Browse files Browse the repository at this point in the history
…om 0.7.0 where breaking changes appear (voxpupuli#331)
  • Loading branch information
zonArt authored and bastelfreak committed Jul 11, 2019
1 parent 29594e6 commit 7ec4181
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions data/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ prometheus::mongodb_exporter::package_ensure: 'latest'
prometheus::mongodb_exporter::package_name: 'mongodb_exporter'
prometheus::mongodb_exporter::user: 'mongodb-exporter'
prometheus::mongodb_exporter::version: '0.3.1'
prometheus::mongodb_exporter::use_kingpin: false
prometheus::node_exporter::download_extension: 'tar.gz'
prometheus::node_exporter::download_url_base: 'https://github.com/prometheus/node_exporter/releases'
prometheus::node_exporter::extra_groups: []
Expand Down
13 changes: 12 additions & 1 deletion manifests/mongodb_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@
#
# [*version*]
# The binary release version
#
# [*use_kingpin*]
# Since version 0.7.0, the mongodb exporter uses kingpin, thus
# this param to define how we call the mongodb.uri in the $options
# https://github.com/percona/mongodb_exporter/blob/v0.7.0/CHANGELOG.md

class prometheus::mongodb_exporter (
String $cnf_uri,
Expand All @@ -82,6 +87,7 @@
String $package_name,
String $user,
String $version,
Boolean $use_kingpin,
Boolean $purge_config_dir = true,
Boolean $restart_on_change = true,
Boolean $service_enable = true,
Expand Down Expand Up @@ -109,7 +115,12 @@
default => undef,
}

$options = "-mongodb.uri=${cnf_uri} ${extra_options}"
$flag_prefix = $use_kingpin ? {
true => '--',
false => '-',
}

$options = "${flag_prefix}mongodb.uri=${cnf_uri} ${extra_options}"

prometheus::daemon { 'mongodb_exporter':
install_method => $install_method,
Expand Down

0 comments on commit 7ec4181

Please sign in to comment.