forked from realityforge/chef-gdash
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request realityforge#1 from chrisroberts/dashboard-components
Dashboard components
- Loading branch information
Showing
13 changed files
with
275 additions
and
73 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,13 @@ | ||
maintainer "Sean Escriva" | ||
maintainer_email "sean.escriva@gmail.com" | ||
maintainer "Heavy Water Software Inc." | ||
maintainer_email "ops@hw-ops.com" | ||
license "Apache 2.0" | ||
description "Installs/Configures gdash" | ||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) | ||
version "0.0.1" | ||
version "0.0.2" | ||
|
||
%w{debian ubuntu}.each do |os| | ||
supports os | ||
end | ||
depends "build-essential" | ||
depends "runit" | ||
depends "graphite" | ||
depends "unicorn" | ||
|
||
%w{build-essential runit}.each do |dep| | ||
depends dep | ||
end | ||
|
||
depends "iptables" | ||
suggests "iptables" |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
def load_current_resource | ||
node.include_attribute "gdash::gdash" | ||
node.include_recipe "gdash::default" | ||
|
||
@dashboard_dir = ::File.join( | ||
node.gdash.templatedir, | ||
new_resource.dashboard_category, | ||
new_resource.dashboard_name | ||
) | ||
end | ||
|
||
action :create do | ||
|
||
@dashboard_dir.sub("#{node.gdash.templatedir}/", '').split('/').inject([node.gdash.templatedir]){|memo,val| | ||
memo.push(::File.join(memo.last, val)) | ||
}.each do |dir_path| | ||
directory dir_path do | ||
owner node.gdash.owner | ||
group node.gdash.group | ||
recursive true | ||
notifies :restart, resources(:service => 'gdash'), :delayed | ||
end | ||
end | ||
|
||
template ::File.join(@dashboard_dir, "#{new_resource.name}.graph") do | ||
source 'gdash.graph.erb' | ||
cookbook 'gdash' | ||
template_hash = ::GDASH_RESOURCE_ATTRIBS.map{ |attr| | ||
if(new_resource.respond_to?(attr) && !new_resource.send(attr).nil?) | ||
[attr, new_resource.send(attr)] | ||
else | ||
nil | ||
end | ||
}.compact.flatten | ||
template_hash = Hash[*template_hash] | ||
|
||
owner node.gdash.owner | ||
group node.gdash.group | ||
mode 0644 | ||
variables( | ||
:base_variables => template_hash, | ||
:fields => new_resource.fields || {}, | ||
:lines => new_resource.lines || [], | ||
:forecasts => new_resource.forecasts || {} | ||
) | ||
action :create | ||
end | ||
|
||
new_resource.updated_by_last_action(true) | ||
|
||
end | ||
|
||
action :delete do | ||
|
||
file ::File.join(@dashboard_dir, "#{new_resource.name}.graph") do | ||
action :delete | ||
end | ||
|
||
new_resource.updated_by_last_action(true) | ||
|
||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
include_recipe 'gdash' | ||
|
||
gdash_dashboard 'Base Metrics' do | ||
category 'Basic' | ||
description 'Simple dashboard' | ||
end | ||
|
||
gdash_dashboard_component 'metrics_received' do | ||
dashboard_name 'Base Metrics' | ||
dashboard_category 'Basic' | ||
vtitle 'Items' | ||
fields( | ||
:received => { | ||
:data => '*.*.*.metricsReceived', | ||
:alias => 'Metrics Received' | ||
} | ||
) | ||
end | ||
|
||
gdash_dashboard_component 'cpu' do | ||
dashboard_name 'Base Metrics' | ||
dashboard_category 'Basic' | ||
fields( | ||
:cpu => { | ||
:data => '*.*.*.cpuUsage', | ||
:alias => 'CPU Usage' | ||
} | ||
) | ||
end | ||
|
||
gdash_dashboard_component 'memory' do | ||
dashboard_name 'Base Metrics' | ||
dashboard_category 'Basic' | ||
fields( | ||
:memory => { | ||
:data => '*.*.*.memUsage', | ||
:alias => 'Memory Usage' | ||
} | ||
) | ||
end |
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
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.