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
22 description 'Grid Base nagios node'
26 'role[nameservice-client-grid]',
27 'role[ganglia-gmond]',
31 #env_run_lists "prod" => ["recipe[apache2]"], "staging" => ["recipe[apache2::staging]"], "_default" => []
33 this_cluster = Grid::CLUSTERS[:base]
34 this_subcluster = Grid::CLUSTERS[:base][:nagioses]
35 mcast_addr = this_subcluster[:mcast_addr]
39 udp_send_channels4ucast = []
40 this_subcluster[:nodes].first(2).each {|host|
41 udp_send_channels4ucast.push(
44 'host' => "#{host}.#{Grid::DOMAIN}",
57 Grid::CLUSTERS[:base].each {|key, cluster|
60 'name' => cluster[:use_host_object],
61 'use' => 'generic-grid-host',
66 cluster[:nodes].each {|node|
70 'use' => cluster[:use_host_object],
71 'address' => "#{node}.#{Grid::DOMAIN}",
78 'hostgroup_name' => cluster[:name],
79 'alias' => cluster[:alias],
80 'members' => cluster[:nodes].join(','),
83 hostgroup_names.push(cluster[:name])
89 'name' => 'generic-grid-contact',
90 'service_notification_period' => '24x7',
91 'host_notification_period' => '24x7',
92 'service_notification_options' => 'w,u,c,r',
93 'host_notification_options' => 'd,u,r',
94 'service_notification_commands' => 'notify-service-by-email',
95 'host_notification_commands' => 'notify-host-by-email',
99 'contact_name' => 'alice',
100 'use' => 'generic-grid-contact',
102 'email' => 'alice@localhost'
105 'contact_name' => 'bob',
106 'use' => 'generic-grid-contact',
108 'email' => 'bob@localhost'
113 'contactgroup_name' => 'grid-admins',
114 'alias' => 'Grid Administrators',
116 #'members' => 'alice,bob'
121 'name' => 'generic-grid-host',
122 'use' => 'generic-host',
123 'alias' => 'Grid Node',
124 'check_command' => 'check-host-alive',
125 'max_check_attempts' => '20',
126 'notification_interval' => '60',
127 'notification_period' => '24x7',
128 'notification_options' => 'd,u,r',
131 ] + host_templates + hosts,
136 'hostgroup_name' => 'grid-servers',
137 'alias' => 'GridServers',
138 'hostgroup_members' => hostgroup_names.join(',')
142 # ganglia gmetad monitoring
144 'use' => 'generic-check_ganglia_cache-service',
145 'host_name' => 'localhost',
146 'contact_groups' => 'grid-admins',
149 'use' => 'generic-ganglia_heartbeat-service',
150 'hostgroup_name' => "#{this_cluster[:gmetads][:name]}",
151 'contact_groups' => 'grid-admins',
153 # standard monitoring.
155 'use' => 'generic-ping-service',
156 'hostgroup_name' => 'grid-servers',
157 'contact_groups' => 'grid-admins',
160 'use' => 'generic-ssh-service',
161 'hostgroup_name' => 'grid-servers',
162 'contact_groups' => 'grid-admins',
165 'use' => 'generic-ntp-service',
166 'hostgroup_name' => 'grid-servers',
167 'contact_groups' => 'grid-admins',
170 'use' => 'generic-load_one-service',
171 'hostgroup_name' => 'grid-servers',
172 'contact_groups' => 'grid-admins',
175 'use' => 'generic-load_five-service',
176 'hostgroup_name' => 'grid-servers',
177 'contact_groups' => 'grid-admins',
180 'use' => 'generic-load_fifteen-service',
181 'hostgroup_name' => 'grid-servers',
182 'contact_groups' => 'grid-admins',
185 'use' => 'generic-part_max_used-service',
186 'hostgroup_name' => 'grid-servers',
187 'contact_groups' => 'grid-admins',
190 'use' => 'generic-proc_total-service',
191 'hostgroup_name' => 'grid-servers',
192 'contact_groups' => 'grid-admins',
195 'use' => 'generic-http-service',
197 => "#{this_cluster[:gmetads][:name]},#{this_cluster[:nagioses][:name]}",
198 'contact_groups' => 'grid-admins',
202 'use' => 'generic-ldap-service',
203 'hostgroup_name' => 'grid-nameservice-servers',
204 'check_command' => 'check_ldap3!dc=grid,dc=example,dc=com',
205 'contact_groups' => 'grid-admins',
209 'servicedependencies' => [
211 'host_name' => 'localhost',
212 'service_description' => 'Cache for check_ganglia_metric',
213 #'dependent_host_name' => '.*', # NG!
214 'dependent_hostgroup_name' => 'grid-servers',
215 'dependent_service_description' => '.* via Ganglia$',
216 'execution_failure_criteria' => 'c,p'
223 'cluster_name' => 'grid-base',
224 'objects' => nagios_objects,
227 "from .#{Grid::DOMAIN}",
228 'from 192.168.0.0/16'],
229 'AuthType' => 'Kerberos',
231 'KrbAuthRealms' => Grid::REALM,
232 'Krb5Keytab' => '/etc/krb5.keytab'
235 'check_external_commands' => '1',
236 'use_regexp_matching' => '1',
237 'authorized_for_system_information' => '*',
238 'authorized_for_configuration_information' => '*',
239 'authorized_for_system_commands' => '*',
240 'authorized_for_all_services' => '*',
241 'authorized_for_all_hosts' => '*',
242 'authorized_for_all_service_commands' => '*',
243 'authorized_for_all_host_commands' => '*',
244 'check_ganglia_metric' => {
246 'gmetad_host' => "#{this_cluster[:gmetads][:service_hostname]}.#{Grid::DOMAIN}"
255 'name' => this_subcluster[:alias],
256 'owner' => Grid::DOMAIN
260 'udp_send_channels' => [
262 'mcast_join' => mcast_addr,
268 'udp_recv_channels' => [
270 'mcast_join' => mcast_addr,
277 'udp_send_channels' => udp_send_channels4ucast,
278 'udp_recv_channels' => [