diff --git a/manifests/plugin/network/server.pp b/manifests/plugin/network/server.pp index 8587f63fe..2839f2457 100644 --- a/manifests/plugin/network/server.pp +++ b/manifests/plugin/network/server.pp @@ -8,6 +8,7 @@ Optional[String] $interface = undef, Optional[Boolean] $forward = undef, Optional[Integer[1]] $resolveinterval = undef, + String $server = $name, ) { include collectd include collectd::plugin::network diff --git a/spec/defines/collectd_plugin_network_server_spec.rb b/spec/defines/collectd_plugin_network_server_spec.rb index 1a2fee65e..c09008baa 100644 --- a/spec/defines/collectd_plugin_network_server_spec.rb +++ b/spec/defines/collectd_plugin_network_server_spec.rb @@ -41,6 +41,18 @@ is_expected.to contain_file("#{options[:plugin_conf_dir]}/network-server-node1.conf").with(ensure: 'absent') end end + + context 'with specifique title' do + let(:title) { 'eatapples' } + let :params do + { servers: '1.1.1.1' } + it do + is_expected.to contain_file( + "#{options[:plugin_conf_dir]}/network-server-eatapples.conf" + ) + end + end + end end end end diff --git a/templates/plugin/network/server.conf.erb b/templates/plugin/network/server.conf.erb index a11137a21..19489b547 100644 --- a/templates/plugin/network/server.conf.erb +++ b/templates/plugin/network/server.conf.erb @@ -1,6 +1,6 @@ <% if scope.lookupvar('collectd::collectd_version_real') and (scope.function_versioncmp([scope.lookupvar('collectd::collectd_version_real'), '4.7']) >= 0) -%> - " "<%= @port %>"> + " "<%= @port %>"> <% if @securitylevel -%> SecurityLevel "<%= @securitylevel %>" <% end -%> @@ -18,7 +18,7 @@ <% end %> <% else -%> - Server "<%= @name %>" "<%= @port %>" + Server "<%= @server %>" "<%= @port %>" <% end -%> <% if ! @forward.nil? -%> Forward <%= @forward %>