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

Use --scrape_uri instead of -scrape_uri for apache_exporter versions 0.8.0 and greater #444

Merged
Merged
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
6 changes: 5 additions & 1 deletion manifests/apache_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@
default => undef,
}

$options = "-scrape_uri \"${scrape_uri}\" ${extra_options}"
if versioncmp($version, '0.8.0') < 0 {
$options = "-scrape_uri \"${scrape_uri}\" ${extra_options}"
} else {
$options = "--scrape_uri \"${scrape_uri}\" ${extra_options}"
}

prometheus::daemon { $service_name:
install_method => $install_method,
Expand Down
18 changes: 18 additions & 0 deletions spec/classes/apache_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,24 @@
it { is_expected.to contain_file('/usr/local/bin/apache_exporter').with('target' => '/opt/apache_exporter-0.4.0.linux-amd64/apache_exporter') }
end
end

context 'with version 0.8.0+' do
let(:params) do
{
scrape_uri: 'http://127.0.0.1/server-status?auto',
extra_options: '--test',
version: '0.8.0',
arch: 'amd64',
os: 'linux',
bin_dir: '/usr/local/bin',
install_method: 'url'
}
end

describe 'uses argument prefix correctly' do
it { is_expected.to contain_prometheus__daemon('apache_exporter').with('options' => '--scrape_uri "http://127.0.0.1/server-status?auto" --test') }
end
end
end
end
end