Skip to content

Commit

Permalink
Merge pull request #836 from voxpupuli/deprecate_rabbitmq_exporter
Browse files Browse the repository at this point in the history
Deprecate rabbitmq exporter
  • Loading branch information
bastelfreak authored Jan 4, 2025
2 parents b148666 + 3fa6cfc commit 01d6556
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
2 changes: 1 addition & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11125,7 +11125,7 @@ Default value: `undef`

### <a name="prometheus--rabbitmq_exporter"></a>`prometheus::rabbitmq_exporter`

This module manages prometheus rabbitmq_exporter
This class is deprecated and will be removed in a future release.

#### Parameters

Expand Down
25 changes: 24 additions & 1 deletion manifests/rabbitmq_exporter.pp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
# Optional proxy server, with port number if needed. ie: https://example.com:8080
# @param proxy_type
# Optional proxy server type (none|http|https|ftp)
# @note
# This class is deprecated and will be removed in a future release.
class prometheus::rabbitmq_exporter (
Prometheus::Uri $download_url_base,
Array[String] $extra_groups,
Expand Down Expand Up @@ -109,7 +111,27 @@
Optional[String[1]] $proxy_server = undef,
Optional[Enum['none', 'http', 'https', 'ftp']] $proxy_type = undef,
) inherits prometheus {
$real_download_url = pick($download_url, "${download_url_base}/download/v${version}/${package_name}-${version}.${os}-${arch}.${download_extension}")
deprecation(
'promtheus::rabbitmq_exporter',
'This class is deprecated and will be removed in a future release. See https://github.com/kbudde/rabbitmq_exporter/issues/383 for details',
false
)

if versioncmp($version, '1.0.0') >= 0 {
$extract_path = "/opt/${package_name}-${version}.${os}-${arch}"
$real_download_url = pick($download_url, "${download_url_base}/download/v${version}/${package_name}_${version}_${os}_${arch}.${download_extension}")
file { $extract_path:
ensure => 'directory',
owner => 'root',
group => 0, # 0 instead of root because OS X uses "wheel".
mode => '0555',
before => Prometheus::Daemon[$service_name],
}
} else {
$extract_path = '/opt'
$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[$service_name],
default => undef,
Expand Down Expand Up @@ -158,5 +180,6 @@
scrape_job_labels => $scrape_job_labels,
proxy_server => $proxy_server,
proxy_type => $proxy_type,
extract_path => $extract_path,
}
}
27 changes: 26 additions & 1 deletion spec/acceptance/rabbitmq_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,32 @@ class { 'prometheus::rabbitmq_exporter':
it { is_expected.to be_enabled }
end

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

describe 'prometheus rabbitmq_exporter version 1.0.0' do
it 'rabbitmq_exporter installs with version 1.0.0' do
pp = <<-EOS
class { 'prometheus::rabbitmq_exporter':
version => '1.0.0',
extra_env_vars => {
'PUBLISH_PORT' => '9419',
},
scrape_port => 9419,
}
EOS
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end

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

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

0 comments on commit 01d6556

Please sign in to comment.