diff --git a/manifests/statsd.pp b/manifests/statsd.pp index c5125fd4..78dbcfe0 100644 --- a/manifests/statsd.pp +++ b/manifests/statsd.pp @@ -5,6 +5,14 @@ # [*resource_id*] # (required) Resource UUID to use to identify statsd in Gnocchi. # +# [*host*] +# (optional) The listen IP for statsd. +# Defaults to $::os_service_default +# +# [*port*] +# (optional) The port for statsd. +# Defaults to $::os_service_default. +# # [*flush_delay*] # (optional) Delay between flushes. # Defaults to $::os_service_default @@ -27,6 +35,8 @@ # class gnocchi::statsd ( $resource_id, + $host = $::os_service_default, + $port = $::os_service_default, $flush_delay = $::os_service_default, $archive_policy_name = $::os_service_default, $manage_service = true, @@ -61,6 +71,8 @@ class gnocchi::statsd ( gnocchi_config { 'statsd/resource_id' : value => $resource_id; + 'statsd/host' : value => $host; + 'statsd/port' : value => $port; 'statsd/archive_policy_name' : value => $archive_policy_name; 'statsd/flush_delay' : value => $flush_delay; } diff --git a/releasenotes/notes/statsd-host-and-port-57b290e8dd57ed6f.yaml b/releasenotes/notes/statsd-host-and-port-57b290e8dd57ed6f.yaml new file mode 100644 index 00000000..a0f50429 --- /dev/null +++ b/releasenotes/notes/statsd-host-and-port-57b290e8dd57ed6f.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + The ``gnocchi::statsd`` class now supports ``host`` and ``port``. diff --git a/spec/classes/gnocchi_statsd_spec.rb b/spec/classes/gnocchi_statsd_spec.rb index 65d79be4..0bb6205e 100644 --- a/spec/classes/gnocchi_statsd_spec.rb +++ b/spec/classes/gnocchi_statsd_spec.rb @@ -24,6 +24,8 @@ describe 'gnocchi::statsd' do it 'configures gnocchi statsd' do is_expected.to contain_gnocchi_config('statsd/resource_id').with_value('07f26121-5777-48ba-8a0b-d70468133dd9') + is_expected.to contain_gnocchi_config('statsd/host').with_value('') + is_expected.to contain_gnocchi_config('statsd/port').with_value('') is_expected.to contain_gnocchi_config('statsd/flush_delay').with_value('') is_expected.to contain_gnocchi_config('statsd/archive_policy_name').with_value('') end @@ -59,6 +61,20 @@ describe 'gnocchi::statsd' do end end + context 'whth host and port' do + before do + params.merge!({ + :host => '192.0.2.1', + :port => 8125, + }) + end + + it 'configures the parameter' do + is_expected.to contain_gnocchi_config('statsd/host').with_value('192.0.2.1') + is_expected.to contain_gnocchi_config('statsd/port').with_value(8125) + end + end + context 'with flush_delay' do before do params.merge!({ :flush_delay => 10 })