Skip to content

Commit

Permalink
Merge pull request voxpupuli#280 from dynek/unix_socket_haproxy_exporter
Browse files Browse the repository at this point in the history
update haproxy exporter default to 0.9.0, fix options and allow unix …
  • Loading branch information
bastelfreak authored Jan 16, 2019
2 parents f85c334 + 14cd466 commit 5f42675
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 3 deletions.
2 changes: 1 addition & 1 deletion data/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ prometheus::haproxy_exporter::group: 'haproxy-exporter'
prometheus::haproxy_exporter::package_ensure: 'latest'
prometheus::haproxy_exporter::package_name: 'haproxy_exporter'
prometheus::haproxy_exporter::user: 'haproxy-user'
prometheus::haproxy_exporter::version: '0.7.1'
prometheus::haproxy_exporter::version: '0.9.0'
prometheus::nginx_vts_exporter::nginx_scrape_uri: 'http://localhost/status/format/json'
prometheus::nginx_vts_exporter::download_extension: 'tar.gz'
prometheus::nginx_vts_exporter::download_url_base: 'https://github.com/hnlq715/nginx-vts-exporter/releases'
Expand Down
4 changes: 2 additions & 2 deletions manifests/haproxy_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
String $package_name,
String $user,
String $version,
Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl] $download_url_base,
Stdlib::HTTPUrl $download_url_base,
Boolean $purge_config_dir = true,
Boolean $restart_on_change = true,
Boolean $service_enable = true,
Expand All @@ -104,7 +104,7 @@
default => undef,
}

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

prometheus::daemon { 'haproxy_exporter':
install_method => $install_method,
Expand Down
56 changes: 56 additions & 0 deletions spec/acceptance/haproxy_exporter_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
require 'spec_helper_acceptance'

describe 'prometheus haproxy_exporter' do
it 'haproxy_exporter works idempotently with no errors' do
if default[:platform] =~ %r{ubuntu-18.04-amd64}
pp = "package{'iproute2': ensure => present}"
apply_manifest(pp, catch_failures: true)
end
pp = 'include prometheus::haproxy_exporter'
# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end

describe service('haproxy_exporter') do
it { is_expected.to be_running }
it { is_expected.to be_enabled }
end

describe port(9101) do
it { is_expected.to be_listening.with('tcp6') }
end

describe 'haproxy_exporter update from 0.7.1 to 0.9.0' do
it 'is idempotent' do
pp = "class{'prometheus::haproxy_exporter': version => '0.7.1'}"
# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end

describe service('haproxy_exporter') do
it { is_expected.to be_running }
it { is_expected.to be_enabled }
end

describe port(9101) do
it { is_expected.to be_listening.with('tcp6') }
end
it 'is idempotent' do
pp = "class{'prometheus::haproxy_exporter': version => '0.9.0'}"
# Run it twice and test for idempotency
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end

describe service('haproxy_exporter') do
it { is_expected.to be_running }
it { is_expected.to be_enabled }
end

describe port(9101) do
it { is_expected.to be_listening.with('tcp6') }
end
end
end

0 comments on commit 5f42675

Please sign in to comment.