diff --git a/metadata.rb b/metadata.rb index 04cea57a..40e7c3ce 100644 --- a/metadata.rb +++ b/metadata.rb @@ -10,6 +10,6 @@ version "1.0.7" supports os end -%w{ apt collectd-graphite database glance keystone mysql openssh rabbitmq selinux osops-utils monit sysctl }.each do |dep| +%w{ apt database glance keystone mysql openssh rabbitmq selinux osops-utils sysctl }.each do |dep| depends dep end diff --git a/recipes/api-ec2-monitoring.rb b/recipes/api-ec2-monitoring.rb deleted file mode 100644 index 95946b66..00000000 --- a/recipes/api-ec2-monitoring.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Cookbook Name:: nova -# Recipe:: api-ec2-monitoring -# -# Copyright 2009, Rackspace Hosting, Inc. -# -# 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. -# - -######################################## -# BEGIN MONIT SECTION -# Allow for enable/disable of monit -if node["enable_monit"] - include_recipe "monit::server" - platform_options = node["nova"]["platform"] - - monit_procmon "nova-api-ec2" do - process_name "nova-api-ec2" - start_cmd "/usr/sbin/service " + platform_options["api_ec2_service"] + " start" - stop_cmd "/usr/sbin/service " + platform_options["api_ec2_service"] + " stop" - end -end -######################################## diff --git a/recipes/api-ec2.rb b/recipes/api-ec2.rb index 38600063..51b14a83 100644 --- a/recipes/api-ec2.rb +++ b/recipes/api-ec2.rb @@ -18,6 +18,7 @@ ::Chef::Recipe.send(:include, Opscode::OpenSSL::Password) include_recipe "nova::nova-common" +include_recipe "monitoring" platform_options=node["nova"]["platform"] @@ -49,6 +50,14 @@ service "nova-api-ec2" do subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed end +monitoring_procmon "nova-api-ec2" do + service_name = platform_options["api_ec2_service"] + + process_name "nova-api_ec2" + start_cmd "/usr/sbin/service #{service_name} start" + stop_cmd "/usr/sbin/service #{service_name} stop" +end + ks_admin_endpoint = get_access_endpoint("keystone", "keystone", "admin-api") ks_service_endpoint = get_access_endpoint("keystone", "keystone", "service-api") keystone = get_settings_by_role("keystone","keystone") @@ -137,6 +146,3 @@ keystone_register "Register Compute Endpoint" do endpoint_publicurl ec2_public_endpoint["uri"] action :create_endpoint end - -# Include recipe(nova::api-ec2-monitoring) -include_recipe "nova::api-ec2-monitoring" diff --git a/recipes/api-metadata-monitoring.rb b/recipes/api-metadata-monitoring.rb deleted file mode 100644 index a5a0e49b..00000000 --- a/recipes/api-metadata-monitoring.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Cookbook Name:: nova -# Recipe:: api-metadata-monitoring -# -# Copyright 2009, Rackspace Hosting, Inc. -# -# 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. -# - -######################################## -# BEGIN MONIT SECTION -# Allow for enable/disable of monit -if node["enable_monit"] - include_recipe "monit::server" - platform_options = node["nova"]["platform"] - - monit_procmon "nova-api-metadata" do - process_name "nova-api-metadata" - start_cmd "/usr/sbin/service " + platform_options["nova_api_metadata_service"] + " start" - stop_cmd "/usr/sbin/service " + platform_options["nova_api_metadata_service"] + " stop" - end -end -######################################## diff --git a/recipes/api-metadata.rb b/recipes/api-metadata.rb index 32e938da..a57cb36d 100644 --- a/recipes/api-metadata.rb +++ b/recipes/api-metadata.rb @@ -18,6 +18,7 @@ # include_recipe "nova::nova-common" +include_recipe "monitoring" platform_options = node["nova"]["platform"] @@ -46,6 +47,14 @@ service "nova-api-metadata" do subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed end +monitoring_procmon "nova-api-metadata" do + service_name = platform_options["nova_api_metadata_service"] + + process_name "nova-api-metadata" + start_cmd "/usr/sbin/service #{service_name} start" + stop_cmd "/usr/sbin/service #{service_name} stop" +end + ks_admin_endpoint = get_access_endpoint("keystone", "keystone", "admin-api") ks_service_endpoint = get_access_endpoint("keystone", "keystone", "service-api") keystone = get_settings_by_role("keystone","keystone") @@ -64,6 +73,3 @@ template "/etc/nova/api-paste.ini" do ) notifies :restart, resources(:service => "nova-api-metadata"), :delayed end - -# Include recipe(nova::api-metadata-monitoring) -include_recipe "nova::api-metadata-monitoring" diff --git a/recipes/api-os-compute-monitoring.rb b/recipes/api-os-compute-monitoring.rb deleted file mode 100644 index 933aca6d..00000000 --- a/recipes/api-os-compute-monitoring.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Cookbook Name:: nova -# Recipe:: api-os-compute-monitoring -# -# Copyright 2009, Rackspace Hosting, Inc. -# -# 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. -# - -######################################## -# BEGIN MONIT SECTION -# Allow for enable/disable of monit -if node["enable_monit"] - include_recipe "monit::server" - platform_options = node["nova"]["platform"] - - monit_procmon "nova-api-os-compute" do - process_name "nova-api-os-compute" - start_cmd "/usr/sbin/service " + platform_options["api_os_compute_service"] + " start" - stop_cmd "/usr/sbin/service " + platform_options["api_os_compute_service"] + " stop" - end -end -######################################## diff --git a/recipes/api-os-compute.rb b/recipes/api-os-compute.rb index b7337613..0f48103e 100644 --- a/recipes/api-os-compute.rb +++ b/recipes/api-os-compute.rb @@ -18,6 +18,7 @@ ::Chef::Recipe.send(:include, Opscode::OpenSSL::Password) include_recipe "nova::nova-common" +include_recipe "monitoring" # Set a secure keystone service password node.set_unless['nova']['service_pass'] = secure_password @@ -50,6 +51,14 @@ service "nova-api-os-compute" do subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed end +monitoring_procmon "nova-api-os-compute" do + service_name=platform_options["api_os_compute_service"] + + process_name "nova-api-os-compute" + start_cmd "/usr/sbin/service #{service_name} start" + stop_cmd "/usr/sbin/service #{service_name} stop" +end + keystone = get_settings_by_role("keystone", "keystone") ks_admin_endpoint = get_access_endpoint("keystone", "keystone", "admin-api") ks_service_endpoint = get_access_endpoint("keystone", "keystone", "service-api") @@ -137,6 +146,3 @@ keystone_register "Register Compute Endpoint" do endpoint_publicurl nova_api_endpoint["uri"] action :create_endpoint end - -# Include recipe(nova::api-os-compute-monitoring) -include_recipe "nova::api-os-compute-monitoring" diff --git a/recipes/api-os-volume-monitoring.rb b/recipes/api-os-volume-monitoring.rb deleted file mode 100644 index 74cfecdb..00000000 --- a/recipes/api-os-volume-monitoring.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Cookbook Name:: nova -# Recipe:: api-os-volume-monitoring -# -# Copyright 2009, Rackspace Hosting, Inc. -# -# 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. -# - -######################################## -# BEGIN MONIT SECTION -# Allow for enable/disable of monit -if node["enable_monit"] - include_recipe "monit::server" - platform_options = node["nova"]["platform"] - - monit_procmon "nova-api-os-volume" do - process_name "nova-api-os-volume" - start_cmd "/usr/sbin/service " + platform_options["api_os_volume_service"] + " start" - stop_cmd "/usr/sbin/service " + platform_options["api_os_volume_service"] + " stop" - end -end -######################################## diff --git a/recipes/api-os-volume.rb b/recipes/api-os-volume.rb index 864b1902..48f657cd 100644 --- a/recipes/api-os-volume.rb +++ b/recipes/api-os-volume.rb @@ -18,6 +18,7 @@ # include_recipe "nova::nova-common" +include_recipe "monitoring" platform_options = node["nova"]["platform"] @@ -46,6 +47,14 @@ service "nova-api-os-volume" do subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed end +monitoring_procmon "nova-api-os-volume" do + service_name=platform_options["api_os_volume_service"] + + process_name "api-os-volume-service" + start_cmd "/usr/sbin/service #{service_name} start" + stop_cmd "/usr/sbin/service #{service_name} stop" +end + ks_admin_endpoint = get_access_endpoint("keystone", "keystone", "admin-api") ks_service_endpoint = get_access_endpoint("keystone", "keystone", "service-api") keystone = get_settings_by_role("keystone","keystone") @@ -64,6 +73,3 @@ template "/etc/nova/api-paste.ini" do ) notifies :restart, resources(:service => "nova-api-os-volume"), :delayed end - -# Include recipe(nova::api-os-volume-monitoring) -include_recipe "nova::api-os-volume-monitoring" diff --git a/recipes/compute-monitoring.rb b/recipes/compute-monitoring.rb deleted file mode 100644 index 6a9f29bd..00000000 --- a/recipes/compute-monitoring.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Cookbook Name:: nova -# Recipe:: compute-monitoring -# -# Copyright 2009, Rackspace Hosting, Inc. -# -# 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. -# - -######################################## -# BEGIN MONIT SECTION -# Allow for enable/disable of monit -if node["enable_monit"] - include_recipe "monit::server" - platform_options = node["nova"]["platform"] - - monit_procmon "nova-compute" do - process_name "nova-compute" - start_cmd "/usr/sbin/service " + platform_options["nova_compute_service"] + " start" - stop_cmd "/usr/sbin/service " + platform_options["nova_compute_service"] + " stop" - end -end -######################################## diff --git a/recipes/compute.rb b/recipes/compute.rb index 6c83db45..70e58f1b 100644 --- a/recipes/compute.rb +++ b/recipes/compute.rb @@ -20,6 +20,7 @@ include_recipe "nova::nova-common" include_recipe "nova::api-metadata" include_recipe "nova::network" +include_recipe "monitoring" platform_options = node["nova"]["platform"] nova_compute_packages = platform_options["nova_compute_packages"] @@ -52,12 +53,16 @@ service "nova-compute" do subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed end +monitoring_procmon "nova-compute" do + service_name=platform_options["nova_compute_service"] + + process_name "nova-compute" + start_cmd "/usr/sbin/service #{service_name} start" + stop_cmd "/usr/sbin/service #{service_naem} stop" +end + include_recipe "nova::libvirt" -# Include recipe(nova::compute-monitoring) -include_recipe "nova::compute-monitoring" - - # Sysctl tunables sysctl_multi "nova" do instructions "net.ipv4.ip_forward" => "1" diff --git a/recipes/libvirt-monitoring.rb b/recipes/libvirt-monitoring.rb deleted file mode 100644 index bfc93a70..00000000 --- a/recipes/libvirt-monitoring.rb +++ /dev/null @@ -1,60 +0,0 @@ -# -# Cookbook Name:: nova -# Recipe:: libvirt-monitoring -# -# Copyright 2009, Rackspace Hosting, Inc. -# -# 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. -# - -######################################## -# BEGIN COLLECTD SECTION -# Allow for enable/disable of collectd -if get_settings_by_role("collectd-server", "roles") and node["roles"].include?("collectd-client") - include_recipe "collectd-graphite::collectd-client" - - # Figure out which connection type to use for libvirt - nova = get_settings_by_role("single-compute", "nova") - if nova["libvirt"]["virt_type"] == "qemu" - virt_conn = "qemu:///system" - else - # TODO(shep): Not sure this is the right one - virt_conn = "kvm:///" - end - - collectd_plugin "libvirt" do - template "collectd-plugin-libvirt.conf.erb" - cookbook "nova" - options( - "Connection"=>virt_conn, - "HostnameFormat"=>"name", - "RefreshInterval"=>60 - ) - end -end -######################################## - -######################################## -# BEGIN MONIT SECTION -# Allow for enable/disable of monit -if node["enable_monit"] - include_recipe "monit::server" - platform_options = node["nova"]["platform"] - - monit_procmon "libvirt-bin" do - process_name "libvirtd" - start_cmd "/usr/sbin/service " + platform_options["libvirt_service"] + " start" - stop_cmd "/usr/sbin/service " + platform_options["libvirt_service"] + " stop" - end -end -######################################## diff --git a/recipes/libvirt.rb b/recipes/libvirt.rb index de20e220..189f2fc5 100644 --- a/recipes/libvirt.rb +++ b/recipes/libvirt.rb @@ -2,6 +2,22 @@ # Cookbook Name:: openstack # Recipe:: libvirt # +# Copyright 2012, Rackspace Hosting, Inc. +# +# 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. +# + +include_recipe "monitoring" platform_options = node["nova"]["platform"] @@ -28,6 +44,14 @@ service "libvirt-bin" do action :enable end +monitoring_procmon "libvirt-bin" do + service_name=platform_options["libvirt_service"] + + process_name "libvirtd" + start_cmd "/usr/sbin/service #{service_name} start" + stop_cmd "/usr/sbin/service #{service_name} stop" +end + directory "/var/lib/nova/.ssh" do owner "nova" group "nova" @@ -98,5 +122,4 @@ template "/etc/default/libvirt-bin" do notifies :restart, resources(:service => "libvirt-bin"), :immediately end -# Include recipe(nova::libvirt-monitoring) -include_recipe "nova::libvirt-monitoring" +monitoring_metric "libvirt" diff --git a/recipes/network-monitoring.rb b/recipes/network-monitoring.rb deleted file mode 100644 index 5e5ba210..00000000 --- a/recipes/network-monitoring.rb +++ /dev/null @@ -1,34 +0,0 @@ -# -# Cookbook Name:: nova -# Recipe:: network-monitoring -# -# Copyright 2009, Rackspace Hosting, Inc. -# -# 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. -# - -######################################## -# BEGIN MONIT SECTION -# Allow for enable/disable of monit -if node["enable_monit"] - - include_recipe "monit::server" - platform_options = node["nova"]["platform"] - - monit_procmon "nova-network" do - process_name "nova-network" - start_cmd "/usr/sbin/service " + platform_options["nova_network_service"] + " start" - stop_cmd "/usr/sbin/service " + platform_options["nova_network_service"] + " stop" - end -end -######################################## diff --git a/recipes/network.rb b/recipes/network.rb index e40f2b7a..f7bee11f 100644 --- a/recipes/network.rb +++ b/recipes/network.rb @@ -18,6 +18,7 @@ # include_recipe "nova::nova-common" +include_recipe "monitoring" platform_options = node["nova"]["platform"] @@ -35,5 +36,10 @@ service "nova-network" do subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed end -# Include recipe(nova::network-monitoring) -include_recipe "nova::network-monitoring" +monitoring_procmon "nova-network" do + service_name=platform_options["nova_network_service"] + + process_name "nova-network" + start_cmd "/usr/sbin/service #{service_name} start" + stop_cmd "/usr/sbin/service #{service_name} stop" +end diff --git a/recipes/nova-db-monitoring.rb b/recipes/nova-db-monitoring.rb index 09647592..69dd84ad 100644 --- a/recipes/nova-db-monitoring.rb +++ b/recipes/nova-db-monitoring.rb @@ -2,7 +2,7 @@ # Cookbook Name:: nova # Recipe:: nova-db-monitoring # -# Copyright 2009, Rackspace Hosting, Inc. +# Copyright 2012, Rackspace Hosting, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,17 +17,23 @@ # limitations under the License. # -######################################## -# BEGIN MONIT SECTION -# Allow for enable/disable of monit -if node["enable_monit"] - include_recipe "monit::server" - platform_options = node["nova"]["platform"] +include_recipe "osops-utils" +include_recipe "monitoring" - monit_procmon "mysqld" do - process_name "mysqld" - start_cmd "/usr/sbin/service " + platform_options["mysql_service"] + " start" - stop_cmd "/usr/sbin/service " + platform_options["mysql_service"] + " stop" - end +mysql_info = get_settings_by_role("mysql-master", "mysql") + +monitoring_procmon "mysqld" do + service_name = node["nova"]["platform"]["mysql_service"] + + process_name "mysqld" + start_cmd "/usr/sbin/service #{service_name} start" + stop_cmd "/usr/sbin/service #{service_name} stop" +end + +monitoring_metric "mysql" do + host mysql_info["bind_address"] + user node["nova"]["db"]["username"] + password node["nova"]["db"]["password"] + port 3306 + db "nova" end -######################################## diff --git a/recipes/nova-setup-monitoring.rb b/recipes/nova-setup-monitoring.rb deleted file mode 100644 index 48e61960..00000000 --- a/recipes/nova-setup-monitoring.rb +++ /dev/null @@ -1,80 +0,0 @@ -# -# Cookbook Name:: nova -# Recipe:: nova-setup-monitoring -# -# Copyright 2009, Rackspace Hosting, Inc. -# -# 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. -# - -# We'll intentionally split the monitoring recipe from the stock -# nova recipe, in case there are other monitoring systems besides -# collectd that people want to integrate. - -######################################## -# BEGIN COLLECTD SECTION -# Allow for enable/disable of collectd -if get_settings_by_role("collectd-server", "roles") and node["roles"].include?("collectd-client") - include_recipe "collectd-graphite::collectd-client" - - ks_service_endpoint = get_access_endpoint("keystone", "keystone","service-api") - keystone = get_settings_by_role("keystone", "keystone") - keystone_admin_user = keystone["admin_user"] - keystone_admin_password = keystone["users"][keystone_admin_user]["password"] - keystone_admin_tenant = keystone["users"][keystone_admin_user]["default_tenant"] - mysql_info = get_settings_by_role("mysql-master", "mysql") - - # run through each role and find the db usernames and passwords - db_options = {} - rolemap = { - "keystone" => "keystone", - "glance-registry" => "glance", - "horizon-server" => "horizon", - "nova-setup" => "nova" - } - - rolemap.each_pair do |role, key| - attrs = get_settings_by_role(role, key) - if attrs - db_options[attrs["db"]["name"]] = { - :host => mysql_info["bind_address"], - :user => attrs["db"]["username"], - :password => attrs["db"]["password"], - :master_stats => false - } - end - end - - collectd_plugin "mysql" do - template "collectd-plugin-mysql.conf.erb" - cookbook "nova" - options :databases => db_options - end - - cookbook_file File.join(node['collectd']['plugin_dir'], "nova_plugin.py") do - source "nova_plugin.py" - owner "root" - group "root" - mode "0644" - end - - collectd_python_plugin "nova_plugin" do - options( - "Username"=>keystone_admin_user, - "Password"=>keystone_admin_password, - "TenantName"=>keystone_admin_tenant, - "AuthURL"=>ks_service_endpoint["uri"] - ) - end -end -######################################## diff --git a/recipes/nova-setup.rb b/recipes/nova-setup.rb index 1be37d62..cb8db6c6 100644 --- a/recipes/nova-setup.rb +++ b/recipes/nova-setup.rb @@ -19,12 +19,6 @@ ::Chef::Recipe.send(:include, Opscode::OpenSSL::Password) -# FIXME: we need a better identifier that we want to collect -# collectd/graphite info -if get_settings_by_role("collectd-server", "roles") - include_recipe "nova::nova-setup-monitoring" -end - # Allow for using a well known db password if node["developer_mode"] node.set_unless["nova"]["db"]["password"] = "nova" @@ -34,6 +28,13 @@ end include_recipe "nova::nova-common" include_recipe "mysql::client" +include_recipe "monitoring" + +ks_service_endpoint = get_access_endpoint("keystone", "keystone","service-api") +keystone = get_settings_by_role("keystone", "keystone") +keystone_admin_user = keystone["admin_user"] +keystone_admin_password = keystone["users"][keystone_admin_user]["password"] +keystone_admin_tenant = keystone["users"][keystone_admin_user]["default_tenant"] #creates db and user #function defined in osops-utils/libraries @@ -63,3 +64,12 @@ if node.has_key?(:floating) and node["nova"]["network"]["floating"].has_key?(:ip not_if "nova-manage floating list" end end + +monitoring_metric "nova-plugin" do + type "pyscript" + script "nova_plugin.py" + options("Username" => keystone_admin_user, + "Password" => keystone_admin_password, + "TenantName" => keystone_admin_tenant, + "AuthURL" => ks_service_endpoint["uri"]) +end diff --git a/recipes/scheduler-monitoring.rb b/recipes/scheduler-monitoring.rb deleted file mode 100644 index 30c9e1a6..00000000 --- a/recipes/scheduler-monitoring.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Cookbook Name:: nova -# Recipe:: scheduler-monitoring -# -# Copyright 2009, Rackspace Hosting, Inc. -# -# 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. -# - -######################################## -# BEGIN MONIT SECTION -# Allow for enable/disable of monit -if node["enable_monit"] - include_recipe "monit::server" - platform_options = node["nova"]["platform"] - - monit_procmon "nova-scheduler" do - process_name "nova-scheduler" - start_cmd "/usr/sbin/service " + platform_options["nova_scheduler_service"] + " start" - stop_cmd "/usr/sbin/service " + platform_options["nova_scheduler_service"] + " stop" - end -end -######################################## diff --git a/recipes/scheduler.rb b/recipes/scheduler.rb index 15b1766f..f4d01dbe 100644 --- a/recipes/scheduler.rb +++ b/recipes/scheduler.rb @@ -18,6 +18,7 @@ # include_recipe "nova::nova-common" +include_recipe "monitoring" platform_options = node["nova"]["platform"] @@ -42,5 +43,10 @@ service "nova-scheduler" do subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed end -# Include recipe(nova::scheduler-monitoring) -include_recipe "nova::scheduler-monitoring" +monitoring_procmon "nova-scheduler" do + service_name=platform_options["nova_scheduler_service"] + + process_name "nova-scheduler" + start_cmd "/usr/sbin/service #{service_name} start" + stop_cmd "/usr/sbin/service #{service_name} stop" +end diff --git a/recipes/vncproxy-monitoring.rb b/recipes/vncproxy-monitoring.rb deleted file mode 100644 index d876160f..00000000 --- a/recipes/vncproxy-monitoring.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Cookbook Name:: nova -# Recipe:: consoleauth-monitoring -# -# Copyright 2009, Rackspace Hosting, Inc. -# -# 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. -# - -######################################## -# BEGIN MONIT SECTION -# Allow for enable/disable of monit -if node["enable_monit"] - include_recipe "monit::server" - platform_options = node["nova"]["platform"] - - monit_procmon "nova-consoleauth" do - process_name "nova-consoleauth" - start_cmd "/usr/sbin/service " + platform_options["nova_vncproxy_consoleauth_service"] + " start" - stop_cmd "/usr/sbin/service " + platform_options["nova_vncproxy_consoleauth_service"] + " stop" - end -end -######################################## diff --git a/recipes/vncproxy.rb b/recipes/vncproxy.rb index 97bde770..c4265926 100644 --- a/recipes/vncproxy.rb +++ b/recipes/vncproxy.rb @@ -18,6 +18,7 @@ # include_recipe "nova::nova-common" +include_recipe "monitoring" platform_options = node["nova"]["platform"] @@ -51,6 +52,14 @@ when "ubuntu","debian" subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed end + monitoring_procmon "nova-vncproxy" do + service_name=platform_options["nova_vncproxy_service"] + + process_name "nova-vncproxy" + start_cmd "/usr/sbin/service #{service_name} start" + stop_cmd "/usr/sbin/service #{service_name} stop" + end + service "nova-consoleauth" do # TODO(breu): remove the platform specifier when fedora fixes their vncproxy package service_name platform_options["nova_vncproxy_consoleauth_service"] @@ -59,6 +68,11 @@ when "ubuntu","debian" subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed end - # Include recipe(nova::vncproxy-monitoring) - include_recipe "nova::vncproxy-monitoring" + monitoring_procmon "nova-consoleauth" do + service_name=platform_options["nova_vncproxy_consoleauth_service"] + + process_name "nova-consoleauth" + start_cmd "/usr/sbin/service #{service_name} start" + stop_cmd "/usr/sbin/service #{service_name} stop" + end end diff --git a/recipes/volume-monitoring.rb b/recipes/volume-monitoring.rb deleted file mode 100644 index a0dcef72..00000000 --- a/recipes/volume-monitoring.rb +++ /dev/null @@ -1,33 +0,0 @@ -# -# Cookbook Name:: nova -# Recipe:: volume-monitoring -# -# Copyright 2009, Rackspace Hosting, Inc. -# -# 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. -# - -######################################## -# BEGIN MONIT SECTION -# Allow for enable/disable of monit -if node["enable_monit"] - include_recipe "monit::server" - platform_options = node["nova"]["platform"] - - monit_procmon "nova-volume" do - process_name "nova-volume" - start_cmd "/usr/sbin/service " + platform_options["nova_volume_service"] + " start" - stop_cmd "/usr/sbin/service " + platform_options["nova_volume_service"] + " stop" - end -end -######################################## diff --git a/recipes/volume.rb b/recipes/volume.rb index 2570a64b..02c071c7 100644 --- a/recipes/volume.rb +++ b/recipes/volume.rb @@ -5,6 +5,7 @@ include_recipe "nova::nova-common" include_recipe "nova::api-os-volume" +include_recipe "monitoring" platform_options = node["nova"]["platform"] @@ -26,6 +27,17 @@ service "nova-volume" do subscribes :restart, resources(:template => "/etc/nova/nova.conf"), :delayed end +# TODO(rp): need the flag on whether or not to start nova-volume service +# this is already on backlog +# monitoring_procmon "nova-volume" do +# service_name=platform_options["nova_volume_service"] + +# process_name "nova-volume" +# start_cmd "/usr/sbin/service #{service_naem} start" +# stop_cmd "/usr/sbin/service #{service_naem} stop" +# end + + ks_admin_endpoint = get_access_endpoint("keystone", "keystone", "admin-api") ks_service_endpoint = get_access_endpoint("keystone", "keystone", "service-api") keystone = get_settings_by_role("keystone","keystone") @@ -58,6 +70,3 @@ keystone_register "Register Volume Endpoint" do endpoint_publicurl volume_endpoint["uri"] action :create_endpoint end - -# TODO(shep): Commenting out until we add volume support" -# include_recipe "nova::volume-monitoring"