From fc302f95508efceb995d5408a1cd276a089e4ac9 Mon Sep 17 00:00:00 2001 From: "Luis A. Garcia" Date: Wed, 26 Mar 2014 00:04:16 +0000 Subject: [PATCH] Add recipes for alarm services The telemetry cookbook currently lacks recipes for the alarm and the agent notification services. This patch adds them as well as their corresponding specs and documentation. Implements blueprint alarm-sevices Change-Id: I2896db6e95f52f4488ec8bb9bcb88c697cb712b6 --- CHANGELOG.md | 5 +++++ README.md | 12 +++++++++++ attributes/default.rb | 19 +++++++++++++++++ metadata.rb | 5 ++++- recipes/agent-notification.rb | 31 ++++++++++++++++++++++++++++ recipes/alarm-evaluator.rb | 31 ++++++++++++++++++++++++++++ recipes/alarm-notifier.rb | 31 ++++++++++++++++++++++++++++ spec/agent-notification-rhel_spec.rb | 22 ++++++++++++++++++++ spec/agent-notification-suse_spec.rb | 21 +++++++++++++++++++ spec/agent-notification_spec.rb | 22 ++++++++++++++++++++ spec/alarm-evaluator-rhel_spec.rb | 22 ++++++++++++++++++++ spec/alarm-evaluator-suse_spec.rb | 21 +++++++++++++++++++ spec/alarm-evaluator_spec.rb | 22 ++++++++++++++++++++ spec/alarm-notifier-rhel_spec.rb | 22 ++++++++++++++++++++ spec/alarm-notifier-suse_spec.rb | 21 +++++++++++++++++++ spec/alarm-notifier_spec.rb | 22 ++++++++++++++++++++ 16 files changed, 328 insertions(+), 1 deletion(-) create mode 100644 recipes/agent-notification.rb create mode 100644 recipes/alarm-evaluator.rb create mode 100644 recipes/alarm-notifier.rb create mode 100644 spec/agent-notification-rhel_spec.rb create mode 100644 spec/agent-notification-suse_spec.rb create mode 100644 spec/agent-notification_spec.rb create mode 100644 spec/alarm-evaluator-rhel_spec.rb create mode 100644 spec/alarm-evaluator-suse_spec.rb create mode 100644 spec/alarm-evaluator_spec.rb create mode 100644 spec/alarm-notifier-rhel_spec.rb create mode 100644 spec/alarm-notifier-suse_spec.rb create mode 100644 spec/alarm-notifier_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 6513acc..a2ac087 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ openstack-telemetry Cookbook CHANGELG ============================== This file is used to list changes made in each version of the openstack-metering cookbook. +## 9.1.0 +### Blue print +# Add recipes for the ceilometer alarm services (alarm-services) +# Add recipes for the ceilometer agent notification service (alarm-services) + ## 9.0.0 * Upgrade to Icehouse diff --git a/README.md b/README.md index 8f125d9..9a18e70 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,18 @@ agent-compute ---- - Installs agent compute service. +agent-notification +---- +- Installs agent notification service. + +alarm-evaluator +---- +- Installs alarm evaluator service. + +alarm-notifier +---- +- Installs alarm notifier service. + api ---- - Installs API service. diff --git a/attributes/default.rb b/attributes/default.rb index 31dfd82..e6eb3c5 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -57,12 +57,19 @@ when 'suse' # :pragma-foodcritic: ~FC024 - won't fix this 'agent_central_service' => 'openstack-ceilometer-agent-central', 'agent_compute_packages' => ['openstack-ceilometer-agent-compute'], 'agent_compute_service' => 'openstack-ceilometer-agent-compute', + 'agent_notification_packages' => ['openstack-ceilometer-agent-notification'], + 'agent_notification_service' => 'openstack-ceilometer-agent-notification', + 'alarm_evaluator_packages' => ['openstack-ceilometer-alarm-evaluator'], + 'alarm_evaluator_service' => 'openstack-ceilometer-alarm-evaluator', + 'alarm_notifier_packages' => ['openstack-ceilometer-alarm-notifier'], + 'alarm_notifier_service' => 'openstack-ceilometer-alarm-notifier', 'api_packages' => ['openstack-ceilometer-api'], 'api_service' => 'openstack-ceilometer-api', 'client_packages' => ['python-ceilometerclient'], 'collector_packages' => ['openstack-ceilometer-collector'], 'collector_service' => 'openstack-ceilometer-collector' } + when 'fedora', 'redhat', 'centos' default['openstack']['telemetry']['platform'] = { 'common_packages' => ['openstack-ceilometer-common'], @@ -70,6 +77,12 @@ when 'fedora', 'redhat', 'centos' 'agent_central_service' => 'openstack-ceilometer-central', 'agent_compute_packages' => ['openstack-ceilometer-compute'], 'agent_compute_service' => 'openstack-ceilometer-compute', + 'agent_notification_packages' => ['openstack-ceilometer-collector'], + 'agent_notification_service' => 'openstack-ceilometer-notification', + 'alarm_evaluator_packages' => ['openstack-ceilometer-alarm'], + 'alarm_evaluator_service' => 'openstack-ceilometer-alarm-evaluator', + 'alarm_notifier_packages' => ['openstack-ceilometer-alarm'], + 'alarm_notifier_service' => 'openstack-ceilometer-alarm-notifier', 'api_packages' => ['openstack-ceilometer-api'], 'api_service' => 'openstack-ceilometer-api', 'client_packages' => ['python-ceilometerclient'], @@ -84,6 +97,12 @@ when 'ubuntu' 'agent_central_service' => 'ceilometer-agent-central', 'agent_compute_packages' => ['ceilometer-agent-compute'], 'agent_compute_service' => 'ceilometer-agent-compute', + 'agent_notification_packages' => ['ceilometer-agent-notification'], + 'agent_notification_service' => 'ceilometer-agent-notification', + 'alarm_evaluator_packages' => ['ceilometer-alarm-evaluator'], + 'alarm_evaluator_service' => 'ceilometer-alarm-evaluator', + 'alarm_notifier_packages' => ['ceilometer-alarm-notifier'], + 'alarm_notifier_service' => 'ceilometer-alarm-notifier', 'api_packages' => ['ceilometer-api'], 'api_service' => 'ceilometer-api', 'client_packages' => ['python-ceilometerclient'], diff --git a/metadata.rb b/metadata.rb index 203b29e..139001b 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,13 +4,16 @@ maintainer_email 'cookbooks@lists.tfoundry.com' license 'Apache 2.0' description 'The OpenStack Metering service Ceilometer.' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '9.0.0' +version '9.1.0' recipe 'openstack-telemetry::agent-central', 'Installs agent central service.' recipe 'openstack-telemetry::agent-compute', 'Installs agent compute service.' +recipe 'openstack-telemetry::agent-notification', 'Installs the agent notification service.' recipe 'openstack-telemetry::api', 'Installs API service.' recipe 'openstack-telemetry::client', 'Installs client.' recipe 'openstack-telemetry::collector', 'Installs collector service. If the NoSQL database is used for metering service, ceilometer-dbsync will not be executed.' +recipe 'openstack-telemetry::alarm-evaluator', 'Installs the alarm evaluator service.' +recipe 'openstack-telemetry::alarm-notifier', 'Installs the alarm notifier service.' recipe 'openstack-telemetry::common', 'Common metering configuration.' recipe 'openstack-telemetry::identity_registration', 'Registers the endpoints, tenant and user for metering service with Keystone' diff --git a/recipes/agent-notification.rb b/recipes/agent-notification.rb new file mode 100644 index 0000000..19e3c0a --- /dev/null +++ b/recipes/agent-notification.rb @@ -0,0 +1,31 @@ +# encoding: UTF-8 +# +# Cookbook Name:: openstack-telemetry +# Recipe:: agent-notification +# +# Copyright 2014, IBM Corp. +# +# 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 'openstack-telemetry::common' + +platform = node['openstack']['telemetry']['platform'] +platform['agent_notification_packages'].each do |pkg| + package pkg +end + +service platform['agent_notification_service'] do + supports status: true, restart: true + action :start +end diff --git a/recipes/alarm-evaluator.rb b/recipes/alarm-evaluator.rb new file mode 100644 index 0000000..aa40394 --- /dev/null +++ b/recipes/alarm-evaluator.rb @@ -0,0 +1,31 @@ +# encoding: UTF-8 +# +# Cookbook Name:: openstack-telemetry +# Recipe:: alarm-evaluator +# +# Copyright 2014, IBM Corp. +# +# 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 'openstack-telemetry::common' + +platform = node['openstack']['telemetry']['platform'] +platform['alarm_evaluator_packages'].each do |pkg| + package pkg +end + +service platform['alarm_evaluator_service'] do + supports status: true, restart: true + action :start +end diff --git a/recipes/alarm-notifier.rb b/recipes/alarm-notifier.rb new file mode 100644 index 0000000..7b0644d --- /dev/null +++ b/recipes/alarm-notifier.rb @@ -0,0 +1,31 @@ +# encoding: UTF-8 +# +# Cookbook Name:: openstack-telemetry +# Recipe:: alarm-notifier +# +# Copyright 2014, IBM Corp. +# +# 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 'openstack-telemetry::common' + +platform = node['openstack']['telemetry']['platform'] +platform['alarm_notifier_packages'].each do |pkg| + package pkg +end + +service platform['alarm_notifier_service'] do + supports status: true, restart: true + action :start +end diff --git a/spec/agent-notification-rhel_spec.rb b/spec/agent-notification-rhel_spec.rb new file mode 100644 index 0000000..ee78b9a --- /dev/null +++ b/spec/agent-notification-rhel_spec.rb @@ -0,0 +1,22 @@ +# encoding: UTF-8 + +require_relative 'spec_helper' + +describe 'openstack-telemetry::agent-notification' do + describe 'rhel' do + let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) } + let(:node) { runner.node } + let(:chef_run) { runner.converge(described_recipe) } + + include_context 'telemetry-stubs' + include_examples 'expect-runs-common-recipe' + + it 'installs the agent-notification package' do + expect(chef_run).to install_package 'openstack-ceilometer-collector' + end + + it 'starts the agent-notification service' do + expect(chef_run).to start_service 'openstack-ceilometer-notification' + end + end +end diff --git a/spec/agent-notification-suse_spec.rb b/spec/agent-notification-suse_spec.rb new file mode 100644 index 0000000..deeb877 --- /dev/null +++ b/spec/agent-notification-suse_spec.rb @@ -0,0 +1,21 @@ +# encoding: UTF-8 + +require_relative 'spec_helper' + +describe 'openstack-telemetry::agent-notification' do + describe 'suse' do + let(:runner) { ChefSpec::Runner.new(SUSE_OPTS) } + let(:node) { runner.node } + let(:chef_run) { runner.converge(described_recipe) } + + include_context 'telemetry-stubs' + + it 'installs the agent-notification package' do + expect(chef_run).to install_package 'openstack-ceilometer-agent-notification' + end + + it 'starts the agent-notification service' do + expect(chef_run).to start_service 'openstack-ceilometer-agent-notification' + end + end +end diff --git a/spec/agent-notification_spec.rb b/spec/agent-notification_spec.rb new file mode 100644 index 0000000..fa94933 --- /dev/null +++ b/spec/agent-notification_spec.rb @@ -0,0 +1,22 @@ +# encoding: UTF-8 + +require_relative 'spec_helper' + +describe 'openstack-telemetry::agent-notification' do + describe 'ubuntu' do + let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) } + let(:node) { runner.node } + let(:chef_run) { runner.converge(described_recipe) } + + include_context 'telemetry-stubs' + include_examples 'expect-runs-common-recipe' + + it 'installs the agent-notification package' do + expect(chef_run).to install_package 'ceilometer-agent-notification' + end + + it 'starts ceilometer-agent-notification service' do + expect(chef_run).to start_service('ceilometer-agent-notification') + end + end +end diff --git a/spec/alarm-evaluator-rhel_spec.rb b/spec/alarm-evaluator-rhel_spec.rb new file mode 100644 index 0000000..cdc21fa --- /dev/null +++ b/spec/alarm-evaluator-rhel_spec.rb @@ -0,0 +1,22 @@ +# encoding: UTF-8 + +require_relative 'spec_helper' + +describe 'openstack-telemetry::alarm-evaluator' do + describe 'rhel' do + let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) } + let(:node) { runner.node } + let(:chef_run) { runner.converge(described_recipe) } + + include_context 'telemetry-stubs' + include_examples 'expect-runs-common-recipe' + + it 'installs the alarm-evaluator package' do + expect(chef_run).to install_package 'openstack-ceilometer-alarm' + end + + it 'starts the alarm-evaluator service' do + expect(chef_run).to start_service 'openstack-ceilometer-alarm-evaluator' + end + end +end diff --git a/spec/alarm-evaluator-suse_spec.rb b/spec/alarm-evaluator-suse_spec.rb new file mode 100644 index 0000000..680f1d7 --- /dev/null +++ b/spec/alarm-evaluator-suse_spec.rb @@ -0,0 +1,21 @@ +# encoding: UTF-8 + +require_relative 'spec_helper' + +describe 'openstack-telemetry::alarm-evaluator' do + describe 'suse' do + let(:runner) { ChefSpec::Runner.new(SUSE_OPTS) } + let(:node) { runner.node } + let(:chef_run) { runner.converge(described_recipe) } + + include_context 'telemetry-stubs' + + it 'installs the alarm-evaluator package' do + expect(chef_run).to install_package 'openstack-ceilometer-alarm-evaluator' + end + + it 'starts the alarm-evaluator service' do + expect(chef_run).to start_service 'openstack-ceilometer-alarm-evaluator' + end + end +end diff --git a/spec/alarm-evaluator_spec.rb b/spec/alarm-evaluator_spec.rb new file mode 100644 index 0000000..36a5b9b --- /dev/null +++ b/spec/alarm-evaluator_spec.rb @@ -0,0 +1,22 @@ +# encoding: UTF-8 + +require_relative 'spec_helper' + +describe 'openstack-telemetry::alarm-evaluator' do + describe 'ubuntu' do + let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) } + let(:node) { runner.node } + let(:chef_run) { runner.converge(described_recipe) } + + include_context 'telemetry-stubs' + include_examples 'expect-runs-common-recipe' + + it 'installs the alarm-evaluator package' do + expect(chef_run).to install_package 'ceilometer-alarm-evaluator' + end + + it 'starts alarm-evaluator service' do + expect(chef_run).to start_service('ceilometer-alarm-evaluator') + end + end +end diff --git a/spec/alarm-notifier-rhel_spec.rb b/spec/alarm-notifier-rhel_spec.rb new file mode 100644 index 0000000..97c7822 --- /dev/null +++ b/spec/alarm-notifier-rhel_spec.rb @@ -0,0 +1,22 @@ +# encoding: UTF-8 + +require_relative 'spec_helper' + +describe 'openstack-telemetry::alarm-notifier' do + describe 'rhel' do + let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) } + let(:node) { runner.node } + let(:chef_run) { runner.converge(described_recipe) } + + include_context 'telemetry-stubs' + include_examples 'expect-runs-common-recipe' + + it 'installs the alarm-notifier package' do + expect(chef_run).to install_package 'openstack-ceilometer-alarm' + end + + it 'starts the alarm-notifier service' do + expect(chef_run).to start_service 'openstack-ceilometer-alarm-notifier' + end + end +end diff --git a/spec/alarm-notifier-suse_spec.rb b/spec/alarm-notifier-suse_spec.rb new file mode 100644 index 0000000..9e825f9 --- /dev/null +++ b/spec/alarm-notifier-suse_spec.rb @@ -0,0 +1,21 @@ +# encoding: UTF-8 + +require_relative 'spec_helper' + +describe 'openstack-telemetry::alarm-notifier' do + describe 'suse' do + let(:runner) { ChefSpec::Runner.new(SUSE_OPTS) } + let(:node) { runner.node } + let(:chef_run) { runner.converge(described_recipe) } + + include_context 'telemetry-stubs' + + it 'installs the alarm-notifier package' do + expect(chef_run).to install_package 'openstack-ceilometer-alarm-notifier' + end + + it 'starts the alarm-notifier service' do + expect(chef_run).to start_service 'openstack-ceilometer-alarm-notifier' + end + end +end diff --git a/spec/alarm-notifier_spec.rb b/spec/alarm-notifier_spec.rb new file mode 100644 index 0000000..3ba19a8 --- /dev/null +++ b/spec/alarm-notifier_spec.rb @@ -0,0 +1,22 @@ +# encoding: UTF-8 + +require_relative 'spec_helper' + +describe 'openstack-telemetry::alarm-notifier' do + describe 'ubuntu' do + let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) } + let(:node) { runner.node } + let(:chef_run) { runner.converge(described_recipe) } + + include_context 'telemetry-stubs' + include_examples 'expect-runs-common-recipe' + + it 'installs the alarm-notifier package' do + expect(chef_run).to install_package 'ceilometer-alarm-notifier' + end + + it 'starts alarm-notifier service' do + expect(chef_run).to start_service('ceilometer-alarm-notifier') + end + end +end