Implement notification agent service
In Icehouse, ceilometer-agent-notification is a new service which splits ceilometer-collector responsibilites. implement blueprint ceilometer-agent-notification Change-Id: Iccc660814991e30b12a884a6e6ffd4f581c768c4 Signed-off-by: Emilien Macchi <emilien.macchi@enovance.com>
This commit is contained in:
parent
a86e117b1b
commit
db81d776f1
@ -63,4 +63,8 @@ node default {
|
||||
time_to_live => '2592000'
|
||||
}
|
||||
|
||||
# Install notification agent
|
||||
class { 'ceilometer::agent::notification':
|
||||
}
|
||||
|
||||
}
|
||||
|
74
manifests/agent/notification.pp
Normal file
74
manifests/agent/notification.pp
Normal file
@ -0,0 +1,74 @@
|
||||
#
|
||||
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
|
||||
#
|
||||
# Author: Emilien Macchi <emilien.macchi@enovance.com>
|
||||
#
|
||||
# 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: ceilometer::agent::notification
|
||||
#
|
||||
# Configure the ceilometer notification agent.
|
||||
# This configures the plugin for the API server, but does nothing
|
||||
# about configuring the agents that must also run and share a config
|
||||
# file with the OVS plugin if both are on the same machine.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*enabled*]
|
||||
# (optional) Should the service be started or not
|
||||
# Defaults to true
|
||||
#
|
||||
# [*ack_on_event_error*]
|
||||
# (optional) Acknowledge message when event persistence fails.
|
||||
# Defaults to true
|
||||
#
|
||||
# [*store_events*]
|
||||
# (optional) Save event details.
|
||||
# Defaults to false
|
||||
#
|
||||
|
||||
class ceilometer::agent::notification (
|
||||
$enabled = true,
|
||||
$ack_on_event_error = true,
|
||||
$store_events = false
|
||||
) {
|
||||
|
||||
include ceilometer::params
|
||||
|
||||
Ceilometer_config<||> ~> Service['ceilometer-agent-notification']
|
||||
|
||||
Package[$::ceilometer::params::agent_notification_package_name] -> Service['ceilometer-agent-notification']
|
||||
Package[$::ceilometer::params::agent_notification_package_name] -> Package<| title == 'ceilometer-agent-notification' |>
|
||||
ensure_packages($::ceilometer::params::agent_notification_package_name)
|
||||
|
||||
if $enabled {
|
||||
$service_ensure = 'running'
|
||||
} else {
|
||||
$service_ensure = 'stopped'
|
||||
}
|
||||
|
||||
Package['ceilometer-common'] -> Service['ceilometer-agent-notification']
|
||||
service { 'ceilometer-agent-notification':
|
||||
ensure => $service_ensure,
|
||||
name => $::ceilometer::params::agent_notification_service_name,
|
||||
enable => $enabled,
|
||||
hasstatus => true,
|
||||
hasrestart => true
|
||||
}
|
||||
|
||||
ceilometer_config {
|
||||
'notification/ack_on_event_error': value => $ack_on_event_error;
|
||||
'notification/store_events' : value => $store_events;
|
||||
}
|
||||
|
||||
}
|
@ -12,11 +12,8 @@ class ceilometer::collector (
|
||||
|
||||
Ceilometer_config<||> ~> Service['ceilometer-collector']
|
||||
|
||||
Package['ceilometer-collector'] -> Service['ceilometer-collector']
|
||||
package { 'ceilometer-collector':
|
||||
ensure => installed,
|
||||
name => $::ceilometer::params::collector_package_name,
|
||||
}
|
||||
Package[$::ceilometer::params::collector_package_name] -> Service['ceilometer-collector']
|
||||
ensure_packages($::ceilometer::params::collector_package_name)
|
||||
|
||||
if $enabled {
|
||||
$service_ensure = 'running'
|
||||
|
@ -9,22 +9,25 @@ class ceilometer::params {
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
# package names
|
||||
$agent_central_package_name = 'openstack-ceilometer-central'
|
||||
$agent_compute_package_name = 'openstack-ceilometer-compute'
|
||||
$api_package_name = 'openstack-ceilometer-api'
|
||||
$collector_package_name = 'openstack-ceilometer-collector'
|
||||
$alarm_package_name = ['openstack-ceilometer-alarm']
|
||||
$common_package_name = 'openstack-ceilometer-common'
|
||||
$client_package_name = 'python-ceilometerclient'
|
||||
$agent_central_package_name = 'openstack-ceilometer-central'
|
||||
$agent_compute_package_name = 'openstack-ceilometer-compute'
|
||||
$api_package_name = 'openstack-ceilometer-api'
|
||||
$collector_package_name = 'openstack-ceilometer-collector'
|
||||
$agent_notification_package_name = 'openstack-ceilometer-collector'
|
||||
# notification agent is included in collector package:
|
||||
$alarm_package_name = ['openstack-ceilometer-alarm']
|
||||
$common_package_name = 'openstack-ceilometer-common'
|
||||
$client_package_name = 'python-ceilometerclient'
|
||||
# service names
|
||||
$agent_central_service_name = 'openstack-ceilometer-central'
|
||||
$agent_compute_service_name = 'openstack-ceilometer-compute'
|
||||
$api_service_name = 'openstack-ceilometer-api'
|
||||
$collector_service_name = 'openstack-ceilometer-collector'
|
||||
$alarm_notifier_service_name = 'openstack-ceilometer-alarm-notifier'
|
||||
$alarm_evaluator_service_name = 'openstack-ceilometer-alarm-evaluator'
|
||||
$pymongo_package_name = 'python-pymongo'
|
||||
$psycopg_package_name = 'python-psycopg2'
|
||||
$agent_central_service_name = 'openstack-ceilometer-central'
|
||||
$agent_compute_service_name = 'openstack-ceilometer-compute'
|
||||
$api_service_name = 'openstack-ceilometer-api'
|
||||
$collector_service_name = 'openstack-ceilometer-collector'
|
||||
$agent_notification_service_name = 'openstack-ceilometer-agent-notification'
|
||||
$alarm_notifier_service_name = 'openstack-ceilometer-alarm-notifier'
|
||||
$alarm_evaluator_service_name = 'openstack-ceilometer-alarm-evaluator'
|
||||
$pymongo_package_name = 'python-pymongo'
|
||||
$psycopg_package_name = 'python-psycopg2'
|
||||
# db packages
|
||||
if $::operatingsystem == 'Fedora' and $::operatingsystemrelease >= 18 {
|
||||
# fallback to stdlib version, not provided on fedora
|
||||
@ -36,24 +39,26 @@ class ceilometer::params {
|
||||
}
|
||||
'Debian': {
|
||||
# package names
|
||||
$agent_central_package_name = 'ceilometer-agent-central'
|
||||
$agent_compute_package_name = 'ceilometer-agent-compute'
|
||||
$api_package_name = 'ceilometer-api'
|
||||
$collector_package_name = 'ceilometer-collector'
|
||||
$common_package_name = 'ceilometer-common'
|
||||
$client_package_name = 'python-ceilometerclient'
|
||||
$alarm_package_name = ['ceilometer-alarm-notifier','ceilometer-alarm-evaluator']
|
||||
$agent_central_package_name = 'ceilometer-agent-central'
|
||||
$agent_compute_package_name = 'ceilometer-agent-compute'
|
||||
$api_package_name = 'ceilometer-api'
|
||||
$collector_package_name = 'ceilometer-collector'
|
||||
$agent_notification_package_name = 'ceilometer-agent-notification'
|
||||
$common_package_name = 'ceilometer-common'
|
||||
$client_package_name = 'python-ceilometerclient'
|
||||
$alarm_package_name = ['ceilometer-alarm-notifier','ceilometer-alarm-evaluator']
|
||||
# service names
|
||||
$agent_central_service_name = 'ceilometer-agent-central'
|
||||
$agent_compute_service_name = 'ceilometer-agent-compute'
|
||||
$api_service_name = 'ceilometer-api'
|
||||
$collector_service_name = 'ceilometer-collector'
|
||||
$alarm_notifier_service_name = 'ceilometer-alarm-notifier'
|
||||
$alarm_evaluator_service_name = 'ceilometer-alarm-evaluator'
|
||||
$agent_central_service_name = 'ceilometer-agent-central'
|
||||
$agent_compute_service_name = 'ceilometer-agent-compute'
|
||||
$collector_service_name = 'ceilometer-collector'
|
||||
$api_service_name = 'ceilometer-api'
|
||||
$agent_notification_service_name = 'ceilometer-agent-notification'
|
||||
$alarm_notifier_service_name = 'ceilometer-alarm-notifier'
|
||||
$alarm_evaluator_service_name = 'ceilometer-alarm-evaluator'
|
||||
# db packages
|
||||
$psycopg_package_name = 'python-psycopg2'
|
||||
$pymongo_package_name = 'python-pymongo'
|
||||
$sqlite_package_name = 'python-pysqlite2'
|
||||
$pymongo_package_name = 'python-pymongo'
|
||||
$psycopg_package_name = 'python-psycopg2'
|
||||
$sqlite_package_name = 'python-pysqlite2'
|
||||
|
||||
# Operating system specific
|
||||
case $::operatingsystem {
|
||||
|
85
spec/classes/ceilometer_agent_notification_spec.rb
Normal file
85
spec/classes/ceilometer_agent_notification_spec.rb
Normal file
@ -0,0 +1,85 @@
|
||||
#
|
||||
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
|
||||
#
|
||||
# Author: Emilien Macchi <emilien.macchi@enovance.com>
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# Unit tests for ceilometer::agent::notification
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'ceilometer::agent::notification' do
|
||||
|
||||
let :pre_condition do
|
||||
"class { 'ceilometer': metering_secret => 's3cr3t' }"
|
||||
end
|
||||
|
||||
let :params do
|
||||
{ :ack_on_event_error => true,
|
||||
:store_events => false }
|
||||
end
|
||||
|
||||
shared_examples_for 'ceilometer-agent-notification' do
|
||||
|
||||
it { should contain_class('ceilometer::params') }
|
||||
|
||||
it 'installs ceilometer agent notification package' do
|
||||
should contain_package(platform_params[:agent_notification_package_name])
|
||||
end
|
||||
|
||||
it 'configures ceilometer agent notification service' do
|
||||
should contain_service('ceilometer-agent-notification').with(
|
||||
:ensure => 'running',
|
||||
:name => platform_params[:agent_notification_service_name],
|
||||
:enable => true,
|
||||
:hasstatus => true,
|
||||
:hasrestart => true
|
||||
)
|
||||
end
|
||||
|
||||
it 'configures notifications parameters in ceilometer.conf' do
|
||||
should contain_ceilometer_config('notification/ack_on_event_error').with_value( params[:ack_on_event_error] )
|
||||
should contain_ceilometer_config('notification/store_events').with_value( params[:store_events] )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'on Debian platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'Debian' }
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :agent_notification_package_name => 'ceilometer-agent-notification',
|
||||
:agent_notification_service_name => 'ceilometer-agent-notification' }
|
||||
end
|
||||
|
||||
it_configures 'ceilometer-agent-notification'
|
||||
end
|
||||
|
||||
context 'on RedHat platforms' do
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
|
||||
let :platform_params do
|
||||
{ :agent_notification_package_name => 'openstack-ceilometer-collector',
|
||||
:agent_notification_service_name => 'openstack-ceilometer-agent-notification' }
|
||||
end
|
||||
|
||||
it_configures 'ceilometer-agent-notification'
|
||||
end
|
||||
|
||||
end
|
@ -11,10 +11,7 @@ describe 'ceilometer::collector' do
|
||||
it { should contain_class('ceilometer::params') }
|
||||
|
||||
it 'installs ceilometer-collector package' do
|
||||
should contain_package('ceilometer-collector').with(
|
||||
:ensure => 'installed',
|
||||
:name => platform_params[:collector_package_name]
|
||||
)
|
||||
should contain_package(platform_params[:collector_package_name])
|
||||
end
|
||||
|
||||
it 'configures ceilometer-collector service' do
|
||||
|
Loading…
x
Reference in New Issue
Block a user