2015-06-27 11:13:10 +00:00
|
|
|
# Install and start **Ceilometer** service in devstack
|
|
|
|
#
|
|
|
|
# To enable Ceilometer in devstack add an entry to local.conf that
|
|
|
|
# looks like
|
|
|
|
#
|
|
|
|
# [[local|localrc]]
|
2019-04-22 10:21:33 +08:00
|
|
|
# enable_plugin ceilometer https://opendev.org/openstack/ceilometer
|
2015-06-27 11:13:10 +00:00
|
|
|
#
|
2016-03-30 21:57:31 -04:00
|
|
|
# By default all ceilometer services are started (see devstack/settings)
|
|
|
|
# except for the ceilometer-aipmi service. To disable a specific service
|
|
|
|
# use the disable_service function.
|
2015-06-27 11:13:10 +00:00
|
|
|
#
|
|
|
|
# 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
|
2016-03-30 21:57:31 -04:00
|
|
|
# ceilometer-anotification service.
|
2015-06-27 11:13:10 +00:00
|
|
|
#
|
|
|
|
# The other way is to use Ceilometer ipmi agent only to get the IPMI based
|
2016-03-30 21:57:31 -04:00
|
|
|
# meters. To make use of the Ceilometer ipmi agent, it must be explicitly
|
|
|
|
# enabled with the following setting:
|
|
|
|
#
|
|
|
|
# enable_service ceilometer-aipmi
|
|
|
|
#
|
|
|
|
# To avoid duplicated meters, users need to make sure to set the
|
2015-06-27 11:13:10 +00:00
|
|
|
# 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):
|
|
|
|
#
|
2024-02-20 02:03:07 -05:00
|
|
|
# CEILOMETER_PIPELINE_INTERVAL: Seconds between pipeline processing runs. Default 300.
|
2023-10-12 04:02:43 -04:00
|
|
|
# CEILOMETER_BACKENDS: List of database backends (e.g. 'gnocchi', 'sg-core', 'gnocchi,sg-core', 'none')
|
2015-06-27 11:13:10 +00:00
|
|
|
# CEILOMETER_COORDINATION_URL: URL for group membership service provided by tooz.
|
2015-09-02 01:48:05 +09:00
|
|
|
# CEILOMETER_EVENT_ALARM: Set to True to enable publisher for event alarming
|
2015-06-27 11:13:10 +00:00
|
|
|
|
2015-07-16 12:49:13 +00:00
|
|
|
# Save trace setting
|
|
|
|
XTRACE=$(set +o | grep xtrace)
|
|
|
|
set -o xtrace
|
|
|
|
|
2015-06-27 11:13:10 +00:00
|
|
|
# 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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-05-29 12:21:03 +02:00
|
|
|
function gnocchi_service_url {
|
|
|
|
echo "$GNOCCHI_SERVICE_PROTOCOL://$GNOCCHI_SERVICE_HOST/metric"
|
|
|
|
}
|
|
|
|
|
2015-06-27 11:13:10 +00:00
|
|
|
|
2015-07-10 13:04:12 +00:00
|
|
|
# _ceilometer_install_redis() - Install the redis server and python lib.
|
|
|
|
function _ceilometer_install_redis {
|
2015-06-27 11:13:10 +00:00
|
|
|
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
|
2017-12-19 11:05:42 +01:00
|
|
|
if is_suse; then
|
|
|
|
# opensuse intsall multi-instance version of redis
|
|
|
|
# and admin is expected to install the required conf
|
|
|
|
cp /etc/redis/default.conf.example /etc/redis/default.conf
|
|
|
|
restart_service redis@default
|
|
|
|
else
|
|
|
|
restart_service redis
|
|
|
|
fi
|
2015-06-27 11:13:10 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
pip_install_gr redis
|
|
|
|
}
|
|
|
|
|
|
|
|
# Install required services for coordination
|
2015-07-10 13:04:12 +00:00
|
|
|
function _ceilometer_prepare_coordination {
|
2015-06-27 11:13:10 +00:00
|
|
|
if echo $CEILOMETER_COORDINATION_URL | grep -q '^memcached:'; then
|
|
|
|
install_package memcached
|
2023-10-12 04:02:43 -04:00
|
|
|
elif [[ "${CEILOMETER_COORDINATOR_URL%%:*}" == "redis" || "${CEILOMETER_CACHE_BACKEND##*.}" == "redis" || "${CEILOMETER_BACKENDS}" =~ "gnocchi" ]]; then
|
2015-07-10 13:04:12 +00:00
|
|
|
_ceilometer_install_redis
|
2015-06-27 11:13:10 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Install the python modules for inspecting nova virt instances
|
2015-07-10 13:04:12 +00:00
|
|
|
function _ceilometer_prepare_virt_drivers {
|
2015-06-27 11:13:10 +00:00
|
|
|
# Only install virt drivers if we're running nova compute
|
|
|
|
if is_service_enabled n-cpu ; then
|
2021-08-15 23:51:42 +09:00
|
|
|
# NOTE(tkajinam): pythonN-libvirt is installed using distro
|
|
|
|
# packages in devstack
|
2015-06-27 11:13:10 +00:00
|
|
|
|
|
|
|
if [[ "$VIRT_DRIVER" = 'vsphere' ]]; then
|
2015-08-06 09:27:32 +00:00
|
|
|
pip_install_gr oslo.vmware
|
2015-06-27 11:13:10 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Create ceilometer related accounts in Keystone
|
2016-03-18 06:24:27 +00:00
|
|
|
function ceilometer_create_accounts {
|
2016-12-20 18:07:26 +00:00
|
|
|
# At this time, the /etc/openstack/clouds.yaml is available,
|
|
|
|
# we could leverage that by setting OS_CLOUD
|
|
|
|
OLD_OS_CLOUD=$OS_CLOUD
|
|
|
|
export OS_CLOUD='devstack-admin'
|
2015-06-27 11:13:10 +00:00
|
|
|
|
2016-12-20 18:07:26 +00:00
|
|
|
create_service_user "ceilometer" "admin"
|
2015-06-27 11:13:10 +00:00
|
|
|
|
2016-12-20 18:07:26 +00:00
|
|
|
if is_service_enabled swift; then
|
|
|
|
# Ceilometer needs ResellerAdmin role to access Swift account stats.
|
|
|
|
get_or_add_user_project_role "ResellerAdmin" "ceilometer" $SERVICE_PROJECT_NAME
|
2015-06-27 11:13:10 +00:00
|
|
|
fi
|
2016-12-20 18:07:26 +00:00
|
|
|
|
2023-10-12 04:02:43 -04:00
|
|
|
if ! [[ $DEVSTACK_PLUGINS =~ 'gnocchi' ]] && [[ "$CEILOMETER_BACKENDS" =~ "gnocchi" ]]; then
|
2017-05-29 12:21:03 +02:00
|
|
|
create_service_user "gnocchi"
|
|
|
|
local gnocchi_service=$(get_or_create_service "gnocchi" \
|
|
|
|
"metric" "OpenStack Metric Service")
|
|
|
|
get_or_create_endpoint $gnocchi_service \
|
|
|
|
"$REGION_NAME" \
|
|
|
|
"$(gnocchi_service_url)" \
|
|
|
|
"$(gnocchi_service_url)" \
|
|
|
|
"$(gnocchi_service_url)"
|
|
|
|
fi
|
2016-12-20 18:07:26 +00:00
|
|
|
export OS_CLOUD=$OLD_OS_CLOUD
|
2015-06-27 11:13:10 +00:00
|
|
|
}
|
|
|
|
|
2017-05-29 12:21:03 +02:00
|
|
|
|
|
|
|
function install_gnocchi {
|
|
|
|
echo_summary "Installing Gnocchi"
|
2023-01-31 12:03:05 -05:00
|
|
|
if use_library_from_git "gnocchi"; then
|
|
|
|
# we need to git clone manually to ensure that the git repo is added
|
|
|
|
# to the global git repo list and ensure its cloned as the current user
|
|
|
|
# not as root.
|
|
|
|
git_clone ${GNOCCHI_REPO} ${GNOCCHI_DIR} ${GNOCCHI_BRANCH}
|
|
|
|
pip_install -e ${GNOCCHI_DIR}[redis,${DATABASE_TYPE},keystone] uwsgi
|
2017-05-29 12:21:03 +02:00
|
|
|
else
|
|
|
|
pip_install gnocchi[redis,${DATABASE_TYPE},keystone] uwsgi
|
|
|
|
fi
|
2018-01-16 09:15:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function configure_gnocchi {
|
|
|
|
echo_summary "Configure Gnocchi"
|
|
|
|
|
2017-05-29 12:21:03 +02:00
|
|
|
recreate_database gnocchi
|
|
|
|
sudo install -d -o $STACK_USER -m 755 $GNOCCHI_CONF_DIR
|
|
|
|
|
|
|
|
iniset $GNOCCHI_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL"
|
|
|
|
iniset $GNOCCHI_CONF indexer url `database_connection_url gnocchi`
|
|
|
|
iniset $GNOCCHI_CONF storage driver redis
|
|
|
|
iniset $GNOCCHI_CONF storage redis_url redis://localhost:6379
|
|
|
|
iniset $GNOCCHI_CONF metricd metric_processing_delay "$GNOCCHI_METRICD_PROCESSING_DELAY"
|
|
|
|
|
|
|
|
iniset $GNOCCHI_CONF api auth_mode keystone
|
|
|
|
configure_auth_token_middleware $GNOCCHI_CONF gnocchi $GNOCCHI_AUTH_CACHE_DIR
|
|
|
|
|
|
|
|
sudo mkdir -p $GNOCCHI_AUTH_CACHE_DIR
|
|
|
|
sudo chown $STACK_USER $GNOCCHI_AUTH_CACHE_DIR
|
|
|
|
rm -f $GNOCCHI_AUTH_CACHE_DIR/*
|
|
|
|
|
|
|
|
gnocchi-upgrade
|
|
|
|
|
|
|
|
rm -f "$GNOCCHI_UWSGI_FILE"
|
|
|
|
|
2017-06-14 20:07:37 +00:00
|
|
|
write_uwsgi_config "$GNOCCHI_UWSGI_FILE" "$CEILOMETER_BIN_DIR/gnocchi-api" "/metric"
|
2017-05-29 12:21:03 +02:00
|
|
|
|
|
|
|
if [ -n "$GNOCCHI_COORDINATOR_URL" ]; then
|
2021-07-06 21:34:13 +09:00
|
|
|
iniset $GNOCCHI_CONF coordination_url "$GNOCCHI_COORDINATOR_URL"
|
2017-05-29 12:21:03 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2015-06-27 11:13:10 +00:00
|
|
|
# Activities to do before ceilometer has been installed.
|
|
|
|
function preinstall_ceilometer {
|
|
|
|
echo_summary "Preinstall not in virtualenv context. Skipping."
|
|
|
|
}
|
|
|
|
|
2015-11-25 01:45:20 +08:00
|
|
|
# cleanup_ceilometer() - Remove residual data files, anything left over
|
|
|
|
# from previous runs that a clean run would need to clean up
|
|
|
|
function cleanup_ceilometer {
|
|
|
|
sudo rm -f "$CEILOMETER_CONF_DIR"/*
|
|
|
|
sudo rmdir "$CEILOMETER_CONF_DIR"
|
2015-06-27 11:13:10 +00:00
|
|
|
}
|
|
|
|
|
2015-12-09 22:07:47 +00:00
|
|
|
# Set configuraiton for cache backend.
|
|
|
|
# NOTE(cdent): This currently only works for redis. Still working
|
|
|
|
# out how to express the other backends.
|
|
|
|
function _ceilometer_configure_cache_backend {
|
2016-10-17 16:15:56 +00:00
|
|
|
iniset $CEILOMETER_CONF cache enabled True
|
2015-12-09 22:07:47 +00:00
|
|
|
iniset $CEILOMETER_CONF cache backend $CEILOMETER_CACHE_BACKEND
|
2017-02-09 22:30:17 +00:00
|
|
|
|
|
|
|
inidelete $CEILOMETER_CONF cache backend_argument
|
|
|
|
iniadd $CEILOMETER_CONF cache backend_argument url:$CEILOMETER_CACHE_URL
|
|
|
|
iniadd $CEILOMETER_CONF cache backend_argument distributed_lock:True
|
2015-12-09 22:07:47 +00:00
|
|
|
if [[ "${CEILOMETER_CACHE_BACKEND##*.}" == "redis" ]]; then
|
2017-02-09 22:30:17 +00:00
|
|
|
iniadd $CEILOMETER_CONF cache backend_argument db:0
|
|
|
|
iniadd $CEILOMETER_CONF cache backend_argument redis_expiration_time:600
|
2015-12-09 22:07:47 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-27 11:13:10 +00:00
|
|
|
# Set configuration for storage backend.
|
2015-07-10 13:04:12 +00:00
|
|
|
function _ceilometer_configure_storage_backend {
|
2023-11-09 04:57:30 -05:00
|
|
|
# delete any "," characters used for delimiting individual backends before checking for "none"
|
|
|
|
if [ $(echo "$CEILOMETER_BACKENDS" | tr -d ",") = 'none' ] ; then
|
2023-10-12 04:02:43 -04:00
|
|
|
echo_summary "All Ceilometer backends seems disabled, set \$CEILOMETER_BACKENDS to select one."
|
2015-06-27 11:13:10 +00:00
|
|
|
else
|
2024-01-24 21:36:12 +09:00
|
|
|
head -n -1 $CEILOMETER_CONF_DIR/pipeline.yaml > $CEILOMETER_CONF_DIR/tmp ; mv $CEILOMETER_CONF_DIR/tmp $CEILOMETER_CONF_DIR/pipeline.yaml
|
|
|
|
head -n -1 $CEILOMETER_CONF_DIR/event_pipeline.yaml > $CEILOMETER_CONF_DIR/tmp ; mv $CEILOMETER_CONF_DIR/tmp $CEILOMETER_CONF_DIR/event_pipeline.yaml
|
|
|
|
|
|
|
|
BACKENDS=$(echo $CEILOMETER_BACKENDS | tr "," "\n")
|
|
|
|
for CEILOMETER_BACKEND in ${BACKENDS[@]}
|
|
|
|
do
|
|
|
|
if [ "$CEILOMETER_BACKEND" = 'gnocchi' ] ; then
|
|
|
|
echo " - gnocchi://?archive_policy=${GNOCCHI_ARCHIVE_POLICY}&filter_project=service" >> $CEILOMETER_CONF_DIR/event_pipeline.yaml
|
|
|
|
echo " - gnocchi://?archive_policy=${GNOCCHI_ARCHIVE_POLICY}&filter_project=service" >> $CEILOMETER_CONF_DIR/pipeline.yaml
|
|
|
|
! [[ $DEVSTACK_PLUGINS =~ 'gnocchi' ]] && configure_gnocchi
|
|
|
|
elif [ "$CEILOMETER_BACKEND" = 'sg-core' ] ; then
|
|
|
|
echo " - tcp://127.0.0.1:4242" >> $CEILOMETER_CONF_DIR/event_pipeline.yaml
|
|
|
|
echo " - tcp://127.0.0.1:4242" >> $CEILOMETER_CONF_DIR/pipeline.yaml
|
|
|
|
else
|
|
|
|
die $LINENO "Unable to configure unknown CEILOMETER_BACKEND $CEILOMETER_BACKEND"
|
|
|
|
fi
|
|
|
|
done
|
2015-06-27 11:13:10 +00:00
|
|
|
fi
|
2017-01-10 17:59:40 +00:00
|
|
|
|
2015-06-27 11:13:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Configure Ceilometer
|
|
|
|
function configure_ceilometer {
|
|
|
|
|
2015-10-09 13:12:29 +00:00
|
|
|
local conffile
|
|
|
|
|
2015-06-27 11:13:10 +00:00
|
|
|
iniset_rpc_backend ceilometer $CEILOMETER_CONF
|
|
|
|
|
2016-03-17 08:55:54 +08:00
|
|
|
iniset $CEILOMETER_CONF oslo_messaging_notifications topics "$CEILOMETER_NOTIFICATION_TOPICS"
|
2015-06-27 11:13:10 +00:00
|
|
|
iniset $CEILOMETER_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL"
|
|
|
|
|
|
|
|
if [[ -n "$CEILOMETER_COORDINATION_URL" ]]; then
|
|
|
|
iniset $CEILOMETER_CONF coordination backend_url $CEILOMETER_COORDINATION_URL
|
2016-01-14 15:31:24 -05:00
|
|
|
iniset $CEILOMETER_CONF notification workers $API_WORKERS
|
2015-06-27 11:13:10 +00:00
|
|
|
fi
|
|
|
|
|
2015-12-09 22:07:47 +00:00
|
|
|
if [[ -n "$CEILOMETER_CACHE_BACKEND" ]]; then
|
|
|
|
_ceilometer_configure_cache_backend
|
|
|
|
fi
|
|
|
|
|
2015-10-09 13:12:29 +00:00
|
|
|
# Install the policy file and declarative configuration files to
|
|
|
|
# the conf dir.
|
|
|
|
# NOTE(cdent): Do not make this a glob as it will conflict
|
|
|
|
# with rootwrap installation done elsewhere and also clobber
|
|
|
|
# ceilometer.conf settings that have already been made.
|
|
|
|
# Anyway, explicit is better than implicit.
|
2017-06-20 17:04:45 +02:00
|
|
|
cp $CEILOMETER_DIR/etc/ceilometer/polling_all.yaml $CEILOMETER_CONF_DIR/polling.yaml
|
2015-06-27 11:13:10 +00:00
|
|
|
|
2017-03-06 10:55:38 +08:00
|
|
|
cp $CEILOMETER_DIR/ceilometer/pipeline/data/*.yaml $CEILOMETER_CONF_DIR
|
|
|
|
|
2015-06-27 11:13:10 +00:00
|
|
|
if [ "$CEILOMETER_PIPELINE_INTERVAL" ]; then
|
2016-11-30 16:53:08 +00:00
|
|
|
sed -i "s/interval:.*/interval: ${CEILOMETER_PIPELINE_INTERVAL}/" $CEILOMETER_CONF_DIR/polling.yaml
|
2015-06-27 11:13:10 +00:00
|
|
|
fi
|
2015-09-02 01:48:05 +09:00
|
|
|
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
|
2015-06-27 11:13:10 +00:00
|
|
|
|
|
|
|
# The compute and central agents need these credentials in order to
|
|
|
|
# call out to other services' public APIs.
|
2016-02-01 08:49:01 +01:00
|
|
|
iniset $CEILOMETER_CONF service_credentials auth_type password
|
2016-02-10 10:12:25 +01:00
|
|
|
iniset $CEILOMETER_CONF service_credentials user_domain_id default
|
|
|
|
iniset $CEILOMETER_CONF service_credentials project_domain_id default
|
2016-02-23 11:41:24 +08:00
|
|
|
iniset $CEILOMETER_CONF service_credentials project_name $SERVICE_PROJECT_NAME
|
2016-02-01 08:49:01 +01:00
|
|
|
iniset $CEILOMETER_CONF service_credentials username ceilometer
|
|
|
|
iniset $CEILOMETER_CONF service_credentials password $SERVICE_PASSWORD
|
|
|
|
iniset $CEILOMETER_CONF service_credentials region_name $REGION_NAME
|
|
|
|
iniset $CEILOMETER_CONF service_credentials auth_url $KEYSTONE_SERVICE_URI
|
2015-06-27 11:13:10 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2017-10-16 11:31:51 +02:00
|
|
|
_ceilometer_configure_storage_backend
|
2015-06-27 11:13:10 +00:00
|
|
|
|
|
|
|
if is_service_enabled ceilometer-aipmi; then
|
|
|
|
# Configure rootwrap for the ipmi agent
|
|
|
|
configure_rootwrap ceilometer
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# init_ceilometer() - Initialize etc.
|
|
|
|
function init_ceilometer {
|
2023-12-25 20:30:14 +09:00
|
|
|
# Nothing to do
|
|
|
|
:
|
2015-06-27 11:13:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# 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 {
|
2017-05-29 12:21:03 +02:00
|
|
|
if is_service_enabled ceilometer-acentral ceilometer-acompute ceilometer-anotification gnocchi-api gnocchi-metricd; then
|
2015-11-11 01:15:58 -07:00
|
|
|
_ceilometer_prepare_coordination
|
|
|
|
fi
|
|
|
|
|
2023-10-12 04:02:43 -04:00
|
|
|
! [[ $DEVSTACK_PLUGINS =~ 'gnocchi' ]] && [[ "$CEILOMETER_BACKENDS" =~ 'gnocchi' ]] && install_gnocchi
|
2017-05-29 12:21:03 +02:00
|
|
|
|
2015-11-11 01:15:58 -07:00
|
|
|
if is_service_enabled ceilometer-acompute ; then
|
|
|
|
_ceilometer_prepare_virt_drivers
|
|
|
|
fi
|
|
|
|
|
2023-10-12 04:02:43 -04:00
|
|
|
if [[ "$CEILOMETER_BACKENDS" =~ 'gnocchi' ]]; then
|
2024-01-24 21:36:12 +09:00
|
|
|
extra=gnocchi
|
2023-10-12 04:02:43 -04:00
|
|
|
fi
|
2017-09-28 14:08:19 +02:00
|
|
|
setup_develop $CEILOMETER_DIR $extra
|
2015-10-22 08:37:14 -06:00
|
|
|
sudo install -d -o $STACK_USER -m 755 $CEILOMETER_CONF_DIR
|
2015-06-27 11:13:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# start_ceilometer() - Start running processes, including screen
|
|
|
|
function start_ceilometer {
|
2017-05-29 12:21:03 +02:00
|
|
|
|
2023-10-12 04:02:43 -04:00
|
|
|
if ! [[ $DEVSTACK_PLUGINS =~ 'gnocchi' ]] && [[ "$CEILOMETER_BACKENDS" =~ "gnocchi" ]] ; then
|
2017-06-14 20:07:37 +00:00
|
|
|
run_process gnocchi-api "$CEILOMETER_BIN_DIR/uwsgi --ini $GNOCCHI_UWSGI_FILE" ""
|
|
|
|
run_process gnocchi-metricd "$CEILOMETER_BIN_DIR/gnocchi-metricd --config-file $GNOCCHI_CONF"
|
2017-05-29 12:21:03 +02:00
|
|
|
wait_for_service 30 "$(gnocchi_service_url)"
|
2017-10-17 18:14:01 +02:00
|
|
|
$CEILOMETER_BIN_DIR/ceilometer-upgrade
|
2017-05-29 12:21:03 +02:00
|
|
|
fi
|
|
|
|
|
2015-08-13 14:00:03 +02:00
|
|
|
run_process ceilometer-acentral "$CEILOMETER_BIN_DIR/ceilometer-polling --polling-namespaces central --config-file $CEILOMETER_CONF"
|
|
|
|
run_process ceilometer-aipmi "$CEILOMETER_BIN_DIR/ceilometer-polling --polling-namespaces ipmi --config-file $CEILOMETER_CONF"
|
2015-06-27 11:13:10 +00:00
|
|
|
|
2017-09-14 21:23:37 +00:00
|
|
|
# run the notification agent after restarting apache as it needs
|
2015-07-15 16:28:36 +00:00
|
|
|
# operational keystone if using gnocchi
|
2017-03-13 20:11:55 +00:00
|
|
|
run_process ceilometer-anotification "$CEILOMETER_BIN_DIR/ceilometer-agent-notification --config-file $CEILOMETER_CONF"
|
2015-07-15 16:28:36 +00:00
|
|
|
|
2017-09-14 21:23:37 +00:00
|
|
|
# Start the compute agent late to allow time for the notification agent to
|
2015-06-27 11:13:10 +00:00
|
|
|
# fully wake up and connect to the message bus. See bug #1355809
|
|
|
|
if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then
|
2015-08-13 14:00:03 +02:00
|
|
|
run_process ceilometer-acompute "$CEILOMETER_BIN_DIR/ceilometer-polling --polling-namespaces compute --config-file $CEILOMETER_CONF" $LIBVIRT_GROUP
|
2015-06-27 11:13:10 +00:00
|
|
|
fi
|
|
|
|
if [[ "$VIRT_DRIVER" = 'vsphere' ]]; then
|
2015-08-13 14:00:03 +02:00
|
|
|
run_process ceilometer-acompute "$CEILOMETER_BIN_DIR/ceilometer-polling --polling-namespaces compute --config-file $CEILOMETER_CONF"
|
2015-06-27 11:13:10 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# stop_ceilometer() - Stop running processes
|
|
|
|
function stop_ceilometer {
|
2015-10-05 14:27:50 +00:00
|
|
|
|
2018-04-18 13:25:23 +00:00
|
|
|
# Kill the ceilometer and gnocchi services
|
|
|
|
for serv in ceilometer-acompute ceilometer-acentral ceilometer-aipmi ceilometer-anotification gnocchi-api gnocchi-metricd; do
|
2015-06-27 11:13:10 +00:00
|
|
|
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"
|
2016-12-07 07:04:04 +00:00
|
|
|
# Use stack_install_service here to account for virtualenv
|
2015-06-27 11:13:10 +00:00
|
|
|
stack_install_service ceilometer
|
|
|
|
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
|
|
|
|
echo_summary "Configuring Ceilometer"
|
|
|
|
configure_ceilometer
|
2016-03-18 06:24:27 +00:00
|
|
|
# Get ceilometer keystone settings in place
|
|
|
|
ceilometer_create_accounts
|
2015-06-27 11:13:10 +00:00
|
|
|
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
|
|
|
|
echo_summary "Initializing Ceilometer"
|
|
|
|
# Tidy base for ceilometer
|
|
|
|
init_ceilometer
|
|
|
|
# Start the services
|
|
|
|
start_ceilometer
|
2017-04-25 14:31:00 +02:00
|
|
|
elif [[ "$1" == "stack" && "$2" == "test-config" ]]; then
|
|
|
|
iniset $TEMPEST_CONFIG telemetry alarm_granularity $CEILOMETER_ALARM_GRANULARITY
|
2019-04-19 13:31:05 +08:00
|
|
|
iniset $TEMPEST_CONFIG telemetry alarm_threshold $CEILOMETER_ALARM_THRESHOLD
|
|
|
|
iniset $TEMPEST_CONFIG telemetry alarm_metric_name $CEILOMETER_ALARM_METRIC_NAME
|
|
|
|
iniset $TEMPEST_CONFIG telemetry alarm_aggregation_method $CEILOMETER_ALARM_AGGREGATION_METHOD
|
2015-06-27 11:13:10 +00:00
|
|
|
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
|
2015-07-16 12:49:13 +00:00
|
|
|
|
|
|
|
# Restore xtrace
|
|
|
|
$XTRACE
|