Created
December 24, 2012 11:12
-
-
Save anonymous/4368868 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include_recipe 'gdash' | |
all_deployments = search(:customer_deployments, "*:*").map { |d| d['id'] } | |
Chef::Log.info( "Found deployments: #{all_deployments.inspect}" ) | |
all_deployments.each do |d| | |
nodes = search(:node, "customer_deployment:#{d}").map { |n| n['hostname'] } | |
nodes_in_deployment = nodes.select { |n| customer_deployment(n) == d } | |
Chef::Log.info( "Found nodes in deployment #{d} #{nodes_in_deployment}") | |
nodes_in_deployment.each do |n| | |
gdash_dashboard "#{n}" do | |
category "#{d}" | |
description "#{d} - #{n}" | |
end | |
# CPU | |
gdash_dashboard_component 'cpu' do | |
dashboard_name "#{n}" | |
dashboard_category "#{d}" | |
colours{ | |
'idle' => 'red', | |
'system' => 'yellow', | |
'interrupt' => 'blue', | |
'nice' => 'green', | |
'softirq' => 'purple', | |
'steal' => 'brown', | |
'user' => 'orange', | |
'wait' => 'pink' | |
} | |
%w{idle system interrupt nice softirq steal user wait}.each do |s| | |
fields{ s.to_sym => { | |
:data => "collectd.#{d}.#{n}.cpu.0.cpu.#{s}.value", | |
:alias => s, | |
:cacti_style => true, | |
:color => colours[s] | |
} | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment