Uses devstack plugins to deploy ceilosca in devstack
- Leverages monsaca devstack and uses new devstack plugin model to setup ceilosca. - Also some refactoring in directory structure Change-Id: I097c86f92e1ec09ceeb3d0d4831ff8c51c3aa1a3
This commit is contained in:
parent
f181e467e3
commit
02ca4e80fe
|
@ -1,23 +0,0 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
$script = <<SCRIPT
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y git
|
||||
git clone https://git.openstack.org/openstack/monasca-ceilometer
|
||||
cd monasca-ceilometer
|
||||
deployer/ceilosca.sh
|
||||
SCRIPT
|
||||
|
||||
Vagrant.configure(2) do |config|
|
||||
config.vm.box = "ubuntu/trusty64"
|
||||
config.vm.provider "virtualbox" do |vb|
|
||||
vb.memory = 7168
|
||||
vb.cpus = 4
|
||||
end
|
||||
|
||||
config.vm.provision "shell" do |s|
|
||||
s.inline = $script
|
||||
s.privileged = false
|
||||
end
|
||||
end
|
|
@ -26,7 +26,7 @@ monclient_opts = [
|
|||
]
|
||||
|
||||
cfg.CONF.register_opts(monclient_opts, group='monasca')
|
||||
cfg.CONF.import_group('service_credentials', 'ceilometer.service')
|
||||
cfg.CONF.import_group('service_credentials', 'ceilometer.keystone_client')
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
@ -48,20 +48,20 @@ class Client(object):
|
|||
|
||||
def __init__(self, parsed_url):
|
||||
conf = cfg.CONF.service_credentials
|
||||
if not conf.os_username or not conf.os_password or \
|
||||
not conf.os_auth_url:
|
||||
if not conf.username or not conf.password or \
|
||||
not conf.auth_url:
|
||||
err_msg = _("No user name or password or auth_url "
|
||||
"found in service_credentials")
|
||||
LOG.error(err_msg)
|
||||
raise MonascaInvalidServiceCredentialsException(err_msg)
|
||||
|
||||
kwargs = {
|
||||
'username': conf.os_username,
|
||||
'password': conf.os_password,
|
||||
'auth_url': conf.os_auth_url.replace("v2.0", "v3"),
|
||||
'project_id': conf.os_tenant_id,
|
||||
'project_name': conf.os_tenant_name,
|
||||
'region_name': conf.os_region_name,
|
||||
'username': conf.username,
|
||||
'password': conf.password,
|
||||
'auth_url': conf.auth_url + "/v3",
|
||||
'project_id': conf.project_id,
|
||||
'project_name': conf.project_name,
|
||||
'region_name': conf.region_name,
|
||||
}
|
||||
|
||||
self._kwargs = kwargs
|
||||
|
|
|
@ -101,13 +101,13 @@ class MonascaDataFilter(object):
|
|||
for meta_key in self._mapping['metadata']['common']:
|
||||
val = sample_meta.get(meta_key, None)
|
||||
if val:
|
||||
value_meta[meta_key] = val
|
||||
value_meta[meta_key] = str(val)
|
||||
|
||||
if meter_name in self._mapping['metadata'].keys():
|
||||
for meta_key in self._mapping['metadata'][meter_name]:
|
||||
val = sample_meta.get(meta_key, None)
|
||||
if val:
|
||||
value_meta[meta_key] = val
|
||||
value_meta[meta_key] = str(val)
|
||||
|
||||
meter_value = sample.get('volume') or sample.get('counter_volume')
|
||||
if meter_value is None:
|
||||
|
|
|
@ -150,7 +150,7 @@ class MonascaPublisher(publisher.PublisherBase):
|
|||
if hasattr(self, 'archive_handler'):
|
||||
self.archive_handler.publish_samples(None, metrics)
|
||||
|
||||
def publish_samples(self, context, samples):
|
||||
def publish_samples(self, samples):
|
||||
"""Main method called to publish samples."""
|
||||
|
||||
for sample in samples:
|
||||
|
@ -256,10 +256,9 @@ class MonascaPublisher(publisher.PublisherBase):
|
|||
self.retry_counter[ctr] += 1
|
||||
ctr += 1
|
||||
|
||||
def publish_events(self, context, events):
|
||||
def publish_events(self, events):
|
||||
"""Send an event message for publishing
|
||||
|
||||
:param context: Execution context from the service or RPC call
|
||||
:param events: events from pipeline after transformation
|
||||
"""
|
||||
raise ceilometer.NotImplementedError
|
||||
|
|
|
@ -252,7 +252,7 @@ class Connection(base.Connection):
|
|||
pass
|
||||
|
||||
def get_meters(self, user=None, project=None, resource=None, source=None,
|
||||
metaquery=None, limit=None):
|
||||
metaquery=None, limit=None, unique=False):
|
||||
"""Return an iterable of dictionaries containing meter information.
|
||||
|
||||
{ 'name': name of the meter,
|
||||
|
|
|
@ -120,7 +120,7 @@ class TestMonUtils(base.BaseTestCase):
|
|||
timestamp=datetime.datetime.utcnow().isoformat(),
|
||||
resource_metadata={'event_type': 'notification',
|
||||
'status': 'active',
|
||||
'size': 1500},
|
||||
'size': '1500'},
|
||||
)
|
||||
|
||||
to_patch = ("ceilometer.publisher.monasca_data_filter."
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
import datetime
|
||||
import eventlet
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture as fixture_config
|
||||
from oslotest import base
|
||||
from oslotest import mockpatch
|
||||
|
@ -96,6 +97,14 @@ class TestMonascaPublisher(base.BaseTestCase):
|
|||
}
|
||||
}
|
||||
|
||||
opts = [
|
||||
cfg.StrOpt("username", default="ceilometer"),
|
||||
cfg.StrOpt("password", default="password"),
|
||||
cfg.StrOpt("auth_url", default="http://192.168.10.6:5000"),
|
||||
cfg.StrOpt("project_name", default="service"),
|
||||
cfg.StrOpt("project_id", default="service"),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def create_side_effect(exception_type, test_exception):
|
||||
def side_effect(*args, **kwargs):
|
||||
|
@ -109,6 +118,7 @@ class TestMonascaPublisher(base.BaseTestCase):
|
|||
super(TestMonascaPublisher, self).setUp()
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.CONF([], project='ceilometer', validate_default_values=True)
|
||||
self.CONF.register_opts(self.opts, group="service_credentials")
|
||||
self.parsed_url = mock.MagicMock()
|
||||
ksclient.KSClient = mock.MagicMock()
|
||||
|
||||
|
@ -123,7 +133,7 @@ class TestMonascaPublisher(base.BaseTestCase):
|
|||
with mock.patch.object(publisher.mon_client,
|
||||
'metrics_create') as mock_create:
|
||||
mock_create.return_value = FakeResponse(204)
|
||||
publisher.publish_samples(None, self.test_data)
|
||||
publisher.publish_samples(self.test_data)
|
||||
self.assertEqual(3, mock_create.call_count)
|
||||
self.assertEqual(1, mapping_patch.called)
|
||||
|
||||
|
@ -141,7 +151,7 @@ class TestMonascaPublisher(base.BaseTestCase):
|
|||
with mock.patch.object(publisher.mon_client,
|
||||
'metrics_create') as mock_create:
|
||||
mock_create.return_value = FakeResponse(204)
|
||||
publisher.publish_samples(None, self.test_data)
|
||||
publisher.publish_samples(self.test_data)
|
||||
eventlet.sleep(2)
|
||||
self.assertEqual(1, mock_create.call_count)
|
||||
self.assertEqual(1, mapping_patch.called)
|
||||
|
@ -165,7 +175,7 @@ class TestMonascaPublisher(base.BaseTestCase):
|
|||
mock_create.side_effect = self.create_side_effect(
|
||||
mon_client.MonascaServiceException,
|
||||
raise_http_error)
|
||||
publisher.publish_samples(None, self.test_data)
|
||||
publisher.publish_samples(self.test_data)
|
||||
eventlet.sleep(5)
|
||||
self.assertEqual(4, mock_create.call_count)
|
||||
self.assertEqual(1, mapping_patch.called)
|
||||
|
@ -189,6 +199,6 @@ class TestMonascaPublisher(base.BaseTestCase):
|
|||
'metrics_create') as mock_create:
|
||||
mock_create.side_effect = Exception
|
||||
metrics_archiver = self.fake_publisher.publish_samples
|
||||
publisher.publish_samples(None, self.test_data)
|
||||
publisher.publish_samples(self.test_data)
|
||||
self.assertEqual(1, metrics_archiver.called)
|
||||
self.assertEqual(3, metrics_archiver.call_count)
|
||||
|
|
|
@ -14,18 +14,31 @@
|
|||
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_config import fixture as fixture_config
|
||||
from oslo_utils import netutils
|
||||
from oslotest import base
|
||||
|
||||
from ceilometer import monasca_client
|
||||
from monascaclient import exc
|
||||
|
||||
cfg.CONF.import_group('service_credentials', 'ceilometer.service')
|
||||
cfg.CONF.import_group('service_credentials', 'ceilometer.keystone_client')
|
||||
|
||||
|
||||
class TestMonascaClient(base.BaseTestCase):
|
||||
|
||||
opts = [
|
||||
cfg.StrOpt("username", default="ceilometer"),
|
||||
cfg.StrOpt("password", default="password"),
|
||||
cfg.StrOpt("auth_url", default="http://192.168.10.6:5000"),
|
||||
cfg.StrOpt("project_name", default="service"),
|
||||
cfg.StrOpt("project_id", default="service"),
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
super(TestMonascaClient, self).setUp()
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
self.CONF([], project='ceilometer', validate_default_values=True)
|
||||
self.CONF.register_opts(self.opts, group="service_credentials")
|
||||
|
||||
self.mc = self._get_client()
|
||||
|
||||
|
@ -67,15 +80,15 @@ class TestMonascaClient(base.BaseTestCase):
|
|||
|
||||
class SetOpt(object):
|
||||
def __enter__(self):
|
||||
self.username = conf.os_username
|
||||
conf.os_username = ""
|
||||
self.username = conf.username
|
||||
conf.username = ""
|
||||
|
||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||
conf.os_username = self.username
|
||||
conf.username = self.username
|
||||
|
||||
with SetOpt():
|
||||
self.assertRaises(
|
||||
monasca_client.MonascaInvalidServiceCredentialsException,
|
||||
self._get_client)
|
||||
|
||||
self.assertIsNotNone(True, conf.os_username)
|
||||
self.assertIsNotNone(True, conf.username)
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
**The scripts setup a devstack, monasca and ceilosca setup on the local machine**
|
||||
|
||||
#Few gotchas:
|
||||
|
||||
- Monasca-ui doesn't get setup with this since it has compatibilty issues with oslo.utils version in stable/liberty
|
||||
- One of the monasca smoke test fails, but it is at the end and shouldn't affect the operation of ceilosca
|
||||
|
||||
#Pre-Requisites:
|
||||
|
||||
- Please make sure that the hostname does not contains hyphens (-) otherwise the creation of root under Percona cluster will fail.
|
||||
|
||||
#Running:
|
||||
|
||||
- By default uses the current user for setting devstack and monasca, make sure the user has sudo privileges
|
||||
- If you are running this script behind a proxy, make sure current host-ip is added to no_proxy
|
||||
|
||||
1. `git clone https://git.openstack.org/openstack/monasca-ceilometer`
|
||||
2. `cd monasca-ceilometer`
|
||||
3. `deployer/ceilosca.sh`
|
||||
|
||||
#Re-Running:
|
||||
|
||||
If for any reason you need to re-run the ceilosca script please make sure that:
|
||||
|
||||
1. MySql and Percona are removed using this command:
|
||||
|
||||
`sudo apt-get purge mysql* percona*`
|
||||
|
||||
|
||||
#Using the Clients
|
||||
|
||||
##Ceilometer Client
|
||||
|
||||
To run the Ceilometer client make sure to have the right OS_ environment variable set.
|
||||
You can do this running the following command from the devstack folder:
|
||||
|
||||
`source openrc admin`
|
||||
|
||||
##Monasca Client
|
||||
|
||||
To run the Monasca client make sure to have the right OS_ environment variable set.
|
||||
You can do this running the following command from the monasca-vagrant folder:
|
||||
|
||||
`source env.sh`
|
||||
|
||||
##Setting monasca-user role to ceilometer user
|
||||
|
||||
Ceilometer user needs the monasca-user role in the service tenant for Ceilometer
|
||||
to authenticate with the Monasca API.
|
||||
|
||||
keystone user-role-add --user <ID of ceilometer user> --tenant <ID of service tenant>
|
||||
--role <ID of monasca-user role>
|
||||
|
||||
IDs can be retrieved by using keystone user-list, tenant-list and role-list.
|
|
@ -1,109 +0,0 @@
|
|||
#!/bin/bash -xe
|
||||
|
||||
export MONASCA_VAGRANT_REPO=https://git.openstack.org/openstack/monasca-vagrant
|
||||
export DEVSTACK_REPO=https://git.openstack.org/openstack-dev/devstack.git
|
||||
export CEILOMETER_REPO=https://git.openstack.org/openstack/ceilometer
|
||||
|
||||
export BASE_DIR=~
|
||||
export WORK_DIR=$BASE_DIR/monasca-vagrant
|
||||
export PREFERRED_BRANCH=stable/liberty
|
||||
export DEVSTACK_DIR=$BASE_DIR/devstack
|
||||
export DEVSTACK_IP=192.168.10.5
|
||||
export MINIMON_IP=192.168.10.4
|
||||
export NETWORK_IF=eth0
|
||||
export CEILOSCA_USER=$USER
|
||||
export DEVSTACK_DEST=/opt/stack
|
||||
export CEILOMETER_DEST=$DEVSTACK_DEST/ceilometer
|
||||
|
||||
#The following variables are used by, modified devstack ceilometer (deployer/devstack/ceilometer) script
|
||||
export TARGET_IP=127.0.0.1
|
||||
export MONASCA_API_URL=http://$TARGET_IP:8070/v2.0
|
||||
export CEILOSCA_DIR=${PWD}
|
||||
export CEILOSCA_FILES='ceilometer/monasca_client.py ceilometer/publisher/monasca_data_filter.py ceilometer/publisher/monclient.py ceilometer/storage/impl_monasca.py setup.cfg'
|
||||
export CEILOSCA_CONF_FILES='pipeline.yaml monasca_field_definitions.yaml';
|
||||
|
||||
clear_env()
|
||||
{
|
||||
unset OS_USERNAME OS_PASSWORD OS_PROJECT_NAME OS_AUTH_URL
|
||||
}
|
||||
|
||||
download_ceilometer()
|
||||
{
|
||||
if [ ! -d $DEVSTACK_DEST ]; then
|
||||
sudo mkdir -p $DEVSTACK_DEST
|
||||
sudo chown $CEILOSCA_USER $DEVSTACK_DEST
|
||||
fi
|
||||
|
||||
git clone -b $PREFERRED_BRANCH $CEILOMETER_REPO $CEILOMETER_DEST || true
|
||||
cp deployer/devstack/settings $CEILOMETER_DEST/devstack
|
||||
cp deployer/devstack/plugin.sh $CEILOMETER_DEST/devstack
|
||||
}
|
||||
|
||||
setup_devstack()
|
||||
{
|
||||
git clone -b $PREFERRED_BRANCH $DEVSTACK_REPO $DEVSTACK_DIR || true
|
||||
cp deployer/devstack/local.conf $DEVSTACK_DIR
|
||||
pushd $DEVSTACK_DIR
|
||||
./unstack.sh || true
|
||||
./stack.sh
|
||||
popd
|
||||
}
|
||||
|
||||
install_ansible()
|
||||
{
|
||||
sudo apt-get install software-properties-common
|
||||
sudo apt-add-repository -y ppa:ansible/ansible
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install ansible
|
||||
}
|
||||
|
||||
get_monasca_files()
|
||||
{
|
||||
git clone $MONASCA_VAGRANT_REPO $WORK_DIR || true
|
||||
pushd $WORK_DIR
|
||||
ansible-galaxy install -r requirements.yml -p ./roles --ignore-errors
|
||||
popd
|
||||
}
|
||||
|
||||
disable_monasca_ui_role()
|
||||
{
|
||||
if [ -f $WORK_DIR/roles/monasca-ui/tasks/main.yml ]; then
|
||||
rm $WORK_DIR/roles/monasca-ui/tasks/main.yml
|
||||
file_list=$(find $WORK_DIR/roles -type f -exec grep -l get_url: {} +)
|
||||
for filename in $file_list; do
|
||||
sed -i.bak 's/ timeout=[0-9]\+//' $filename
|
||||
sed -i '/get_url:/s/$/ timeout=600/' $filename
|
||||
done
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
add_to_etc_hosts()
|
||||
{
|
||||
if ! grep -q "$TARGET_IP devstack mini-mon" /etc/hosts; then
|
||||
sudo bash -c "echo $TARGET_IP devstack mini-mon >> /etc/hosts"
|
||||
fi
|
||||
}
|
||||
|
||||
add_monasca_ips_to_local_net_if()
|
||||
{
|
||||
sudo ip addr add $DEVSTACK_IP/24 dev $NETWORK_IF || true
|
||||
sudo ip addr add $MINIMON_IP/24 dev $NETWORK_IF || true
|
||||
}
|
||||
|
||||
run_ceilosca()
|
||||
{
|
||||
cd $WORK_DIR
|
||||
ansible-playbook -u $CEILOSCA_USER -c local -k -i "devstack," devstack.yml
|
||||
ansible-playbook -u $CEILOSCA_USER -c local -k -i "mini-mon," mini-mon.yml -e 'database_type=influxdb' -e 'influxdb_version=0.9.4.2'
|
||||
}
|
||||
|
||||
clear_env
|
||||
download_ceilometer
|
||||
setup_devstack
|
||||
install_ansible
|
||||
get_monasca_files
|
||||
disable_monasca_ui_role
|
||||
add_to_etc_hosts
|
||||
add_monasca_ips_to_local_net_if
|
||||
run_ceilosca
|
|
@ -1,24 +0,0 @@
|
|||
[[local|localrc]]
|
||||
ADMIN_PASSWORD=admin
|
||||
MYSQL_PASSWORD=password
|
||||
RABBIT_PASSWORD=password
|
||||
SERVICE_PASSWORD=password
|
||||
SERVICE_TOKEN=ADMIN
|
||||
MONASCA_HOST=127.0.0.1
|
||||
CEILOMETER_EVENTS=False
|
||||
|
||||
LOGFILE=$DEST/logs/stack.sh.log
|
||||
LOGDAYS=1
|
||||
FORCE=yes
|
||||
RECLONE=no
|
||||
|
||||
KEYSTONE_TOKEN_FORMAT=UUID
|
||||
|
||||
enable_service s-proxy s-object s-container s-account s-api
|
||||
SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5
|
||||
SWIFT_REPLICAS=1
|
||||
SWIFT_DATA_DIR=$DEST/data
|
||||
|
||||
enable_plugin ceilometer https://git.openstack.org/openstack/ceilometer stable/liberty
|
||||
|
||||
disable_service tempest
|
|
@ -1,463 +0,0 @@
|
|||
# Install and start **Ceilometer** service in devstack
|
||||
#
|
||||
# To enable Ceilometer in devstack add an entry to local.conf that
|
||||
# looks like
|
||||
#
|
||||
# [[local|localrc]]
|
||||
# enable_plugin ceilometer git://git.openstack.org/openstack/ceilometer
|
||||
#
|
||||
# By default all ceilometer services are started (see
|
||||
# devstack/settings). To disable a specific service use the
|
||||
# disable_service function. For example to turn off alarming:
|
||||
#
|
||||
# disable_service ceilometer-alarm-notifier ceilometer-alarm-evaluator
|
||||
#
|
||||
# NOTE: Currently, there are two ways to get the IPMI based meters in
|
||||
# OpenStack. One way is to configure Ironic conductor to report those meters
|
||||
# for the nodes managed by Ironic and to have Ceilometer notification
|
||||
# agent to collect them. Ironic by default does NOT enable that reporting
|
||||
# functionality. So in order to do so, users need to set the option of
|
||||
# conductor.send_sensor_data to true in the ironic.conf configuration file
|
||||
# for the Ironic conductor service, and also enable the
|
||||
# ceilometer-anotification service. If you do this disable the IPMI
|
||||
# polling agent:
|
||||
#
|
||||
# disable_service ceilometer-aipmi
|
||||
#
|
||||
# The other way is to use Ceilometer ipmi agent only to get the IPMI based
|
||||
# meters. To avoid duplicated meters, users need to make sure to set the
|
||||
# option of conductor.send_sensor_data to false in the ironic.conf
|
||||
# configuration file if the node on which Ceilometer ipmi agent is running
|
||||
# is also managed by Ironic.
|
||||
#
|
||||
# Several variables set in the localrc section adjust common behaviors
|
||||
# of Ceilometer (see within for additional settings):
|
||||
#
|
||||
# CEILOMETER_PIPELINE_INTERVAL: Seconds between pipeline processing runs. Default 600.
|
||||
# CEILOMETER_BACKEND: Database backend (e.g. 'mysql', 'mongodb', 'es')
|
||||
# CEILOMETER_COORDINATION_URL: URL for group membership service provided by tooz.
|
||||
# CEILOMETER_EVENTS: Set to True to enable event collection
|
||||
# CEILOMETER_EVENT_ALARM: Set to True to enable publisher for event alarming
|
||||
|
||||
# Save trace setting
|
||||
XTRACE=$(set +o | grep xtrace)
|
||||
set -o xtrace
|
||||
|
||||
# Support potential entry-points console scripts in VENV or not
|
||||
if [[ ${USE_VENV} = True ]]; then
|
||||
PROJECT_VENV["ceilometer"]=${CEILOMETER_DIR}.venv
|
||||
CEILOMETER_BIN_DIR=${PROJECT_VENV["ceilometer"]}/bin
|
||||
else
|
||||
CEILOMETER_BIN_DIR=$(get_python_exec_prefix)
|
||||
fi
|
||||
|
||||
# Test if any Ceilometer services are enabled
|
||||
# is_ceilometer_enabled
|
||||
function is_ceilometer_enabled {
|
||||
[[ ,${ENABLED_SERVICES} =~ ,"ceilometer-" ]] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
function ceilometer_service_url {
|
||||
echo "$CEILOMETER_SERVICE_PROTOCOL://$CEILOMETER_SERVICE_HOST:$CEILOMETER_SERVICE_PORT"
|
||||
}
|
||||
|
||||
function inject_ceilosca_code {
|
||||
|
||||
#Assumes CEILOSCA_DIR is set
|
||||
for ceilosca_file in $CEILOSCA_FILES
|
||||
do
|
||||
if [ "$ceilosca_file" == 'setup.cfg' ]; then
|
||||
cp $CEILOSCA_DIR/$ceilosca_file $CEILOMETER_DIR/$ceilosca_file
|
||||
else
|
||||
cp $CEILOSCA_DIR/ceilosca/$ceilosca_file $CEILOMETER_DIR/$ceilosca_file
|
||||
fi
|
||||
done
|
||||
|
||||
if ! grep -q "python-monascaclient" $CEILOMETER_DIR/requirements.txt; then
|
||||
sudo bash -c "echo python-monascaclient >> $CEILOMETER_DIR/requirements.txt"
|
||||
fi
|
||||
}
|
||||
|
||||
function inject_ceilosca_conf {
|
||||
|
||||
sudo mkdir -p /etc/ceilometer
|
||||
sudo chown $CEILOSCA_USER /etc/ceilometer
|
||||
for ceilosca_conf_file in $CEILOSCA_CONF_FILES
|
||||
do
|
||||
cp $CEILOSCA_DIR/etc/ceilometer/$ceilosca_conf_file /etc/ceilometer/$ceilosca_conf_file
|
||||
done
|
||||
}
|
||||
|
||||
# _ceilometer_install_mongdb - Install mongodb and python lib.
|
||||
function _ceilometer_install_mongodb {
|
||||
# Server package is the same on all
|
||||
local packages=mongodb-server
|
||||
|
||||
if is_fedora; then
|
||||
# mongodb client
|
||||
packages="${packages} mongodb"
|
||||
fi
|
||||
|
||||
install_package ${packages}
|
||||
|
||||
if is_fedora; then
|
||||
restart_service mongod
|
||||
else
|
||||
restart_service mongodb
|
||||
fi
|
||||
|
||||
# give time for service to restart
|
||||
sleep 5
|
||||
}
|
||||
|
||||
# _ceilometer_install_redis() - Install the redis server and python lib.
|
||||
function _ceilometer_install_redis {
|
||||
if is_ubuntu; then
|
||||
install_package redis-server
|
||||
restart_service redis-server
|
||||
else
|
||||
# This will fail (correctly) where a redis package is unavailable
|
||||
install_package redis
|
||||
restart_service redis
|
||||
fi
|
||||
|
||||
pip_install_gr redis
|
||||
}
|
||||
|
||||
# Configure mod_wsgi
|
||||
function _ceilometer_config_apache_wsgi {
|
||||
sudo mkdir -p $CEILOMETER_WSGI_DIR
|
||||
|
||||
local ceilometer_apache_conf=$(apache_site_config_for ceilometer)
|
||||
local apache_version=$(get_apache_version)
|
||||
local venv_path=""
|
||||
|
||||
# Copy proxy vhost and wsgi file
|
||||
sudo cp $CEILOMETER_DIR/ceilometer/api/app.wsgi $CEILOMETER_WSGI_DIR/app
|
||||
|
||||
if [[ ${USE_VENV} = True ]]; then
|
||||
venv_path="python-path=${PROJECT_VENV["ceilometer"]}/lib/$(python_version)/site-packages"
|
||||
fi
|
||||
|
||||
sudo cp $CEILOMETER_DIR/devstack/apache-ceilometer.template $ceilometer_apache_conf
|
||||
sudo sed -e "
|
||||
s|%PORT%|$CEILOMETER_SERVICE_PORT|g;
|
||||
s|%APACHE_NAME%|$APACHE_NAME|g;
|
||||
s|%WSGIAPP%|$CEILOMETER_WSGI_DIR/app|g;
|
||||
s|%USER%|$STACK_USER|g;
|
||||
s|%VIRTUALENV%|$venv_path|g
|
||||
" -i $ceilometer_apache_conf
|
||||
}
|
||||
|
||||
# Install required services for coordination
|
||||
function _ceilometer_prepare_coordination {
|
||||
if echo $CEILOMETER_COORDINATION_URL | grep -q '^memcached:'; then
|
||||
install_package memcached
|
||||
elif echo $CEILOMETER_COORDINATION_URL | grep -q '^redis:'; then
|
||||
_ceilometer_install_redis
|
||||
fi
|
||||
}
|
||||
|
||||
# Install required services for storage backends
|
||||
function _ceilometer_prepare_storage_backend {
|
||||
if [ "$CEILOMETER_BACKEND" = 'mongodb' ] ; then
|
||||
pip_install_gr pymongo
|
||||
_ceilometer_install_mongodb
|
||||
fi
|
||||
|
||||
if [ "$CEILOMETER_BACKEND" = 'es' ] ; then
|
||||
${TOP_DIR}/pkg/elasticsearch.sh download
|
||||
${TOP_DIR}/pkg/elasticsearch.sh install
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Install the python modules for inspecting nova virt instances
|
||||
function _ceilometer_prepare_virt_drivers {
|
||||
# Only install virt drivers if we're running nova compute
|
||||
if is_service_enabled n-cpu ; then
|
||||
if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then
|
||||
pip_install_gr libvirt-python
|
||||
fi
|
||||
|
||||
if [[ "$VIRT_DRIVER" = 'vsphere' ]]; then
|
||||
pip_install_gr oslo.vmware
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Create ceilometer related accounts in Keystone
|
||||
function _ceilometer_create_accounts {
|
||||
if is_service_enabled ceilometer-api; then
|
||||
|
||||
create_service_user "ceilometer" "admin"
|
||||
|
||||
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
|
||||
get_or_create_service "ceilometer" "metering" "OpenStack Telemetry Service"
|
||||
get_or_create_endpoint "metering" \
|
||||
"$REGION_NAME" \
|
||||
"$(ceilometer_service_url)/" \
|
||||
"$(ceilometer_service_url)/" \
|
||||
"$(ceilometer_service_url)/"
|
||||
fi
|
||||
if is_service_enabled swift; then
|
||||
# Ceilometer needs ResellerAdmin role to access Swift account stats.
|
||||
get_or_add_user_project_role "ResellerAdmin" "ceilometer" $SERVICE_TENANT_NAME
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Activities to do before ceilometer has been installed.
|
||||
function preinstall_ceilometer {
|
||||
echo_summary "Preinstall not in virtualenv context. Skipping."
|
||||
}
|
||||
|
||||
# Remove WSGI files, disable and remove Apache vhost file
|
||||
function _ceilometer_cleanup_apache_wsgi {
|
||||
sudo rm -f $CEILOMETER_WSGI_DIR/*
|
||||
sudo rm -f $(apache_site_config_for ceilometer)
|
||||
}
|
||||
|
||||
# cleanup_ceilometer() - Remove residual data files, anything left over
|
||||
# from previous runs that a clean run would need to clean up
|
||||
function cleanup_ceilometer {
|
||||
if [ "$CEILOMETER_BACKEND" = 'mongodb' ] ; then
|
||||
mongo ceilometer --eval "db.dropDatabase();"
|
||||
elif [ "$CEILOMETER_BACKEND" = 'es' ] ; then
|
||||
curl -XDELETE "localhost:9200/events_*"
|
||||
fi
|
||||
if [ "$CEILOMETER_USE_MOD_WSGI" == "True" ]; then
|
||||
_ceilometer_cleanup_apache_wsgi
|
||||
fi
|
||||
}
|
||||
|
||||
# Set configuration for storage backend.
|
||||
function _ceilometer_configure_storage_backend {
|
||||
if [ "$CEILOMETER_BACKEND" = 'mysql' ] || [ "$CEILOMETER_BACKEND" = 'postgresql' ] ; then
|
||||
iniset $CEILOMETER_CONF database alarm_connection $(database_connection_url ceilometer)
|
||||
iniset $CEILOMETER_CONF database event_connection $(database_connection_url ceilometer)
|
||||
iniset $CEILOMETER_CONF database metering_connection monasca://$MONASCA_API_URL
|
||||
#iniset $CEILOMETER_CONF database metering_connection $(database_connection_url ceilometer)
|
||||
iniset $CEILOMETER_CONF DEFAULT collector_workers $API_WORKERS
|
||||
elif [ "$CEILOMETER_BACKEND" = 'es' ] ; then
|
||||
# es is only supported for events. we will use sql for alarming/metering.
|
||||
iniset $CEILOMETER_CONF database alarm_connection $(database_connection_url ceilometer)
|
||||
iniset $CEILOMETER_CONF database event_connection es://localhost:9200
|
||||
iniset $CEILOMETER_CONF database metering_connection $(database_connection_url ceilometer)
|
||||
iniset $CEILOMETER_CONF DEFAULT collector_workers $API_WORKERS
|
||||
${TOP_DIR}/pkg/elasticsearch.sh start
|
||||
cleanup_ceilometer
|
||||
elif [ "$CEILOMETER_BACKEND" = 'mongodb' ] ; then
|
||||
iniset $CEILOMETER_CONF database alarm_connection mongodb://localhost:27017/ceilometer
|
||||
iniset $CEILOMETER_CONF database event_connection mongodb://localhost:27017/ceilometer
|
||||
iniset $CEILOMETER_CONF database metering_connection mongodb://localhost:27017/ceilometer
|
||||
cleanup_ceilometer
|
||||
else
|
||||
die $LINENO "Unable to configure unknown CEILOMETER_BACKEND $CEILOMETER_BACKEND"
|
||||
fi
|
||||
}
|
||||
|
||||
# Configure Ceilometer
|
||||
function configure_ceilometer {
|
||||
|
||||
iniset_rpc_backend ceilometer $CEILOMETER_CONF
|
||||
|
||||
iniset $CEILOMETER_CONF DEFAULT notification_topics "$CEILOMETER_NOTIFICATION_TOPICS"
|
||||
iniset $CEILOMETER_CONF DEFAULT verbose True
|
||||
iniset $CEILOMETER_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL"
|
||||
|
||||
if [[ -n "$CEILOMETER_COORDINATION_URL" ]]; then
|
||||
iniset $CEILOMETER_CONF coordination backend_url $CEILOMETER_COORDINATION_URL
|
||||
iniset $CEILOMETER_CONF compute workload_partitioning True
|
||||
fi
|
||||
|
||||
# Install the policy file for the API server
|
||||
cp $CEILOMETER_DIR/etc/ceilometer/policy.json $CEILOMETER_CONF_DIR
|
||||
iniset $CEILOMETER_CONF oslo_policy policy_file $CEILOMETER_CONF_DIR/policy.json
|
||||
|
||||
cp $CEILOMETER_DIR/etc/ceilometer/pipeline.yaml $CEILOMETER_CONF_DIR
|
||||
cp $CEILOMETER_DIR/etc/ceilometer/event_pipeline.yaml $CEILOMETER_CONF_DIR
|
||||
cp $CEILOMETER_DIR/etc/ceilometer/api_paste.ini $CEILOMETER_CONF_DIR
|
||||
cp $CEILOMETER_DIR/etc/ceilometer/event_definitions.yaml $CEILOMETER_CONF_DIR
|
||||
cp $CEILOMETER_DIR/etc/ceilometer/gnocchi_archive_policy_map.yaml $CEILOMETER_CONF_DIR
|
||||
cp $CEILOMETER_DIR/etc/ceilometer/gnocchi_resources.yaml $CEILOMETER_CONF_DIR
|
||||
|
||||
if [ "$CEILOMETER_PIPELINE_INTERVAL" ]; then
|
||||
sed -i "s/interval:.*/interval: ${CEILOMETER_PIPELINE_INTERVAL}/" $CEILOMETER_CONF_DIR/pipeline.yaml
|
||||
fi
|
||||
if [ "$CEILOMETER_EVENT_ALARM" == "True" ]; then
|
||||
if ! grep -q '^ *- notifier://?topic=alarm.all$' $CEILOMETER_CONF_DIR/event_pipeline.yaml; then
|
||||
sed -i '/^ *publishers:$/,+1s|^\( *\)-.*$|\1- notifier://?topic=alarm.all\n&|' $CEILOMETER_CONF_DIR/event_pipeline.yaml
|
||||
fi
|
||||
fi
|
||||
|
||||
# The compute and central agents need these credentials in order to
|
||||
# call out to other services' public APIs.
|
||||
# The alarm evaluator needs these options to call ceilometer APIs
|
||||
iniset $CEILOMETER_CONF service_credentials os_username ceilometer
|
||||
iniset $CEILOMETER_CONF service_credentials os_password $SERVICE_PASSWORD
|
||||
iniset $CEILOMETER_CONF service_credentials os_tenant_name $SERVICE_TENANT_NAME
|
||||
iniset $CEILOMETER_CONF service_credentials os_region_name $REGION_NAME
|
||||
iniset $CEILOMETER_CONF service_credentials os_auth_url $KEYSTONE_SERVICE_URI/v2.0
|
||||
|
||||
configure_auth_token_middleware $CEILOMETER_CONF ceilometer $CEILOMETER_AUTH_CACHE_DIR
|
||||
|
||||
iniset $CEILOMETER_CONF notification store_events $CEILOMETER_EVENTS
|
||||
|
||||
inject_ceilosca_conf
|
||||
|
||||
# Configure storage
|
||||
_ceilometer_configure_storage_backend
|
||||
|
||||
if [[ "$VIRT_DRIVER" = 'vsphere' ]]; then
|
||||
iniset $CEILOMETER_CONF DEFAULT hypervisor_inspector vsphere
|
||||
iniset $CEILOMETER_CONF vmware host_ip "$VMWAREAPI_IP"
|
||||
iniset $CEILOMETER_CONF vmware host_username "$VMWAREAPI_USER"
|
||||
iniset $CEILOMETER_CONF vmware host_password "$VMWAREAPI_PASSWORD"
|
||||
fi
|
||||
|
||||
# NOTE: This must come after database configurate as those can
|
||||
# call cleanup_ceilometer which will wipe the WSGI config.
|
||||
if [ "$CEILOMETER_USE_MOD_WSGI" == "True" ]; then
|
||||
iniset $CEILOMETER_CONF api pecan_debug "False"
|
||||
_ceilometer_config_apache_wsgi
|
||||
fi
|
||||
|
||||
if is_service_enabled ceilometer-aipmi; then
|
||||
# Configure rootwrap for the ipmi agent
|
||||
configure_rootwrap ceilometer
|
||||
fi
|
||||
}
|
||||
|
||||
# init_ceilometer() - Initialize etc.
|
||||
function init_ceilometer {
|
||||
# Get ceilometer keystone settings in place
|
||||
_ceilometer_create_accounts
|
||||
# Create cache dir
|
||||
sudo install -d -o $STACK_USER $CEILOMETER_AUTH_CACHE_DIR
|
||||
rm -f $CEILOMETER_AUTH_CACHE_DIR/*
|
||||
|
||||
if is_service_enabled mysql postgresql; then
|
||||
if [ "$CEILOMETER_BACKEND" = 'mysql' ] || [ "$CEILOMETER_BACKEND" = 'postgresql' ] || [ "$CEILOMETER_BACKEND" = 'es' ] ; then
|
||||
recreate_database ceilometer
|
||||
$CEILOMETER_BIN_DIR/ceilometer-dbsync
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Install Ceilometer.
|
||||
# The storage and coordination backends are installed here because the
|
||||
# virtualenv context is active at this point and python drivers need to be
|
||||
# installed. The context is not active during preinstall (when it would
|
||||
# otherwise makes sense to do the backend services).
|
||||
function install_ceilometer {
|
||||
|
||||
inject_ceilosca_code
|
||||
|
||||
_ceilometer_prepare_coordination
|
||||
_ceilometer_prepare_storage_backend
|
||||
_ceilometer_prepare_virt_drivers
|
||||
install_ceilometerclient
|
||||
setup_develop $CEILOMETER_DIR
|
||||
sudo install -d -o $STACK_USER -m 755 $CEILOMETER_CONF_DIR $CEILOMETER_API_LOG_DIR
|
||||
}
|
||||
|
||||
# install_ceilometerclient() - Collect source and prepare
|
||||
function install_ceilometerclient {
|
||||
if use_library_from_git "python-ceilometerclient"; then
|
||||
git_clone_by_name "python-ceilometerclient"
|
||||
setup_dev_lib "python-ceilometerclient"
|
||||
sudo install -D -m 0644 -o $STACK_USER {${GITDIR["python-ceilometerclient"]}/tools/,/etc/bash_completion.d/}ceilometer.bash_completion
|
||||
else
|
||||
pip_install_gr python-ceilometerclient
|
||||
fi
|
||||
}
|
||||
|
||||
# start_ceilometer() - Start running processes, including screen
|
||||
function start_ceilometer {
|
||||
run_process ceilometer-acentral "$CEILOMETER_BIN_DIR/ceilometer-polling --polling-namespaces central --config-file $CEILOMETER_CONF"
|
||||
run_process ceilometer-anotification "$CEILOMETER_BIN_DIR/ceilometer-agent-notification --config-file $CEILOMETER_CONF"
|
||||
run_process ceilometer-aipmi "$CEILOMETER_BIN_DIR/ceilometer-polling --polling-namespaces ipmi --config-file $CEILOMETER_CONF"
|
||||
|
||||
if [[ "$CEILOMETER_USE_MOD_WSGI" == "False" ]]; then
|
||||
run_process ceilometer-api "$CEILOMETER_BIN_DIR/ceilometer-api -d -v --log-dir=$CEILOMETER_API_LOG_DIR --config-file $CEILOMETER_CONF"
|
||||
else
|
||||
enable_apache_site ceilometer
|
||||
restart_apache_server
|
||||
tail_log ceilometer /var/log/$APACHE_NAME/ceilometer.log
|
||||
tail_log ceilometer-api /var/log/$APACHE_NAME/ceilometer_access.log
|
||||
fi
|
||||
|
||||
# run the the collector after restarting apache as it needs
|
||||
# operational keystone if using gnocchi
|
||||
run_process ceilometer-collector "$CEILOMETER_BIN_DIR/ceilometer-collector --config-file $CEILOMETER_CONF"
|
||||
|
||||
# Start the compute agent late to allow time for the collector to
|
||||
# fully wake up and connect to the message bus. See bug #1355809
|
||||
if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then
|
||||
run_process ceilometer-acompute "$CEILOMETER_BIN_DIR/ceilometer-polling --polling-namespaces compute --config-file $CEILOMETER_CONF" $LIBVIRT_GROUP
|
||||
fi
|
||||
if [[ "$VIRT_DRIVER" = 'vsphere' ]]; then
|
||||
run_process ceilometer-acompute "$CEILOMETER_BIN_DIR/ceilometer-polling --polling-namespaces compute --config-file $CEILOMETER_CONF"
|
||||
fi
|
||||
|
||||
# Only die on API if it was actually intended to be turned on
|
||||
if is_service_enabled ceilometer-api; then
|
||||
echo "Waiting for ceilometer-api to start..."
|
||||
if ! wait_for_service $SERVICE_TIMEOUT $(ceilometer_service_url)/v2/; then
|
||||
die $LINENO "ceilometer-api did not start"
|
||||
fi
|
||||
fi
|
||||
|
||||
run_process ceilometer-alarm-notifier "$CEILOMETER_BIN_DIR/ceilometer-alarm-notifier --config-file $CEILOMETER_CONF"
|
||||
run_process ceilometer-alarm-evaluator "$CEILOMETER_BIN_DIR/ceilometer-alarm-evaluator --config-file $CEILOMETER_CONF"
|
||||
}
|
||||
|
||||
# stop_ceilometer() - Stop running processes
|
||||
function stop_ceilometer {
|
||||
if [ "$CEILOMETER_USE_MOD_WSGI" == "True" ]; then
|
||||
disable_apache_site ceilometer
|
||||
restart_apache_server
|
||||
fi
|
||||
# Kill the ceilometer screen windows
|
||||
for serv in ceilometer-acompute ceilometer-acentral ceilometer-aipmi ceilometer-anotification ceilometer-collector ceilometer-api ceilometer-alarm-notifier ceilometer-alarm-evaluator; do
|
||||
stop_process $serv
|
||||
done
|
||||
}
|
||||
|
||||
# This is the main for plugin.sh
|
||||
if is_service_enabled ceilometer; then
|
||||
if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
|
||||
# Set up other services
|
||||
echo_summary "Configuring system services for Ceilometer"
|
||||
preinstall_ceilometer
|
||||
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
|
||||
echo_summary "Installing Ceilometer"
|
||||
# Use stack_install_service here to account for vitualenv
|
||||
stack_install_service ceilometer
|
||||
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
|
||||
echo_summary "Configuring Ceilometer"
|
||||
configure_ceilometer
|
||||
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
|
||||
echo_summary "Initializing Ceilometer"
|
||||
# Tidy base for ceilometer
|
||||
init_ceilometer
|
||||
# Start the services
|
||||
start_ceilometer
|
||||
fi
|
||||
|
||||
if [[ "$1" == "unstack" ]]; then
|
||||
echo_summary "Shutting Down Ceilometer"
|
||||
stop_ceilometer
|
||||
fi
|
||||
|
||||
if [[ "$1" == "clean" ]]; then
|
||||
echo_summary "Cleaning Ceilometer"
|
||||
cleanup_ceilometer
|
||||
fi
|
||||
fi
|
||||
|
||||
# Restore xtrace
|
||||
$XTRACE
|
|
@ -1,50 +0,0 @@
|
|||
# turn on following ceilometer services by default
|
||||
# Pollsters
|
||||
enable_service ceilometer-acompute ceilometer-acentral
|
||||
# Notification Agent
|
||||
enable_service ceilometer-anotification
|
||||
# API service
|
||||
enable_service ceilometer-api
|
||||
# Alarming
|
||||
enable_service ceilometer-alarm-notifier ceilometer-alarm-evaluator
|
||||
|
||||
# Default directories
|
||||
CEILOMETER_DIR=$DEST/ceilometer
|
||||
CEILOMETER_CONF_DIR=/etc/ceilometer
|
||||
CEILOMETER_CONF=$CEILOMETER_CONF_DIR/ceilometer.conf
|
||||
CEILOMETER_API_LOG_DIR=/var/log/ceilometer-api
|
||||
CEILOMETER_AUTH_CACHE_DIR=${CEILOMETER_AUTH_CACHE_DIR:-/var/cache/ceilometer}
|
||||
CEILOMETER_WSGI_DIR=${CEILOMETER_WSGI_DIR:-/var/www/ceilometer}
|
||||
|
||||
# Set up database backend
|
||||
CEILOMETER_BACKEND=${CEILOMETER_BACKEND:-mysql}
|
||||
|
||||
# Ceilometer connection info.
|
||||
CEILOMETER_SERVICE_PROTOCOL=http
|
||||
CEILOMETER_SERVICE_HOST=$SERVICE_HOST
|
||||
CEILOMETER_SERVICE_PORT=${CEILOMETER_SERVICE_PORT:-8777}
|
||||
CEILOMETER_USE_MOD_WSGI=${CEILOMETER_USE_MOD_WSGI:-${ENABLE_HTTPD_MOD_WSGI_SERVICES}}
|
||||
|
||||
# To enable OSprofiler change value of this variable to "notifications,profiler"
|
||||
CEILOMETER_NOTIFICATION_TOPICS=${CEILOMETER_NOTIFICATION_TOPICS:-notifications}
|
||||
CEILOMETER_EVENTS=${CEILOMETER_EVENTS:-True}
|
||||
|
||||
CEILOMETER_COORDINATION_URL=${CEILOMETER_COORDINATION_URL:-}
|
||||
CEILOMETER_PIPELINE_INTERVAL=${CEILOMETER_PIPELINE_INTERVAL:-}
|
||||
|
||||
CEILOMETER_EVENT_ALARM=${CEILOMETER_EVENT_ALARM:-False}
|
||||
|
||||
# Tell Tempest this project is present
|
||||
TEMPEST_SERVICES+=,ceilometer
|
||||
|
||||
# Set up default directories for client and middleware
|
||||
GITREPO["python-ceilometerclient"]=${CEILOMETERCLIENT_REPO:-${GIT_BASE}/openstack/python-ceilometerclient.git}
|
||||
GITBRANCH["python-ceilometerclient"]=${CEILOMETERCLIENT_BRANCH:-master}
|
||||
GITDIR["python-ceilometerclient"]=$DEST/python-ceilometerclient
|
||||
GITDIR["ceilometermiddleware"]=$DEST/ceilometermiddleware
|
||||
|
||||
# Get rid of this before done.
|
||||
# Tell emacs to use shell-script-mode
|
||||
## Local variables:
|
||||
## mode: shell-script
|
||||
## End:
|
|
@ -0,0 +1,21 @@
|
|||
# Setting up ceilosca solution
|
||||
|
||||
Setup ceilosca solution with following steps
|
||||
|
||||
- wget https://raw.githubusercontent.com/openstack/monasca-ceilometer/master/devstack/ceilosca.sh
|
||||
- chmod +x ceilosca.sh
|
||||
- (Optional) check ceilosca.sh to tweak and modify if you require any changes from default behaviour
|
||||
- ./ceilosca.sh
|
||||
|
||||
# Few things to take note
|
||||
|
||||
- The user running the script should be part of sudoers with no password
|
||||
- Like devstack this setup adds the packages and modifies at system level
|
||||
|
||||
# What's missing
|
||||
|
||||
Horizon isn't being setup since it is causing issue which require further investigation
|
||||
|
||||
# Vagrant approved!
|
||||
|
||||
Use the provided Vagrantfile to create and provision a VM.
|
|
@ -0,0 +1,42 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
||||
# configures the configuration version (we support older styles for
|
||||
# backwards compatibility). Please don't change it unless you know what
|
||||
# you're doing.
|
||||
Vagrant.configure(2) do |config|
|
||||
|
||||
if Vagrant.has_plugin?("vagrant-cachier")
|
||||
config.cache.scope = :box
|
||||
end
|
||||
|
||||
# Handle local proxy settings
|
||||
if Vagrant.has_plugin?("vagrant-proxyconf")
|
||||
if ENV["http_proxy"]
|
||||
config.proxy.http = ENV["http_proxy"]
|
||||
end
|
||||
if ENV["https_proxy"]
|
||||
config.proxy.https = ENV["https_proxy"]
|
||||
end
|
||||
if ENV["no_proxy"]
|
||||
config.proxy.no_proxy = ENV["no_proxy"] + ',192.168.10.6,10.0.2.15'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
config.vm.hostname = "devstack"
|
||||
config.vm.box = "ubuntu/trusty64"
|
||||
# config.vm.box_check_update = false
|
||||
config.vm.network "private_network",ip:"192.168.10.6"
|
||||
config.vm.synced_folder "~/", "/vagrant_home"
|
||||
|
||||
config.vm.provider "virtualbox" do |vb|
|
||||
vb.gui = false
|
||||
vb.memory = "12800"
|
||||
vb.cpus = 4
|
||||
# vb.customize ["modifyvm", :id, "--cpuexecutioncap", "50"]
|
||||
end
|
||||
|
||||
config.vm.provision "shell", privileged: false, path: "ceilosca.sh"
|
||||
end
|
|
@ -0,0 +1,86 @@
|
|||
#!/bin/bash -xe
|
||||
|
||||
#Change to Home directory
|
||||
cd $HOME
|
||||
|
||||
#Essentials
|
||||
sudo apt-get update
|
||||
sudo apt-get -y upgrade
|
||||
sudo apt-get -y install git
|
||||
wget https://bootstrap.pypa.io/get-pip.py
|
||||
sudo python get-pip.py
|
||||
sudo apt-get -y install python-dev
|
||||
sudo pip install numpy
|
||||
sudo pip install python-monascaclient
|
||||
|
||||
#Handle if http_proxy is set
|
||||
if [ $http_proxy ]; then
|
||||
git config --global url.https://git.openstack.org/.insteadOf git://git.openstack.org/
|
||||
sudo git config --global url.https://git.openstack.org/.insteadOf git://git.openstack.org/
|
||||
protocol=`echo $http_proxy | awk -F: '{print $1}'`
|
||||
host=`echo $http_proxy | awk -F/ '{print $3}' | awk -F: '{print $1}'`
|
||||
port=`echo $http_proxy | awk -F/ '{print $3}' | awk -F: '{print $2}'`
|
||||
echo "<settings>
|
||||
<proxies>
|
||||
<proxy>
|
||||
<id>$host</id>
|
||||
<active>true</active>
|
||||
<protocol>$protocol</protocol>
|
||||
<host>$host</host>
|
||||
<port>$port</port>
|
||||
</proxy>
|
||||
</proxies>
|
||||
</settings>" > ./maven_proxy_settings.xml
|
||||
mkdir -p ~/.m2
|
||||
cp ./maven_proxy_settings.xml ~/.m2/settings.xml
|
||||
sudo mkdir -p /root/.m2
|
||||
sudo cp ./maven_proxy_settings.xml /root/.m2/settings.xml
|
||||
fi
|
||||
|
||||
#Clone devstack and switch to mitaka
|
||||
git clone https://git.openstack.org/openstack-dev/devstack | true
|
||||
cd devstack
|
||||
git checkout stable/mitaka
|
||||
|
||||
#Add hard coded IP to the default interface
|
||||
##NOTE: Change the interface if your system is different net_if
|
||||
export SERVICE_HOST=192.168.10.6
|
||||
export HOST_IP_IFACE=eth0
|
||||
sudo ip addr add $SERVICE_HOST/24 dev $HOST_IP_IFACE || true
|
||||
|
||||
#local.conf for devstack
|
||||
echo '[[local|localrc]]
|
||||
SERVICE_HOST=$SERVICE_HOST
|
||||
HOST_IP=$SERVICE_HOST
|
||||
HOST_IP_IFACE=$HOST_IP_IFACE
|
||||
MYSQL_HOST=$SERVICE_HOST
|
||||
MYSQL_PASSWORD=secretmysql
|
||||
DATABASE_PASSWORD=secretdatabase
|
||||
RABBIT_PASSWORD=secretrabbit
|
||||
ADMIN_PASSWORD=secretadmin
|
||||
SERVICE_PASSWORD=secretservice
|
||||
SERVICE_TOKEN=111222333444
|
||||
LOGFILE=$DEST/logs/stack.sh.log
|
||||
LOGDIR=$DEST/logs
|
||||
LOG_COLOR=False
|
||||
disable_service ceilometer-alarm-notifier ceilometer-alarm-evaluator
|
||||
disable_service ceilometer-collector
|
||||
enable_service rabbit mysql key tempest
|
||||
# The following two variables allow switching between Java and Python for the implementations
|
||||
# of the Monasca API and the Monasca Persister. If these variables are not set, then the
|
||||
# default is to install the Java implementations of both the Monasca API and the Monasca Persister.
|
||||
# Uncomment one of the following two lines to choose Java or Python for the Monasca API.
|
||||
#MONASCA_API_IMPLEMENTATION_LANG=${MONASCA_API_IMPLEMENTATION_LANG:-java}
|
||||
MONASCA_API_IMPLEMENTATION_LANG=${MONASCA_API_IMPLEMENTATION_LANG:-python}
|
||||
# Uncomment one of the following two lines to choose Java or Python for the Monasca Pesister.
|
||||
#MONASCA_PERSISTER_IMPLEMENTATION_LANG=${MONASCA_PERSISTER_IMPLEMENTATION_LANG:-java}
|
||||
MONASCA_PERSISTER_IMPLEMENTATION_LANG=${MONASCA_PERSISTER_IMPLEMENTATION_LANG:-python}
|
||||
# This line will enable all of Monasca.
|
||||
enable_plugin monasca-api https://git.openstack.org/openstack/monasca-api
|
||||
enable_plugin ceilometer https://git.openstack.org/openstack/ceilometer
|
||||
enable_plugin ceilosca https://github.com/openstack/monasca-ceilometer
|
||||
' > local.conf
|
||||
|
||||
#Run the stack.sh
|
||||
./unstack.sh | true
|
||||
./stack.sh
|
|
@ -0,0 +1,87 @@
|
|||
# plugin.sh - DevStack plugin.sh dispatch script template
|
||||
|
||||
function install_ceilosca {
|
||||
echo "In install_ceilosca"
|
||||
}
|
||||
|
||||
function init_ceilosca {
|
||||
echo "In init_ceilosca"
|
||||
get_or_add_user_project_role "monasca-user" "ceilometer" $SERVICE_PROJECT_NAME
|
||||
}
|
||||
|
||||
function configure_ceilosca {
|
||||
echo "In configure_ceilosca"
|
||||
sudo mkdir -p /etc/ceilometer
|
||||
sudo chown $CEILOSCA_USER /etc/ceilometer
|
||||
for ceilosca_conf_file in $CEILOSCA_CONF_FILES
|
||||
do
|
||||
# source file and dest file names are separated with :
|
||||
source_file=`awk -F':' '{print $1}' <<< $ceilosca_conf_file`
|
||||
dest_file=`awk -F':' '{print $2}' <<< $ceilosca_conf_file`
|
||||
if [ -z $dest_file ]; then
|
||||
dest_file=$source_file
|
||||
fi
|
||||
cp $CEILOSCA_DIR/etc/ceilometer/$source_file /etc/ceilometer/$dest_file
|
||||
done
|
||||
|
||||
iniset $CEILOMETER_CONF database metering_connection monasca://$MONASCA_API_URL
|
||||
iniset $CEILOMETER_CONF notification workers $API_WORKERS
|
||||
}
|
||||
|
||||
function preinstall_ceilosca {
|
||||
for ceilosca_file in $CEILOSCA_FILES
|
||||
do
|
||||
# source file and dest file names are separated with :
|
||||
source_file=`awk -F':' '{print $1}' <<< $ceilosca_file`
|
||||
dest_file=`awk -F':' '{print $2}' <<< $ceilosca_file`
|
||||
if [ -z $dest_file ]; then
|
||||
dest_file=$source_file
|
||||
fi
|
||||
|
||||
cp $CEILOSCA_DIR/ceilosca/$source_file $CEILOMETER_DIR/$dest_file
|
||||
done
|
||||
|
||||
if ! grep -q "python-monascaclient" $CEILOMETER_DIR/requirements.txt; then
|
||||
sudo bash -c "echo python-monascaclient >> $CEILOMETER_DIR/requirements.txt"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# check for service enabled
|
||||
if is_service_enabled ceilosca; then
|
||||
|
||||
if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
|
||||
# Set up system services
|
||||
echo_summary "Configuring system services ceilosca"
|
||||
preinstall_ceilosca
|
||||
|
||||
|
||||
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
|
||||
# Perform installation of service source
|
||||
echo_summary "Installing ceilosca"
|
||||
install_ceilosca
|
||||
|
||||
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
|
||||
# Configure after the other layer 1 and 2 services have been configured
|
||||
echo_summary "Configuring ceilosca"
|
||||
configure_ceilosca
|
||||
|
||||
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
|
||||
# Initialize and start the template service
|
||||
echo_summary "Initializing ceilosca"
|
||||
init_ceilosca
|
||||
fi
|
||||
|
||||
if [[ "$1" == "unstack" ]]; then
|
||||
# Shut down template services
|
||||
# no-op
|
||||
:
|
||||
fi
|
||||
|
||||
if [[ "$1" == "clean" ]]; then
|
||||
# Remove state and transient data
|
||||
# Remember clean.sh first calls unstack.sh
|
||||
# no-op
|
||||
:
|
||||
fi
|
||||
fi
|
|
@ -0,0 +1,11 @@
|
|||
# settings file for ceilosca
|
||||
|
||||
source $DEST/ceilometer/devstack/settings
|
||||
|
||||
enable_service ceilosca
|
||||
|
||||
MONASCA_API_URL=http://$SERVICE_HOST:8070/v2.0
|
||||
CEILOSCA_DIR=$DEST/ceilosca
|
||||
CEILOSCA_FILES='ceilometer/monasca_client.py ceilometer/publisher/monasca_data_filter.py ceilometer/publisher/monclient.py ceilometer/storage/impl_monasca.py ../devstack/setup.cfg:.'
|
||||
CEILOSCA_CONF_FILES='pipeline.yaml monasca_field_definitions.yaml'
|
||||
CEILOSCA_USER=$USER
|
|
@ -5,7 +5,7 @@ description-file =
|
|||
README.rst
|
||||
author = OpenStack
|
||||
author-email = openstack-dev@lists.openstack.org
|
||||
home-page = http://www.openstack.org/
|
||||
home-page = http://docs.openstack.org/developer/ceilometer/
|
||||
classifier =
|
||||
Environment :: OpenStack
|
||||
Intended Audience :: Information Technology
|
||||
|
@ -52,8 +52,6 @@ ceilometer.notification =
|
|||
network.services.vpn.ikepolicy = ceilometer.network.notifications:IKEPolicy
|
||||
network.services.vpn.connections = ceilometer.network.notifications:IPSecSiteConnection
|
||||
_sample = ceilometer.telemetry.notifications:TelemetryIpc
|
||||
trove.instance.exists = ceilometer.database.notifications:InstanceExists
|
||||
dns.domain.exists = ceilometer.dns.notifications:DomainExists
|
||||
meter = ceilometer.meter.notifications:ProcessMeterNotifications
|
||||
|
||||
ceilometer.discover =
|
||||
|
@ -64,6 +62,8 @@ ceilometer.discover =
|
|||
lb_pools = ceilometer.network.services.discovery:LBPoolsDiscovery
|
||||
lb_vips = ceilometer.network.services.discovery:LBVipsDiscovery
|
||||
lb_members = ceilometer.network.services.discovery:LBMembersDiscovery
|
||||
lb_listeners = ceilometer.network.services.discovery:LBListenersDiscovery
|
||||
lb_loadbalancers = ceilometer.network.services.discovery:LBLoadBalancersDiscovery
|
||||
lb_health_probes = ceilometer.network.services.discovery:LBHealthMonitorsDiscovery
|
||||
vpn_services = ceilometer.network.services.discovery:VPNServicesDiscovery
|
||||
ipsec_connections = ceilometer.network.services.discovery:IPSecConnectionsDiscovery
|
||||
|
@ -167,6 +167,8 @@ ceilometer.poll.central =
|
|||
network.services.lb.pool = ceilometer.network.services.lbaas:LBPoolPollster
|
||||
network.services.lb.vip = ceilometer.network.services.lbaas:LBVipPollster
|
||||
network.services.lb.member = ceilometer.network.services.lbaas:LBMemberPollster
|
||||
network.services.lb.listener = ceilometer.network.services.lbaas:LBListenerPollster
|
||||
network.services.lb.loadbalancer = ceilometer.network.services.lbaas:LBLoadBalancerPollster
|
||||
network.services.lb.health_monitor = ceilometer.network.services.lbaas:LBHealthMonitorPollster
|
||||
network.services.lb.total.connections = ceilometer.network.services.lbaas:LBTotalConnectionsPollster
|
||||
network.services.lb.active.connections = ceilometer.network.services.lbaas:LBActiveConnectionsPollster
|
||||
|
@ -180,15 +182,6 @@ ceilometer.poll.central =
|
|||
ceilometer.builder.poll.central =
|
||||
hardware.snmp = ceilometer.hardware.pollsters.generic:GenericHardwareDeclarativePollster
|
||||
|
||||
ceilometer.alarm.storage =
|
||||
log = ceilometer.alarm.storage.impl_log:Connection
|
||||
mongodb = ceilometer.alarm.storage.impl_mongodb:Connection
|
||||
mysql = ceilometer.alarm.storage.impl_sqlalchemy:Connection
|
||||
postgresql = ceilometer.alarm.storage.impl_sqlalchemy:Connection
|
||||
sqlite = ceilometer.alarm.storage.impl_sqlalchemy:Connection
|
||||
hbase = ceilometer.alarm.storage.impl_hbase:Connection
|
||||
db2 = ceilometer.alarm.storage.impl_db2:Connection
|
||||
|
||||
ceilometer.event.storage =
|
||||
es = ceilometer.event.storage.impl_elasticsearch:Connection
|
||||
log = ceilometer.event.storage.impl_log:Connection
|
||||
|
@ -228,9 +221,6 @@ ceilometer.transformer =
|
|||
|
||||
ceilometer.publisher =
|
||||
test = ceilometer.publisher.test:TestPublisher
|
||||
meter_publisher = ceilometer.publisher.messaging:RPCPublisher
|
||||
meter = ceilometer.publisher.messaging:RPCPublisher
|
||||
rpc = ceilometer.publisher.messaging:RPCPublisher
|
||||
notifier = ceilometer.publisher.messaging:SampleNotifierPublisher
|
||||
udp = ceilometer.publisher.udp:UDPPublisher
|
||||
file = ceilometer.publisher.file:FilePublisher
|
||||
|
@ -244,50 +234,33 @@ ceilometer.event.publisher =
|
|||
notifier = ceilometer.publisher.messaging:EventNotifierPublisher
|
||||
kafka = ceilometer.publisher.kafka_broker:KafkaBrokerPublisher
|
||||
|
||||
ceilometer.alarm.rule =
|
||||
threshold = ceilometer.api.controllers.v2.alarm_rules.threshold:AlarmThresholdRule
|
||||
combination = ceilometer.api.controllers.v2.alarm_rules.combination:AlarmCombinationRule
|
||||
gnocchi_resources_threshold = ceilometer.api.controllers.v2.alarm_rules.gnocchi:MetricOfResourceRule
|
||||
gnocchi_aggregation_by_metrics_threshold = ceilometer.api.controllers.v2.alarm_rules.gnocchi:AggregationMetricsByIdLookupRule
|
||||
gnocchi_aggregation_by_resources_threshold = ceilometer.api.controllers.v2.alarm_rules.gnocchi:AggregationMetricByResourcesLookupRule
|
||||
|
||||
ceilometer.alarm.evaluator =
|
||||
threshold = ceilometer.alarm.evaluator.threshold:ThresholdEvaluator
|
||||
combination = ceilometer.alarm.evaluator.combination:CombinationEvaluator
|
||||
gnocchi_resources_threshold = ceilometer.alarm.evaluator.gnocchi:GnocchiThresholdEvaluator
|
||||
gnocchi_aggregation_by_metrics_threshold = ceilometer.alarm.evaluator.gnocchi:GnocchiThresholdEvaluator
|
||||
gnocchi_aggregation_by_resources_threshold = ceilometer.alarm.evaluator.gnocchi:GnocchiThresholdEvaluator
|
||||
|
||||
ceilometer.alarm.notifier =
|
||||
log = ceilometer.alarm.notifier.log:LogAlarmNotifier
|
||||
test = ceilometer.alarm.notifier.test:TestAlarmNotifier
|
||||
http = ceilometer.alarm.notifier.rest:RestAlarmNotifier
|
||||
https = ceilometer.alarm.notifier.rest:RestAlarmNotifier
|
||||
trust+http = ceilometer.alarm.notifier.trust:TrustRestAlarmNotifier
|
||||
trust+https = ceilometer.alarm.notifier.trust:TrustRestAlarmNotifier
|
||||
|
||||
ceilometer.event.trait_plugin =
|
||||
split = ceilometer.event.trait_plugins:SplitterTraitPlugin
|
||||
bitfield = ceilometer.event.trait_plugins:BitfieldTraitPlugin
|
||||
timedelta = ceilometer.event.trait_plugins:TimedeltaPlugin
|
||||
|
||||
|
||||
console_scripts =
|
||||
ceilometer-api = ceilometer.cmd.api:main
|
||||
ceilometer-polling = ceilometer.cmd.eventlet.polling:main
|
||||
ceilometer-agent-notification = ceilometer.cmd.eventlet.agent_notification:main
|
||||
ceilometer-send-sample = ceilometer.cmd.eventlet.sample:send_sample
|
||||
ceilometer-dbsync = ceilometer.cmd.eventlet.storage:dbsync
|
||||
ceilometer-expirer = ceilometer.cmd.eventlet.storage:expirer
|
||||
ceilometer-polling = ceilometer.cmd.polling:main
|
||||
ceilometer-agent-notification = ceilometer.cmd.agent_notification:main
|
||||
ceilometer-send-sample = ceilometer.cmd.sample:send_sample
|
||||
ceilometer-dbsync = ceilometer.cmd.storage:dbsync
|
||||
ceilometer-expirer = ceilometer.cmd.storage:expirer
|
||||
ceilometer-rootwrap = oslo_rootwrap.cmd:main
|
||||
ceilometer-collector = ceilometer.cmd.eventlet.collector:main
|
||||
ceilometer-alarm-evaluator = ceilometer.cmd.eventlet.alarm:evaluator
|
||||
ceilometer-alarm-notifier = ceilometer.cmd.eventlet.alarm:notifier
|
||||
ceilometer-collector = ceilometer.cmd.collector:main
|
||||
|
||||
ceilometer.dispatcher =
|
||||
ceilometer.dispatcher.meter =
|
||||
database = ceilometer.dispatcher.database:DatabaseDispatcher
|
||||
file = ceilometer.dispatcher.file:FileDispatcher
|
||||
http = ceilometer.dispatcher.http:HttpDispatcher
|
||||
gnocchi = ceilometer.dispatcher.gnocchi:GnocchiDispatcher
|
||||
|
||||
ceilometer.dispatcher.event =
|
||||
database = ceilometer.dispatcher.database:DatabaseDispatcher
|
||||
file = ceilometer.dispatcher.file:FileDispatcher
|
||||
http = ceilometer.dispatcher.http:HttpDispatcher
|
||||
|
||||
network.statistics.drivers =
|
||||
opendaylight = ceilometer.network.statistics.opendaylight.driver:OpenDayLightDriver
|
||||
opencontrail = ceilometer.network.statistics.opencontrail.driver:OpencontrailDriver
|
||||
|
@ -295,6 +268,15 @@ network.statistics.drivers =
|
|||
oslo.config.opts =
|
||||
ceilometer = ceilometer.opts:list_opts
|
||||
|
||||
oslo.config.opts.defaults =
|
||||
ceilometer = ceilometer.conf.defaults:set_cors_middleware_defaults
|
||||
|
||||
keystoneauth1.plugin =
|
||||
password-ceilometer-legacy = ceilometer.keystone_client:LegacyCeilometerKeystoneLoader
|
||||
|
||||
tempest.test_plugins =
|
||||
ceilometer_tests = ceilometer.tests.tempest.plugin:CeilometerTempestPlugin
|
||||
|
||||
[build_sphinx]
|
||||
all_files = 1
|
||||
build-dir = doc/build
|
|
@ -14,9 +14,14 @@ rabbit_password = password
|
|||
rabbit_hosts = 16.78.179.83
|
||||
|
||||
[service_credentials]
|
||||
os_tenant_name = mini-mon
|
||||
os_password = password
|
||||
os_username = mini-mon
|
||||
auth_url = http://192.168.10.6:5000
|
||||
region_name = RegionOne
|
||||
password = secretservice
|
||||
username = ceilometer
|
||||
project_name = service
|
||||
project_domain_id = default
|
||||
user_domain_id = default
|
||||
auth_type = password
|
||||
|
||||
[keystone_authtoken]
|
||||
signing_dir = /var/cache/ceilometer
|
||||
|
|
|
@ -10,4 +10,4 @@ sinks:
|
|||
- name: meter_sink
|
||||
transformers:
|
||||
publishers:
|
||||
- monasca://http://127.0.0.1:8070/v2.0
|
||||
- monasca://http://192.168.10.6:8070/v2.0
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
hacking<0.11,>=0.10.0
|
||||
git+https://github.com/openstack/ceilometer.git@stable/liberty#egg=ceilometer
|
||||
git+https://github.com/openstack/ceilometer.git@stable/mitaka#egg=ceilometer
|
||||
mock>=1.2
|
||||
testrepository>=0.0.18
|
||||
testscenarios>=0.4
|
||||
|
|
Loading…
Reference in New Issue