OSDN Git Service

extend the nagios recipe for all objects.
[metasearch/grid-chef-repo.git] / roles / grid-gm.rb
1 $LOAD_PATH.push("#{File.dirname(__FILE__)}/../_lib")
2 #${chef-repo}/_lib/grid.rb
3 require 'grid'
4 require 'rubygems'
5 require 'bracecomp'
6
7 name 'grid-gm'
8 description 'Grid Base ganglia gmetad node'
9
10 run_list(
11   'role[node_commons]',
12   'role[nameservice-client-grid]',
13   'role[ganglia-gmond]',
14   'role[ganglia-gmetad]',
15   'role[ganglia-web]'
16 )
17
18 mcast_addr = Grid::CLUSTERS[:base][:gmetads][:mcast_addr]
19 port = '8649'
20 polling_interval = 30
21
22 data_sources = []
23 Grid::CLUSTERS[:base].each {|key, cluster|
24   data_sources.push(
25     {
26       :name => cluster[:alias],
27       :polling_interval => polling_interval,
28       # head nodes: 2
29       :address_list => cluster[:nodes].first(2).map{|host| "#{host}.#{Grid::DOMAIN}"}
30     }
31   )
32 }
33
34 #env_run_lists "prod" => ["recipe[apache2]"], "staging" => ["recipe[apache2::staging]"], "_default" => []
35
36 default_attributes(
37   'ganglia' => {
38     'web' => {
39       'Allow' => [
40         "from .#{Grid::DOMAIN}",
41         'from 192.168.0.0/16'],
42       'AuthType' => 'Kerberos',
43       'mod_auth_kerb' => {
44         'KrbAuthRealms' => Grid::REALM,
45         'Krb5Keytab' => '/etc/krb5.keytab'
46       }
47     }
48   },
49 )
50
51 override_attributes(
52   'ganglia' => {
53     # gmond
54     'cluster' => {
55       'name' => Grid::CLUSTERS[:base][:gmetads][:alias],
56       'owner' => Grid::DOMAIN
57     },
58     ## static multi-cast
59     'static' => {
60       'udp_send_channels' => [
61         {
62           'mcast_join' => mcast_addr,
63           'host' => '',
64           'port' => port,
65           'ttl' => '1'
66         }
67       ],
68       'udp_recv_channels' => [
69         {
70           'mcast_join' => mcast_addr,
71           'port' => port,
72           'bind' => mcast_addr
73         }
74       ]
75     },
76     # gmetad
77     'gridname' => 'Grid-Base',
78     'trusted_hosts' => ['127.0.0.1'] \
79       + Grid::CLUSTERS[:base][:nagioses][:nodes].map{|host| "#{host}.#{Grid::DOMAIN}"},
80     'data_sources' => data_sources
81   }
82 )