Permalink
Browse files

fix json merge conflict again

  • Loading branch information...
2 parents 7422595 + 8eb4149 commit 2b17fb41879cfc87aaad8583e147134ac3b44b14 @jtimberman jtimberman committed Jan 15, 2011
View
2 cookbooks/nagios/metadata.json
@@ -37,5 +37,5 @@
"nagios::client": "Installs and configures a nagios client with nrpe",
"nagios::server": "Installs and configures a nagios server"
},
- "version": "0.4.2"
+ "version": "0.4.3"
}
View
2 cookbooks/nagios/metadata.rb
@@ -3,7 +3,7 @@
license "Apache 2.0"
description "Installs and configures nagios"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
-version "0.4.2"
+version "0.4.3"
recipe "nagios", "Includes the client recipe."
recipe "nagios::client", "Installs and configures a nagios client with nrpe"
View
2 cookbooks/nagios/recipes/client.rb
@@ -25,7 +25,7 @@
if node.run_list.roles.include?(node[:nagios][:server_role])
mon_host << node[:ipaddress]
else
- search(:node, "role:#{node[:nagios][:server_role]}") do |n|
+ search(:node, "role:#{node[:nagios][:server_role]} AND app_environment:#{node[:app_environment]}") do |n|
mon_host << n['ipaddress']
end
end
View
4 cookbooks/nagios/recipes/server.rb
@@ -26,7 +26,7 @@
include_recipe "nagios::client"
sysadmins = search(:users, 'groups:sysadmin')
-nodes = search(:node, "hostname:[* TO *] AND role:#{node[:app_environment]}")
+nodes = search(:node, "hostname:[* TO *] AND app_environment:#{node[:app_environment]}")
if nodes.empty?
Chef::Log.info("No nodes returned from search, using this node so hosts.cfg has data")
@@ -43,7 +43,7 @@
service_hosts= Hash.new
search(:role, "*:*") do |r|
role_list << r.name
- search(:node, "role:#{r.name}") do |n|
+ search(:node, "role:#{r.name} AND app_environment:#{node[:app_environment]}") do |n|
service_hosts[r.name] = n['hostname']
end
end
View
4 cookbooks/nagios/templates/default/hosts.cfg.erb
@@ -6,7 +6,11 @@ define host {
use server
address <%= n['ipaddress'] %>
host_name <%= n['hostname'] %>
+<% if n.run_list.roles.nil? -%>
+ hostgroups all
+<% else -%>
hostgroups <%= n.run_list.roles.to_a.join(",") %>
+<% end -%>
}
<% end -%>

0 comments on commit 2b17fb4

Please sign in to comment.