added ceilometer recipes

This commit is contained in:
John Tran 2012-12-04 08:33:02 +00:00
parent b103532b4e
commit a9e5e3b142
8 changed files with 254 additions and 0 deletions

View File

@ -0,0 +1,3 @@
{
"context_is_admin": [["role:admin"]]
}

View File

@ -26,6 +26,7 @@ end
depends "database"
depends "glance"
depends "keystone"
depends "mongodb"
depends "mysql"
depends "openstack-utils"
depends "openstack-common", ">= 0.1.4"
@ -33,3 +34,4 @@ depends "rabbitmq"
depends "selinux"
depends "sysctl"
depends "yum"
depends "python"

View File

@ -0,0 +1,34 @@
#
# Cookbook Name:: nova
# Recipe:: ceilometer-agent-central
#
# Copyright 2012, AT&T
#
# 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.
#
class ::Chef::Recipe
include ::Openstack
end
include_recipe "nova::ceilometer-common"
bindir = '/usr/local/bin'
conf_switch = '--config-file /etc/ceilometer/ceilometer.conf'
service "ceilometer-agent-central" do
service_name "ceilometer-agent-central"
action [:enable, :start]
start_command "nohup #{bindir}/ceilometer-agent-central #{conf_switch} &"
stop_command "pkill -f ceilometer-agent-central"
end

View File

@ -0,0 +1,34 @@
#
# Cookbook Name:: nova
# Recipe:: ceilometer-agent-compute
#
# Copyright 2012, AT&T
#
# 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.
#
class ::Chef::Recipe
include ::Openstack
end
include_recipe "nova::ceilometer-common"
bindir = '/usr/local/bin'
conf_switch = '--config-file /etc/ceilometer/ceilometer.conf'
service "ceilometer-agent-compute" do
service_name "ceilometer-agent-compute"
action [:enable, :start]
start_command "nohup #{bindir}/ceilometer-agent-compute #{conf_switch}&"
stop_command "pkill -f ceilometer-agent-compute"
end

35
recipes/ceilometer-api.rb Normal file
View File

@ -0,0 +1,35 @@
#
# Cookbook Name:: nova
# Recipe:: ceilometer-api
#
# Copyright 2012, AT&T
#
# 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.
#
class ::Chef::Recipe
include ::Openstack
end
include_recipe "nova::ceilometer-common"
bindir = '/usr/local/bin'
logdir = '/var/log/ceilometer-api'
conf_switch = '--config-file /etc/ceilometer/ceilometer.conf'
service "ceilometer-api" do
service_name "ceilometer-api"
action [:enable, :start]
start_command "nohup #{bindir}/ceilometer-api -d --log-dir=#{logdir} #{conf_switch} &"
stop_command "pkill -f ceilometer-api"
end

View File

@ -0,0 +1,34 @@
#
# Cookbook Name:: nova
# Recipe:: ceilometer-collector
#
# Copyright 2012, AT&T
#
# 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.
#
class ::Chef::Recipe
include ::Openstack
end
include_recipe "nova::ceilometer-common"
bindir = '/usr/local/bin'
conf_switch = '--config-file /etc/ceilometer/ceilometer.conf'
service "ceilometer-collector" do
service_name "ceilometer-collector"
action [:enable, :start]
start_command "nohup #{bindir}/ceilometer-collector #{conf_switch} &"
stop_command "pkill -f ceilometer-collector"
end

View File

@ -0,0 +1,93 @@
#
# Cookbook Name:: nova
# Recipe:: ceilometer-common
#
# Copyright 2012, AT&T
#
# 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.
#
class ::Chef::Recipe
include ::Openstack
end
include_recipe "mongodb"
include_recipe "nova::nova-common"
include_recipe "python::pip"
api_logdir = '/var/log/ceilometer-api'
nova_owner = node["nova"]["user"]
nova_group = node["nova"]["group"]
directory api_logdir do
owner nova_owner
group nova_group
mode 00755
action :create
end
python_pip "ceilometer" do
action :install
end
directory "/etc/ceilometer" do
owner nova_owner
group nova_group
mode 00755
action :create
end
rabbit_server_role = node["nova"]["rabbit_server_chef_role"]
rabbit_info = config_by_role rabbit_server_role, "queue"
nova_setup_role = node["nova"]["nova_setup_chef_role"]
nova_setup_info = config_by_role nova_setup_role, "nova"
db_user = node['nova']['db']['username']
db_pass = db_password "nova"
sql_connection = db_uri("compute", db_user, db_pass)
keystone_service_role = node["nova"]["keystone_service_chef_role"]
keystone = config_by_role keystone_service_role, "keystone"
# find the node attribute endpoint settings for the server holding a given role
identity_admin_endpoint = endpoint "identity-admin"
Chef::Log.debug("nova::ceilometer-common:rabbit_info|#{rabbit_info}")
Chef::Log.debug("nova::ceilometer-common:keystone|#{keystone}")
Chef::Log.debug("nova::ceilometer-common:identity_admin_endpoint|#{identity_admin_endpoint.to_s}")
template "/etc/ceilometer/ceilometer.conf" do
source "ceilometer.conf.erb"
owner nova_owner
group nova_group
mode 00644
variables(
:sql_connection => sql_connection,
:rabbit_ipaddress => rabbit_info["host"],
:rabbit_port => rabbit_info["port"],
:user => keystone["admin_user"],
:tenant => keystone["users"][keystone["admin_user"]]["default_tenant"],
:password => keystone["users"][keystone["admin_user"]]["password"],
:identity_admin_endpoint => identity_admin_endpoint
)
end
cookbook_file "/etc/ceilometer/policy.json" do
source "policy.json"
mode 0755
owner nova_owner
group nova_group
end

View File

@ -0,0 +1,19 @@
[DEFAULT]
os_auth_url = <%= @identity_admin_endpoint %>
os_tenant_name = <%= @tenant %>
os_password = <%= @password %>
os_username = <%= @user %>
policy_file = /etc/ceilometer/policy.json
sql_connection = <%= @sql_connection %>
rabbit_password = guest
rabbit_port = <%= @rabbit_port %>
rabbit_host = <%= @rabbit_ipaddress %>
verbose = True
notification_topics = notifications,glance_notifications
rpc_backend = ceilometer.openstack.common.rpc.impl_kombu
[keystone_authtoken]
admin_tenant_name = <%= @tenant %>
admin_password = <%= @password %>
admin_user = <%= @user %>
auth_protocol = <%= @identity_endpoint.scheme %>