-$LOAD_PATH.push("#{File.dirname(__FILE__)}/../_lib")
-#${chef-repo}/_lib/grid.rb
+#
+# Copyright 2013-2014, whitestar
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+$LOAD_PATH.push("#{File.dirname(__FILE__)}/_lib")
+#${chef-repo}/roles/_lib/grid.rb
require 'grid'
name 'grid-nm'
#env_run_lists "prod" => ["recipe[apache2]"], "staging" => ["recipe[apache2::staging]"], "_default" => []
-mcast_addr = Grid::CLUSTERS[:base][:nagioses][:mcast_addr]
+this_cluster = Grid::CLUSTERS[:base]
+this_subcluster = Grid::CLUSTERS[:base][:nagioses]
+mcast_addr = this_subcluster[:mcast_addr]
port = '8649'
+=begin
+# uni-cast
+udp_send_channels4ucast = []
+this_subcluster[:nodes].first(2).each {|host|
+ udp_send_channels4ucast.push(
+ {
+ 'mcast_join' => '',
+ 'host' => "#{host}.#{Grid::DOMAIN}",
+ 'port' => port,
+ 'ttl' => ''
+ }
+ )
+}
+=end
host_templates = []
hosts = []
{
'contactgroup_name' => 'grid-admins',
'alias' => 'Grid Administrators',
- 'members' => 'alice,bob'
+ 'members' => 'root'
+ #'members' => 'alice,bob'
}
],
'hosts' => [
'notification_period' => '24x7',
'notification_options' => 'd,u,r',
'register' => '0',
- },
+ }
] + host_templates + hosts,
'hostgroups' => \
hostgroups + [
{
'hostgroup_name' => 'grid-servers',
'alias' => 'GridServers',
- 'members' => hostgroup_names.join(',')
+ 'hostgroup_members' => hostgroup_names.join(',')
}
],
'services' => [
+ # ganglia gmetad monitoring
+ {
+ 'use' => 'generic-check_ganglia_cache-service',
+ 'host_name' => 'localhost',
+ 'contact_groups' => 'grid-admins',
+ },
+ {
+ 'use' => 'generic-ganglia_heartbeat-service',
+ 'hostgroup_name' => "#{this_cluster[:gmetads][:name]}",
+ 'contact_groups' => 'grid-admins',
+ },
+ # standard monitoring.
{
'use' => 'generic-ping-service',
'hostgroup_name' => 'grid-servers',
+ 'contact_groups' => 'grid-admins',
},
{
'use' => 'generic-ssh-service',
'hostgroup_name' => 'grid-servers',
+ 'contact_groups' => 'grid-admins',
},
{
'use' => 'generic-ntp-service',
'hostgroup_name' => 'grid-servers',
- },
- {
- 'use' => 'generic-check_ganglia_cache-service',
- 'hostgroup_name' => 'grid-servers',
+ 'contact_groups' => 'grid-admins',
},
{
'use' => 'generic-load_one-service',
'hostgroup_name' => 'grid-servers',
+ 'contact_groups' => 'grid-admins',
},
{
'use' => 'generic-load_five-service',
'hostgroup_name' => 'grid-servers',
+ 'contact_groups' => 'grid-admins',
},
{
'use' => 'generic-load_fifteen-service',
'hostgroup_name' => 'grid-servers',
+ 'contact_groups' => 'grid-admins',
},
{
'use' => 'generic-part_max_used-service',
'hostgroup_name' => 'grid-servers',
+ 'contact_groups' => 'grid-admins',
},
{
'use' => 'generic-proc_total-service',
'hostgroup_name' => 'grid-servers',
+ 'contact_groups' => 'grid-admins',
},
{
'use' => 'generic-http-service',
- 'hostgroup_name' => 'ganglia,nagioses',
+ 'hostgroup_name' \
+ => "#{this_cluster[:gmetads][:name]},#{this_cluster[:nagioses][:name]}",
+ 'contact_groups' => 'grid-admins',
},
=begin
{
'use' => 'generic-ldap-service',
'hostgroup_name' => 'grid-nameservice-servers',
'check_command' => 'check_ldap3!dc=grid,dc=example,dc=com',
+ 'contact_groups' => 'grid-admins',
},
=end
],
+ 'servicedependencies' => [
+ {
+ 'host_name' => 'localhost',
+ 'service_description' => 'Cache for check_ganglia_metric',
+ #'dependent_host_name' => '.*', # NG!
+ 'dependent_hostgroup_name' => 'grid-servers',
+ 'dependent_service_description' => '.* via Ganglia$',
+ 'execution_failure_criteria' => 'c,p'
+ }
+ ]
}
default_attributes(
'nagios' => {
+ 'cluster_name' => 'grid-base',
'objects' => nagios_objects,
'web' => {
- 'Allow' => ["from .#{Grid::DOMAIN}"],
+ 'Allow' => [
+ "from .#{Grid::DOMAIN}",
+ 'from 192.168.0.0/16'],
'AuthType' => 'Kerberos',
'mod_auth_kerb' => {
'KrbAuthRealms' => Grid::REALM,
'authorized_for_all_host_commands' => '*',
'check_ganglia_metric' => {
'enabled' => true,
- 'gmetad_host' => "gm90.#{Grid::DOMAIN}"
+ 'gmetad_host' => "#{this_cluster[:gmetads][:service_hostname]}.#{Grid::DOMAIN}"
},
}
)
'ganglia' => {
# gmond
'cluster' => {
- 'name' => Grid::CLUSTERS[:base][:nagioses][:alias],
+ 'name' => this_subcluster[:alias],
'owner' => Grid::DOMAIN
},
'static' => {
]
=begin
## static uni-cast
- 'udp_send_channels' => [
- {
- 'mcast_join' => '',
- 'host' => "nm00.#{Grid::DOMAIN}",
- 'port' => port,
- 'ttl' => ''
- },
- {
- 'mcast_join' => '',
- 'host' => "nm01.#{Grid::DOMAIN}",
- 'port' => port,
- 'ttl' => ''
- }
- ],
+ 'udp_send_channels' => udp_send_channels4ucast,
'udp_recv_channels' => [
{
'mcast_join' => '',