diff --git a/spec/system/gmond_spec.rb b/spec/system/gmond_spec.rb index 38fedee..a09c983 100644 --- a/spec/system/gmond_spec.rb +++ b/spec/system/gmond_spec.rb @@ -44,4 +44,15 @@ class { 'ganglia::gmond': } describe service(daemon_name) do it { should be_running } end + + # default udp_recv_channel + describe port(8649) do + it { should be_listening.with('udp') } + end + + # default tcp_accept_channel + describe port(8659) do + it { should be_listening.with('tcp') } + end + end diff --git a/templates/gmond.conf.debian.erb b/templates/gmond.conf.debian.erb index 2937386..c86e1b3 100644 --- a/templates/gmond.conf.debian.erb +++ b/templates/gmond.conf.debian.erb @@ -31,6 +31,7 @@ host { /* Feel free to specify as many udp_send_channels as you like. Gmond used to only support having a single channel */ +<% unless @udp_send_channel.nil? -%> <% @udp_send_channel.each do |channel| -%> udp_send_channel { <%- if channel['mcast_join'] then -%> @@ -47,8 +48,10 @@ udp_send_channel { <%- end -%> } +<% end -%> <% end -%> /* You can specify as many udp_recv_channels as you like as well. */ +<% unless @udp_recv_channel.nil? -%> <% @udp_recv_channel.each do |channel| -%> udp_recv_channel { <%- if channel['mcast_join'] then -%> @@ -62,9 +65,11 @@ udp_recv_channel { <%- end -%> } +<% end -%> <% end -%> /* You can specify as many tcp_accept_channels as you like to share an xml description of the state of the cluster */ +<% unless @tcp_accept_channel.nil? -%> <% @tcp_accept_channel.each do |channel| -%> tcp_accept_channel { <%- if channel['port'] then -%> @@ -73,7 +78,7 @@ tcp_accept_channel { } <% end -%> - +<% end -%> /* Each metrics module that is referenced by gmond must be specified and loaded. If the module has been statically linked with gmond, it does not require a load path. However all dynamically loadable modules must include diff --git a/templates/gmond.conf.el5.erb b/templates/gmond.conf.el5.erb index 34e78ca..1abee3f 100644 --- a/templates/gmond.conf.el5.erb +++ b/templates/gmond.conf.el5.erb @@ -30,6 +30,7 @@ host { /* Feel free to specify as many udp_send_channels as you like. Gmond used to only support having a single channel */ +<% unless @udp_send_channel.nil? -%> <% @udp_send_channel.each do |channel| -%> udp_send_channel { <%- if channel['mcast_join'] then -%> @@ -46,8 +47,10 @@ udp_send_channel { <%- end -%> } +<% end -%> <% end -%> /* You can specify as many udp_recv_channels as you like as well. */ +<% unless @udp_recv_channel.nil? -%> <% @udp_recv_channel.each do |channel| -%> udp_recv_channel { <%- if channel['mcast_join'] then -%> @@ -61,9 +64,11 @@ udp_recv_channel { <%- end -%> } +<% end -%> <% end -%> /* You can specify as many tcp_accept_channels as you like to share an xml description of the state of the cluster */ +<% unless @tcp_accept_channel.nil? -%> <% @tcp_accept_channel.each do |channel| -%> tcp_accept_channel { <%- if channel['port'] then -%> @@ -71,6 +76,7 @@ tcp_accept_channel { <%- end -%> } +<% end -%> <% end -%> /* The old internal 2.5.x metric array has been replaced by the following collection_group directives. What follows is the default behavior for diff --git a/templates/gmond.conf.el6.erb b/templates/gmond.conf.el6.erb index 85829d1..9a6e2cf 100644 --- a/templates/gmond.conf.el6.erb +++ b/templates/gmond.conf.el6.erb @@ -33,6 +33,7 @@ host { /* Feel free to specify as many udp_send_channels as you like. Gmond used to only support having a single channel */ +<% unless @udp_send_channel.nil? -%> <% @udp_send_channel.each do |channel| -%> udp_send_channel { <%- if channel['mcast_join'] then -%> @@ -49,8 +50,10 @@ udp_send_channel { <%- end -%> } +<% end -%> <% end -%> /* You can specify as many udp_recv_channels as you like as well. */ +<% unless @udp_recv_channel.nil? -%> <% @udp_recv_channel.each do |channel| -%> udp_recv_channel { <%- if channel['mcast_join'] then -%> @@ -64,9 +67,11 @@ udp_recv_channel { <%- end -%> } +<% end -%> <% end -%> /* You can specify as many tcp_accept_channels as you like to share an xml description of the state of the cluster */ +<% unless @tcp_accept_channel.nil? -%> <% @tcp_accept_channel.each do |channel| -%> tcp_accept_channel { <%- if channel['port'] then -%> @@ -74,6 +79,7 @@ tcp_accept_channel { <%- end -%> } +<% end -%> <% end -%> /* Each metrics module that is referenced by gmond must be specified and loaded. If the module has been statically linked with gmond, it does