[chef] Changes to munin-recipe


Chronological Thread 
  • From: Arnold Krille < >
  • To:
  • Subject: [chef] Changes to munin-recipe
  • Date: Tue, 18 Dec 2012 13:39:44 +0100

Hi all,

I do have a small but interesting patch here to ease the transition
from non-chef to chef controlled environments for munin:
Its nice that munin::client finds (and allows) munin-servers in the
same environment. But that only works for munin-servers that are
already chef-managed. And it only works in the same environment.
The attached patch adds an attribute to allow more servers to access
munin::client.

Is this useful to anyone of you?

How do I proceed from here to get it included in the official
cookbooks? I already had my boss sign the ccla, I do have an account
for the bug-tracker. (One small catch: We use svn and I can't get my
head around to working with git, so pull-requests are out for now.)

Have fun,

Arnold
Index: /trunk/chef-repo/cookbooks/munin/attributes/default.rb
===================================================================
--- /trunk/chef-repo/cookbooks/munin/attributes/default.rb	(revision 799)
+++ /trunk/chef-repo/cookbooks/munin/attributes/default.rb	(revision 800)
@@ -24,4 +24,6 @@
 default['munin']['web_server'] = 'apache'
 default['munin']['web_server_port'] = 80
+
+default_unless['munin']['extra_servers'] = []
 
 case node[:platform]
Index: /trunk/chef-repo/cookbooks/munin/recipes/client.rb
===================================================================
--- /trunk/chef-repo/cookbooks/munin/recipes/client.rb	(revision 799)
+++ /trunk/chef-repo/cookbooks/munin/recipes/client.rb	(revision 800)
@@ -19,4 +19,9 @@
 
 munin_servers = search(:node, "role:#{node['munin']['server_role']} AND chef_environment:#{node.chef_environment}")
+node['munin']['extra_servers'].each do |srv|
+  search(:node, "name:#{srv}").each do |n|
+    munin_servers << n
+  end
+end
 
 package "munin-node"
Index: /trunk/chef-repo/cookbooks/munin/templates/default/munin-node.conf.erb
===================================================================
--- /trunk/chef-repo/cookbooks/munin/templates/default/munin-node.conf.erb	(revision 799)
+++ /trunk/chef-repo/cookbooks/munin/templates/default/munin-node.conf.erb	(revision 800)
@@ -37,5 +37,5 @@
 # the allow line as many times as you'd like
 
-<% @munin_servers.sort.each do |server| -%>
+<% @munin_servers.each do |server| -%>
 allow ^<%= server[:ipaddress].to_s.gsub(/\./, '\.') %>$
 <% end -%>

Attachment: signature.asc
Description: PGP signature




Archive powered by MHonArc 2.6.16.

§