Add config-internal/config-external for Ceilometer

Partially Implements: Blueprint standard-start

Change-Id: I0c9fea2014a23ca0b08f9a0946472cc877edacbc
This commit is contained in:
Swapnil Kulkarni 2015-07-03 06:14:29 +00:00
parent fcda6a06d8
commit 4c25113d30
36 changed files with 258 additions and 84 deletions

View File

@ -4,4 +4,6 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum install -y openstack-ceilometer-alarm && yum clean all
ADD ./start.sh /start.sh
COPY config-internal.sh config-external.sh /opt/kolla/
CMD ["/start.sh"]

View File

@ -0,0 +1 @@
../../../../common/ceilometer/ceilometer-alarm/config-external.sh

View File

@ -0,0 +1 @@
../../../../common/ceilometer/ceilometer-alarm/config-internal.sh

View File

@ -4,4 +4,5 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum install -y openstack-ceilometer-api && yum clean all
ADD ./start.sh /start.sh
COPY config-internal.sh config-external.sh /opt/kolla/
CMD ["/start.sh"]

View File

@ -0,0 +1 @@
../../../../common/ceilometer/ceilometer-api/config-external.sh

View File

@ -0,0 +1 @@
../../../../common/ceilometer/ceilometer-api/config-internal.sh

View File

@ -4,4 +4,6 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum install -y openstack-ceilometer-central && yum clean all
ADD ./start.sh /start.sh
COPY config-internal.sh config-external.sh /opt/kolla/
CMD ["/start.sh"]

View File

@ -0,0 +1 @@
../../../../common/ceilometer/ceilometer-central/config-external.sh

View File

@ -0,0 +1 @@
../../../../common/ceilometer/ceilometer-central/config-internal.sh

View File

@ -4,4 +4,6 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum install -y openstack-ceilometer-collector && yum clean all
ADD ./start.sh /start.sh
COPY config-internal.sh config-external.sh /opt/kolla/
CMD ["/start.sh"]

View File

@ -0,0 +1 @@
../../../../common/ceilometer/ceilometer-collector/config-external.sh

View File

@ -0,0 +1 @@
../../../../common/ceilometer/ceilometer-collector/config-internal.sh

View File

@ -5,4 +5,6 @@ RUN yum install -y openstack-ceilometer-compute python-ceilometerclient python-p
&& yum clean all
ADD ./start.sh /start.sh
COPY config-internal.sh config-external.sh /opt/kolla/
CMD ["/start.sh"]

View File

@ -0,0 +1 @@
../../../../common/ceilometer/ceilometer-compute/config-external.sh

View File

@ -0,0 +1 @@
../../../../common/ceilometer/ceilometer-compute/config-internal.sh

View File

@ -4,4 +4,6 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla)
RUN yum install -y openstack-ceilometer-notification && yum clean all
ADD ./start.sh /start.sh
COPY config-internal.sh config-external.sh /opt/kolla/
CMD ["/start.sh"]

View File

@ -0,0 +1 @@
../../../../common/ceilometer/ceilometer-notification/config-external.sh

View File

@ -0,0 +1 @@
../../../../common/ceilometer/ceilometer-notification/config-internal.sh

View File

@ -0,0 +1,10 @@
#!/bin/bash
SOURCE="/opt/kolla/ceilometer/ceilometer.conf"
TARGET="/etc/ceilometer/ceilometer.conf"
OWNER="ceilometer"
if [[ -f "$SOURCE" ]]; then
cp $SOURCE $TARGET
chown ${OWNER}: $TARGET
chmod 0644 $TARGET
fi

View File

@ -0,0 +1,10 @@
#!/bin/bash
set -e
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-ceilometer.sh
exec /usr/bin/ceilometer-alarm-evaluator &
exec /usr/bin/ceilometer-alarm-notifier

View File

@ -1,10 +1,14 @@
#!/bin/bash
set -e
set -o errexit
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-ceilometer.sh
CMD="/usr/bin/ceilometer-alarm"
ARGS=""
# Loading common functions.
source /opt/kolla/kolla-common.sh
exec /usr/bin/ceilometer-alarm-evaluator &
exec /usr/bin/ceilometer-alarm-notifier
# Config-internal script exec out of this function, it does not return here.
set_configs
exec $CMD $ARGS

View File

@ -0,0 +1,10 @@
#!/bin/bash
SOURCE="/opt/kolla/ceilometer/ceilometer.conf"
TARGET="/etc/ceilometer/ceilometer.conf"
OWNER="ceilometer"
if [[ -f "$SOURCE" ]]; then
cp $SOURCE $TARGET
chown ${OWNER}: $TARGET
chmod 0644 $TARGET
fi

View File

@ -0,0 +1,51 @@
#!/bin/bash
set -e
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-ceilometer.sh
check_required_vars CEILOMETER_DB_USER CEILOMETER_DB_NAME \
CEILOMETER_DB_PASSWORD KEYSTONE_ADMIN_TOKEN \
KEYSTONE_AUTH_PROTOCOL KEYSTONE_ADMIN_SERVICE_HOST \
KEYSTONE_ADMIN_SERVICE_PORT ADMIN_TENANT_NAME \
CEILOMETER_KEYSTONE_USER CEILOMETER_ADMIN_PASSWORD \
CEILOMETER_API_SERVICE_HOST PUBLIC_IP
fail_unless_os_service_running keystone
fail_unless_db
#TODO(pkilambi): Add mongodb support
mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF
CREATE DATABASE IF NOT EXISTS ${CEILOMETER_DB_NAME} DEFAULT CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON ${CEILOMETER_DB_NAME}.* TO
'${CEILOMETER_DB_USER}'@'%' IDENTIFIED BY '${CEILOMETER_DB_PASSWORD}'
EOF
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v2.0"
crux user-create -n ${CEILOMETER_KEYSTONE_USER} \
-p ${CEILOMETER_ADMIN_PASSWORD} \
-t ${ADMIN_TENANT_NAME} \
-r admin
crux service-create -n ${CEILOMETER_KEYSTONE_USER} -t metering \
-d "Ceilometer Telemetry Service"
crux endpoint-create i--remove-all -n ${CEILOMETER_KEYSTONE_USER} -t metering \
-I "${KEYSTONE_AUTH_PROTOCOL}://${CEILOMETER_API_SERVICE_HOST}:8777" \
-P "${KEYSTONE_AUTH_PROTOCOL}://${PUBLIC_IP}:8777" \
-A "${KEYSTONE_AUTH_PROTOCOL}://${CEILOMETER_API_SERVICE_HOST}:8777"
cfg=/etc/ceilometer/ceilometer.conf
crudini --set $cfg \
DEFAULT connection
"mysql://${CEILOMETER_DB_USER}:${CEILOMETER_DB_PASSWORD}@${MARIADB_SERVICE_HOST}/${CEILOMETER_DB_NAME}"
exec /usr/bin/ceilometer-api

View File

@ -1,51 +1,21 @@
#!/bin/bash
set -e
set -o errexit
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-ceilometer.sh
CMD="/usr/bin/ceilometer-api"
ARGS=""
check_required_vars CEILOMETER_DB_USER CEILOMETER_DB_NAME \
CEILOMETER_DB_PASSWORD KEYSTONE_ADMIN_TOKEN \
KEYSTONE_AUTH_PROTOCOL KEYSTONE_ADMIN_SERVICE_HOST \
KEYSTONE_ADMIN_SERVICE_PORT ADMIN_TENANT_NAME \
CEILOMETER_KEYSTONE_USER CEILOMETER_ADMIN_PASSWORD \
CEILOMETER_API_SERVICE_HOST PUBLIC_IP
# Loading common functions.
source /opt/kolla/kolla-common.sh
fail_unless_os_service_running keystone
fail_unless_db
# Config-internal script exec out of this function, it does not return here.
set_configs
#TODO(pkilambi): Add mongodb support
# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
# of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
su -s /bin/sh -c "ceilometer-manage db_sync" ceilometer
exit 0
fi
mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF
CREATE DATABASE IF NOT EXISTS ${CEILOMETER_DB_NAME} DEFAULT CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON ${CEILOMETER_DB_NAME}.* TO
'${CEILOMETER_DB_USER}'@'%' IDENTIFIED BY '${CEILOMETER_DB_PASSWORD}'
EOF
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v2.0"
crux user-create -n ${CEILOMETER_KEYSTONE_USER} \
-p ${CEILOMETER_ADMIN_PASSWORD} \
-t ${ADMIN_TENANT_NAME} \
-r admin
crux service-create -n ${CEILOMETER_KEYSTONE_USER} -t metering \
-d "Ceilometer Telemetry Service"
crux endpoint-create i--remove-all -n ${CEILOMETER_KEYSTONE_USER} -t metering \
-I "${KEYSTONE_AUTH_PROTOCOL}://${CEILOMETER_API_SERVICE_HOST}:8777" \
-P "${KEYSTONE_AUTH_PROTOCOL}://${PUBLIC_IP}:8777" \
-A "${KEYSTONE_AUTH_PROTOCOL}://${CEILOMETER_API_SERVICE_HOST}:8777"
cfg=/etc/ceilometer/ceilometer.conf
crudini --set $cfg \
DEFAULT connection
"mysql://${CEILOMETER_DB_USER}:${CEILOMETER_DB_PASSWORD}@${MARIADB_SERVICE_HOST}/${CEILOMETER_DB_NAME}"
exec /usr/bin/ceilometer-api
exec $CMD $ARGS

View File

@ -0,0 +1,10 @@
#!/bin/bash
SOURCE="/opt/kolla/ceilometer/ceilometer.conf"
TARGET="/etc/ceilometer/ceilometer.conf"
OWNER="ceilometer"
if [[ -f "$SOURCE" ]]; then
cp $SOURCE $TARGET
chown ${OWNER}: $TARGET
chmod 0644 $TARGET
fi

View File

@ -0,0 +1,14 @@
#!/bin/bash
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-ceilometer.sh
check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_AUTH_PROTOCOL \
KEYSTONE_ADMIN_SERVICE_HOST KEYSTONE_ADMIN_SERVICE_PORT
fail_unless_os_service_running keystone
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v2.0"
exec /usr/bin/ceilometer-agent-central

View File

@ -1,14 +1,14 @@
#!/bin/bash
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-ceilometer.sh
set -o errexit
check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_AUTH_PROTOCOL \
KEYSTONE_ADMIN_SERVICE_HOST KEYSTONE_ADMIN_SERVICE_PORT
CMD="/usr/bin/ceilometer-agent-central"
ARGS=""
fail_unless_os_service_running keystone
# Loading common functions.
source /opt/kolla/kolla-common.sh
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v2.0"
# Config-internal script exec out of this function, it does not return here.
set_configs
exec /usr/bin/ceilometer-agent-central
exec $CMD $ARGS

View File

@ -0,0 +1,10 @@
#!/bin/bash
SOURCE="/opt/kolla/ceilometer/ceilometer.conf"
TARGET="/etc/ceilometer/ceilometer.conf"
OWNER="ceilometer"
if [[ -f "$SOURCE" ]]; then
cp $SOURCE $TARGET
chown ${OWNER}: $TARGET
chmod 0644 $TARGET
fi

View File

@ -0,0 +1,9 @@
#!/bin/bash
set -e
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-ceilometer.sh
exec /usr/bin/ceilometer-collector

View File

@ -1,9 +1,14 @@
#!/bin/bash
set -e
set -o errexit
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-ceilometer.sh
CMD="/usr/bin/ceilometer-collector"
ARGS=""
# Loading common functions.
source /opt/kolla/kolla-common.sh
exec /usr/bin/ceilometer-collector
# Config-internal script exec out of this function, it does not return here.
set_configs
exec $CMD $ARGS

View File

@ -0,0 +1,10 @@
#!/bin/bash
SOURCE="/opt/kolla/ceilometer/ceilometer.conf"
TARGET="/etc/ceilometer/ceilometer.conf"
OWNER="ceilometer"
if [[ -f "$SOURCE" ]]; then
cp $SOURCE $TARGET
chown ${OWNER}: $TARGET
chmod 0644 $TARGET
fi

View File

@ -0,0 +1,25 @@
#!/bin/bash
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-ceilometer.sh
check_required_vars KEYSTONE_ADMIN_TOKEN RABBITMQ_SERVICE_HOST RABBIT_PASSWORD
fail_unless_os_service_running keystone
# Nova conf settings
crudini --set /etc/nova/nova.conf DEFAULT instance_usage_audit True
crudini --set /etc/nova/nova.conf DEFAULT instance_usage_audit_period hour
crudini --set /etc/nova/nova.conf DEFAULT notify_on_state_change vm_and_task_state
crudini --set /etc/nova/nova.conf DEFAULT notification_driver nova.openstack.common.notifier.rpc_notifier
crudini --set /etc/nova/nova.conf DEFAULT notification_driver ceilometer.compute.nova_notifier
#ceilometer settings
cfg=/etc/ceilometer/ceilometer.conf
crudini --set $cfg publisher_rpc metering_secret ${KEYSTONE_ADMIN_TOKEN}
crudini --set $cfg rabbit_host ${RABBITMQ_SERVICE_HOST}
crudini --set $cfg rabbit_password ${RABBIT_PASSWORD}
exec /usr/bin/ceilometer-agent-compute

View File

@ -1,25 +1,14 @@
#!/bin/bash
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-ceilometer.sh
set -o errexit
CMD="/usr/bin/ceilometer-agent-compute"
ARGS=""
check_required_vars KEYSTONE_ADMIN_TOKEN RABBITMQ_SERVICE_HOST RABBIT_PASSWORD
# Loading common functions.
source /opt/kolla/kolla-common.sh
fail_unless_os_service_running keystone
# Config-internal script exec out of this function, it does not return here.
set_configs
# Nova conf settings
crudini --set /etc/nova/nova.conf DEFAULT instance_usage_audit True
crudini --set /etc/nova/nova.conf DEFAULT instance_usage_audit_period hour
crudini --set /etc/nova/nova.conf DEFAULT notify_on_state_change vm_and_task_state
crudini --set /etc/nova/nova.conf DEFAULT notification_driver nova.openstack.common.notifier.rpc_notifier
crudini --set /etc/nova/nova.conf DEFAULT notification_driver ceilometer.compute.nova_notifier
#ceilometer settings
cfg=/etc/ceilometer/ceilometer.conf
crudini --set $cfg publisher_rpc metering_secret ${KEYSTONE_ADMIN_TOKEN}
crudini --set $cfg rabbit_host ${RABBITMQ_SERVICE_HOST}
crudini --set $cfg rabbit_password ${RABBIT_PASSWORD}
exec /usr/bin/ceilometer-agent-compute
exec $CMD $ARGS

View File

@ -0,0 +1,10 @@
#!/bin/bash
SOURCE="/opt/kolla/ceilometer/ceilometer.conf"
TARGET="/etc/ceilometer/ceilometer.conf"
OWNER="ceilometer"
if [[ -f "$SOURCE" ]]; then
cp $SOURCE $TARGET
chown ${OWNER}: $TARGET
chmod 0644 $TARGET
fi

View File

@ -0,0 +1,9 @@
#!/bin/bash
set -e
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-ceilometer.sh
exec /usr/bin/ceilometer-agent-notification

View File

@ -1,9 +1,14 @@
#!/bin/bash
set -e
set -o errexit
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-ceilometer.sh
CMD="/usr/bin/ceilometer-agent-notification"
ARGS=""
# Loading common functions.
source /opt/kolla/kolla-common.sh
exec /usr/bin/ceilometer-agent-notification
# Config-internal script exec out of this function, it does not return here.
set_configs
exec $CMD $ARGS