diff --git a/manifests/plugin/amqp1.pp b/manifests/plugin/amqp1.pp index 68afad45a..ac761443c 100644 --- a/manifests/plugin/amqp1.pp +++ b/manifests/plugin/amqp1.pp @@ -47,6 +47,10 @@ # before attempting to reconnect. # Defaults to 1 # +# [*send_queue_limit*] +# Limits the SentQueue to a defined value, helps to keep memory usage low +# when the write target does not respond. +# # [*interval*] # Interval setting for the plugin # Defaults to undef @@ -100,17 +104,18 @@ # preserved, i.e. passed through. # class collectd::plugin::amqp1 ( - Enum['present', 'absent'] $ensure = 'present', - Boolean $manage_package = $collectd::manage_package, - String $transport = 'metrics', - Stdlib::Host $host = 'localhost', - Stdlib::Port $port = 5672, - String $user = 'guest', - String $password = 'guest', - String $address = 'collectd', - Hash $instances = {}, - Optional[Integer] $retry_delay = undef, - Optional[Integer] $interval = undef, + Enum['present', 'absent'] $ensure = 'present', + Boolean $manage_package = $collectd::manage_package, + String $transport = 'metrics', + Stdlib::Host $host = 'localhost', + Stdlib::Port $port = 5672, + String $user = 'guest', + String $password = 'guest', + String $address = 'collectd', + Hash $instances = {}, + Optional[Integer] $retry_delay = undef, + Optional[Integer[0]] $send_queue_limit = undef, + Optional[Integer] $interval = undef, ) { include collectd diff --git a/spec/classes/collectd_plugin_amqp1_spec.rb b/spec/classes/collectd_plugin_amqp1_spec.rb index dd9d8e34d..ae68420ea 100644 --- a/spec/classes/collectd_plugin_amqp1_spec.rb +++ b/spec/classes/collectd_plugin_amqp1_spec.rb @@ -45,6 +45,7 @@ password: 'password', address: 'address', retry_delay: 30, + send_queue_limit: 40, instances: { instance: { format: 'JSON', @@ -68,6 +69,7 @@ it { is_expected.to contain_file('amqp1.load').with(content: %r{Password "password"}) } it { is_expected.to contain_file('amqp1.load').with(content: %r{Address "address"}) } it { is_expected.to contain_file('amqp1.load').with(content: %r{RetryDelay 30}) } + it { is_expected.to contain_file('amqp1.load').with(content: %r{SendQueueLimit 40}) } it { is_expected.to contain_file('amqp1.load').with(content: %r{}) } it { is_expected.to contain_file('amqp1.load').with(content: %r{Format "JSON"}) } it { is_expected.to contain_file('amqp1.load').with(content: %r{PreSettle true}) } diff --git a/templates/plugin/amqp1.conf.epp b/templates/plugin/amqp1.conf.epp index b7fac2d1c..fdf44989b 100644 --- a/templates/plugin/amqp1.conf.epp +++ b/templates/plugin/amqp1.conf.epp @@ -8,6 +8,9 @@ <% unless $::collectd::plugin::amqp1::retry_delay =~ Undef { -%> RetryDelay <%= $::collectd::plugin::amqp1::retry_delay %> <% } -%> +<% unless $::collectd::plugin::amqp1::send_queue_limit =~ Undef { -%> + SendQueueLimit <%= $::collectd::plugin::amqp1::send_queue_limit %> +<% } -%> <% $::collectd::plugin::amqp1::instances.keys.sort.each |$name| { -%> "> <% $::collectd::plugin::amqp1::instances[$name].keys.sort.each |$key| { -%>