OSDN Git Service

add yarn-installer recipe to the nodejs_utils cookbook.
[metasearch/grid-chef-repo.git] / roles / grid-nm.rb
index 3e6aa33..5285c81 100644 (file)
@@ -1,5 +1,21 @@
-$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'
@@ -14,6 +30,7 @@ run_list(
 
 #env_run_lists "prod" => ["recipe[apache2]"], "staging" => ["recipe[apache2::staging]"], "_default" => []
 
+this_cluster = Grid::CLUSTERS[:base]
 this_subcluster = Grid::CLUSTERS[:base][:nagioses]
 mcast_addr = this_subcluster[:mcast_addr]
 port = '8649'
@@ -95,7 +112,8 @@ nagios_objects = {
     {
       'contactgroup_name' => 'grid-admins',
       'alias' => 'Grid Administrators',
-      'members' => 'alice,bob'
+      'members' => 'root'
+      #'members' => 'alice,bob'
     }
   ],
   'hosts' => [
@@ -109,7 +127,7 @@ nagios_objects = {
       'notification_period' => '24x7',
       'notification_options' => 'd,u,r',
       'register' => '0',
-    },
+    }
   ] + host_templates + hosts,
   'hostgroups' => \
     hostgroups + [
@@ -117,65 +135,97 @@ nagios_objects = {
       {
         '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,
@@ -193,7 +243,7 @@ default_attributes(
     'authorized_for_all_host_commands' => '*',
     'check_ganglia_metric' => {
       'enabled' => true,
-      'gmetad_host' => "gm90.#{Grid::DOMAIN}"
+      'gmetad_host' => "#{this_cluster[:gmetads][:service_hostname]}.#{Grid::DOMAIN}"
     },
   }
 )