Permalink
Browse files

Merge pull request #11 from modcloth-cookbooks/smartos_modcloth

COOK-2137 SmartOS support for Munin
  • Loading branch information...
2 parents 9208fe2 + 05c9b67 commit acf49ede16020b736f0bd7fcef86d3e02ecadb7d @jtimberman jtimberman committed Jan 8, 2013
Showing with 21 additions and 5 deletions.
  1. +11 −0 attributes/default.rb
  2. +4 −1 definitions/munin_plugin.rb
  3. +6 −4 recipes/client.rb
View
11 attributes/default.rb
@@ -31,24 +31,35 @@
default['munin']['docroot'] = "/srv/http/munin"
default['munin']['dbdir'] = "/var/lib/munin"
default['munin']['root']['group'] = "root"
+ default['munin']['service_name'] = "munin-node"
when "centos","redhat","fedora","amazon"
default['munin']['basedir'] = "/etc/munin"
default['munin']['plugin_dir'] = "/usr/share/munin/plugins"
default['munin']['docroot'] = "/var/www/html/munin"
default['munin']['dbdir'] = "/var/lib/munin"
default['munin']['root']['group'] = "root"
+ default['munin']['service_name'] = "munin-node"
when "freebsd"
default['munin']['basedir'] = "/usr/local/etc/munin"
default['munin']['plugin_dir'] = "/usr/local/share/munin/plugins"
default['munin']['docroot'] = "/usr/local/www/munin"
default['munin']['dbdir'] = "/usr/local/var/munin"
default['munin']['root']['group'] = "wheel"
+ default['munin']['service_name'] = "munin-node"
+when "smartos"
+ default['munin']['basedir'] = "/opt/local/etc/munin"
+ default['munin']['plugin_dir'] = "/opt/local/lib/munin/plugins"
+ default['munin']['docroot'] = "/var/www/html/munin"
+ default['munin']['dbdir'] = "/var/lib/munin"
+ default['munin']['root']['group'] = "root"
+ default['munin']['service_name'] = "munin"
else
default['munin']['basedir'] = "/etc/munin"
default['munin']['plugin_dir'] = "/usr/share/munin/plugins"
default['munin']['docroot'] = "/var/www/munin"
default['munin']['dbdir'] = "/var/lib/munin"
default['munin']['root']['group'] = "root"
+ default['munin']['service_name'] = "munin-node"
end
default['munin']['plugins'] = "#{default['munin']['basedir']}/plugins"
View
5 definitions/munin_plugin.rb
@@ -18,6 +18,7 @@
#
+
define :munin_plugin, :create_file => false, :enable => true, :cookbook => 'munin' do
include_recipe "munin::client"
@@ -26,6 +27,8 @@
plugin_config = params[:plugin_config] ? params[:plugin_config] : node['munin']['plugins']
plugin_dir = params[:plugin_dir] ? params[:plugin_dir] : node['munin']['plugin_dir']
+ service_name = params[:service_name] ? params[:service_name] : node['munin']['service_name']
+
if params[:create_file]
cookbook_file "#{plugin_dir}/#{params[:name]}" do
cookbook params[:cookbook]
@@ -43,7 +46,7 @@
else
action :delete
end
- notifies :restart, resources(:service => "munin-node")
+ notifies :restart, resources(:service => service_name)
end
end
View
10 recipes/client.rb
@@ -21,7 +21,9 @@
package "munin-node"
-service "munin-node" do
+service_name = node['munin']['service_name']
+
+service service_name do
supports :restart => true
action :enable
end
@@ -30,13 +32,13 @@
source "munin-node.conf.erb"
mode 0644
variables :munin_servers => munin_servers
- notifies :restart, resources(:service => "munin-node")
+ notifies :restart, resources(:service => service_name)
end
case node[:platform]
-when "arch"
+when "arch", "smartos"
execute "munin-node-configure --shell | sh" do
not_if { Dir.entries(node['munin']['plugins']).length > 2 }
- notifies :restart, "service[munin-node]"
+ notifies :restart, resources(:service => service_name)
end
end

0 comments on commit acf49ed

Please sign in to comment.