Skip to content

Instantly share code, notes, and snippets.

@jbz
Created June 22, 2011 15:14
Show Gist options
  • Save jbz/1040306 to your computer and use it in GitHub Desktop.
Save jbz/1040306 to your computer and use it in GitHub Desktop.
Client/server config with chef
# Set attribute indicating munin role
node.set["munin"]["node"] = true
# Find available munin servers
available_servers = search(:node, "munin_server:true")
# Install munin plugins
munin_plugin "passenger_memory_stats"
munin_plugin "passenger_status"
cookbook_file "/etc/munin/plugin-conf.d/munin-node" do
source "plugin-conf.d_munin-node"
mode "0644"
notifies :restart, "service[munin-node]"
end
template "/etc/munin/munin-node.conf" do
source "munin-node.conf.erb"
mode "0644"
variables(:munin_servers => available_servers)
notifies :restart, "service[munin-node]", :immediately
end
munin_clients = search(:node, "munin_node:true")
template "/etc/munin/munin.conf" do
source "munin.conf.erb"
mode 0644
variables(:munin_nodes => munin_clients)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment