Skip to content

Commit

Permalink
Align Ganglia client behavior to current Chef 11.4 version.
Browse files Browse the repository at this point in the history
  • Loading branch information
Udo Juettner committed Apr 17, 2014
1 parent 2c78a27 commit 5345207
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions opsworks_ganglia/recipes/configure-client.rb
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
if node[:opsworks][:layers]['monitoring-master']
if node[:opsworks][:layers].has_key?('monitoring-master')
include_recipe 'opsworks_ganglia::client'

monitoring_master = node[:opsworks][:layers]['monitoring-master'][:instances].collect{ |instance, names|
names['private_ip']
}.first rescue nil

service 'gmond' do
case node[:platform]
when 'ubuntu'
start_command '/etc/init.d/ganglia-monitor start'
case node[:platform_family]
when 'debian'
if monitoring_master.nil?
start_command 'echo "No action"'
else
start_command '/etc/init.d/ganglia-monitor start'
end
stop_command '/etc/init.d/ganglia-monitor stop'
restart_command '/etc/init.d/ganglia-monitor restart'
when 'centos','redhat','fedora','amazon'
start_command '/etc/init.d/gmond start'
when 'rhel'
if monitoring_master.nil?
start_command 'echo "No action"'
else
start_command '/etc/init.d/gmond start'
end
stop_command '/etc/init.d/gmond stop'
restart_command '/etc/init.d/gmond restart'
end

supports :status => false, :restart => false
action :nothing
end

monitoring_master = node[:opsworks][:layers]['monitoring-master'][:instances].collect{ |instance, names|
names['private_ip']
}.first rescue nil

template '/etc/ganglia/gmond.conf' do
source 'gmond.conf.erb'
variables({
Expand Down

0 comments on commit 5345207

Please sign in to comment.