diff --git a/files/apts/ceilometer-collector b/files/apts/ceilometer-collector new file mode 100644 index 0000000000..c67ade3c80 --- /dev/null +++ b/files/apts/ceilometer-collector @@ -0,0 +1,2 @@ +python-pymongo +mongodb-server diff --git a/files/rpms/ceilometer-collector b/files/rpms/ceilometer-collector new file mode 100644 index 0000000000..c5c855c0d2 --- /dev/null +++ b/files/rpms/ceilometer-collector @@ -0,0 +1,2 @@ +mongodb-server +pymongo diff --git a/functions b/functions index 7a7406d474..cd0623316a 100644 --- a/functions +++ b/functions @@ -129,6 +129,10 @@ function get_packages() { if [[ ! $file_to_parse =~ cinder ]]; then file_to_parse="${file_to_parse} cinder" fi + elif [[ $service == ceilometer-* ]]; then + if [[ ! $file_to_parse =~ ceilometer ]]; then + file_to_parse="${file_to_parse} ceilometer" + fi elif [[ $service == n-* ]]; then if [[ ! $file_to_parse =~ nova ]]; then file_to_parse="${file_to_parse} nova" @@ -375,6 +379,7 @@ function is_service_enabled() { [[ ,${ENABLED_SERVICES}, =~ ,${service}, ]] && return 0 [[ ${service} == "nova" && ${ENABLED_SERVICES} =~ "n-" ]] && return 0 [[ ${service} == "cinder" && ${ENABLED_SERVICES} =~ "c-" ]] && return 0 + [[ ${service} == "ceilometer" && ${ENABLED_SERVICES} =~ "ceilometer-" ]] && return 0 [[ ${service} == "glance" && ${ENABLED_SERVICES} =~ "g-" ]] && return 0 [[ ${service} == "quantum" && ${ENABLED_SERVICES} =~ "q-" ]] && return 0 done diff --git a/lib/ceilometer b/lib/ceilometer new file mode 100644 index 0000000000..069e5395bf --- /dev/null +++ b/lib/ceilometer @@ -0,0 +1,60 @@ +# lib/ceilometer +# Install and start Ceilometer service + +# Dependencies: +# - functions + +# stack.sh +# --------- +# install_XXX +# configure_XXX +# init_XXX +# start_XXX +# stop_XXX +# cleanup_XXX + +# Print the commands being run so that we can see the command that triggers +# an error. It is also useful for following along as the install occurs. +set -o xtrace + + +# Defaults +# -------- + +# set up default directories +CEILOMETER_DIR=$DEST/ceilometer +CEILOMETER_CONF_DIR=/etc/ceilometer +CEILOMETER_AGENT_CONF=$CEILOMETER_CONF_DIR/ceilometer-agent.conf +CEILOMETER_COLLECTOR_CONF=$CEILOMETER_CONF_DIR/ceilometer-collector.conf + +# cleanup_ceilometer() - Remove residual data files, anything left over from previous +# runs that a clean run would need to clean up +function cleanup_ceilometer() { + # This function intentionally left blank + : +} + +# configure_ceilometer() - Set config files, create data dirs, etc +function configure_ceilometer() { + setup_develop $CEILOMETER_DIR + if [ ! -d $CEILOMETER_CONF_DIR ]; then + sudo mkdir -m 755 -p $CEILOMETER_CONF_DIR + fi + sudo chown `whoami` $CEILOMETER_CONF_DIR + + # ceilometer confs are copy of /etc/nova/nova.conf which must exist first + grep -v format_string $NOVA_CONF_DIR/$NOVA_CONF > $CEILOMETER_AGENT_CONF + grep -v format_string $NOVA_CONF_DIR/$NOVA_CONF > $CEILOMETER_COLLECTOR_CONF +} + +# install_ceilometer() - Collect source and prepare +function install_ceilometer() { + git_clone $CEILOMETER_REPO $CEILOMETER_DIR $CEILOMETER_BRANCH +} + +# start_ceilometer() - Start running processes, including screen +function start_ceilometer() { + screen_it ceilometer-acompute "cd $CEILOMETER_DIR && $CEILOMETER_DIR/bin/ceilometer-agent-compute --config-file $CEILOMETER_AGENT_CONF" + screen_it ceilometer-acentral "cd $CEILOMETER_DIR && $CEILOMETER_DIR/bin/ceilometer-agent-central --config-file $CEILOMETER_AGENT_CONF" + screen_it ceilometer-collector "cd $CEILOMETER_DIR && $CEILOMETER_DIR/bin/ceilometer-collector --config-file $CEILOMETER_COLLECTOR_CONF" +} diff --git a/stack.sh b/stack.sh index ccbbc6b88b..1619dfcf7f 100755 --- a/stack.sh +++ b/stack.sh @@ -240,6 +240,7 @@ sudo chown `whoami` $DATA_DIR # Get project function libraries source $TOP_DIR/lib/cinder +source $TOP_DIR/lib/ceilometer # Set the destination directories for openstack projects NOVA_DIR=$DEST/nova @@ -789,6 +790,9 @@ fi if is_service_enabled cinder; then install_cinder fi +if is_service_enabled ceilometer; then + install_ceilometer +fi # Initialization # ============== @@ -2122,6 +2126,10 @@ screen_it n-cauth "cd $NOVA_DIR && ./bin/nova-consoleauth" if is_service_enabled cinder; then start_cinder fi +if is_service_enabled ceilometer; then + configure_ceilometer + start_ceilometer +fi screen_it horizon "cd $HORIZON_DIR && sudo tail -f /var/log/$APACHE_NAME/horizon_error.log" screen_it swift "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-proxy-server ${SWIFT_CONFIG_DIR}/proxy-server.conf -v" diff --git a/stackrc b/stackrc index c906f951c8..cd70284d8a 100644 --- a/stackrc +++ b/stackrc @@ -24,6 +24,10 @@ NOVA_ENABLED_APIS=ec2,osapi_compute,osapi_volume,metadata # Another option is http://review.openstack.org/p GIT_BASE=https://github.com +# metering service +CEILOMETER_REPO=https://github.com/stackforge/ceilometer.git +CEILOMETER_BRANCH=master + # volume service CINDER_REPO=${GIT_BASE}/openstack/cinder CINDER_BRANCH=master