Skip to content

Commit

Permalink
Merge pull request voxpupuli#364 from kudelskisecurity/update_elastic…
Browse files Browse the repository at this point in the history
…search_exporter

Make elasticsearch usable with older version
  • Loading branch information
bastelfreak authored Aug 27, 2019
2 parents 097a620 + f659676 commit fd35e55
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 @@ -101,6 +101,7 @@ prometheus::elasticsearch_exporter::package_ensure: 'latest'
prometheus::elasticsearch_exporter::package_name: 'elasticsearch_exporter'
prometheus::elasticsearch_exporter::user: 'elasticsearch-exporter'
prometheus::elasticsearch_exporter::version: '1.1.0rc1'
prometheus::elasticsearch_exporter::use_kingpin: true
prometheus::extra_groups: []
prometheus::global_config:
'scrape_interval': '15s'
Expand Down
13 changes: 12 additions & 1 deletion manifests/elasticsearch_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@
#
# [*version*]
# The binary release version
#
# [*use_kingpin*]
# Since version 1.1.0, the elasticsearch exporter uses kingpin, thus
# this param to define how we call the es.uri and es.timeout in the $options
# https://github.com/justwatchcom/elasticsearch_exporter/blob/v1.1.0/CHANGELOG.md

class prometheus::elasticsearch_exporter (
String $cnf_uri,
Expand All @@ -89,6 +94,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 @@ -116,7 +122,12 @@
default => undef,
}

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

$options = "${flag_prefix}es.uri=${cnf_uri} ${flag_prefix}es.timeout=${cnf_timeout} ${extra_options}"

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

0 comments on commit fd35e55

Please sign in to comment.