2 # Copyright 2013-2014, whitestar
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
17 $LOAD_PATH.push("#{File.dirname(__FILE__)}/_lib")
18 #${chef-repo}/roles/_lib/grid.rb
23 cluster_name = 'praesepe'
24 cluster_sym = cluster_name.to_sym
25 datanode_prefix = 'dn1'
26 datanode_digit_nums = 4
28 name "#{cluster_name}-gm"
29 description "#{cluster_name.capitalize} ganglia gmetad node"
33 #'role[nameservice-client-grid]',
34 'role[ganglia-gmond]',
35 'role[ganglia-gmetad]',
41 this_subcluster = Grid::CLUSTERS[cluster_sym][:gmetads]
42 mcast_addr = this_subcluster[:mcast_addr]
44 polling_interval = '30'
46 udp_send_channels4ucast = []
47 this_subcluster[:nodes].first(2).each {|host|
48 udp_send_channels4ucast.push(
51 'host' => "#{host}.#{Grid::DOMAIN}",
60 Grid::CLUSTERS[cluster_sym].select{|key| key != :datanodes}.each {|key, cluster|
63 :name => cluster[:alias],
64 :polling_interval => polling_interval,
66 :address_list => cluster[:nodes].first(2).map{|host| "#{host}.#{Grid::DOMAIN}"}
73 digit_nums = datanode_digit_nums
77 #(0...80).step(40) {|v|
78 first_head = v.to_s.rjust(digit_nums, padstr)
79 last_head = (v + head_node_nums -1).to_s.rjust(digit_nums, padstr)
82 :name => "DataNode#{first_head}",
83 :polling_interval => polling_interval,
85 :address_list => "#{datanode_prefix}{#{first_head}..#{last_head}}.#{Grid::DOMAIN}".expand
95 "from .#{Grid::DOMAIN}",
96 'from 192.168.0.0/16'],
97 'AuthType' => 'Kerberos',
99 'KrbAuthRealms' => Grid::REALM,
100 'Krb5Keytab' => '/etc/krb5.keytab'
108 if defined? Grid::CLUSTERS[cluster_sym][:nagioses][:nodes] then
109 nagios_nodes = Grid::CLUSTERS[cluster_sym][:nagioses][:nodes].map{|host| "#{host}.#{Grid::DOMAIN}"}
116 'name' => this_subcluster[:alias],
117 'owner' => Grid::DOMAIN
122 'udp_send_channels' => [
124 'mcast_join' => mcast_addr,
130 'udp_recv_channels' => [
132 'mcast_join' => mcast_addr,
139 'udp_send_channels' => udp_send_channels4ucast,
140 'udp_recv_channels' => [
149 'gridname' => cluster_name.capitalize,
150 'trusted_hosts' => ['127.0.0.1'] + nagios_nodes,
151 'data_sources' => data_sources + dn_data_sources