|
...
|
...
|
@@ -78,8 +78,13 @@ CEILOMETER_API_LOG_DIR=/var/log/ceilometer-api
|
|
78
|
78
|
CEILOMETER_AUTH_CACHE_DIR=${CEILOMETER_AUTH_CACHE_DIR:-/var/cache/ceilometer}
|
|
79
|
79
|
CEILOMETER_WSGI_DIR=${CEILOMETER_WSGI_DIR:-/var/www/ceilometer}
|
|
80
|
80
|
|
|
81
|
|
-# Support potential entry-points console scripts
|
|
82
|
|
-CEILOMETER_BIN_DIR=$(get_python_exec_prefix)
|
|
|
81
|
+# Support potential entry-points console scripts in VENV or not
|
|
|
82
|
+if [[ ${USE_VENV} = True ]]; then
|
|
|
83
|
+ PROJECT_VENV["ceilometer"]=${CEILOMETER_DIR}.venv
|
|
|
84
|
+ CEILOMETER_BIN_DIR=${PROJECT_VENV["ceilometer"]}/bin
|
|
|
85
|
+else
|
|
|
86
|
+ CEILOMETER_BIN_DIR=$(get_python_exec_prefix)
|
|
|
87
|
+fi
|
|
83
|
88
|
|
|
84
|
89
|
# Set up database backend
|
|
85
|
90
|
CEILOMETER_BACKEND=${CEILOMETER_BACKEND:-mysql}
|
|
...
|
...
|
@@ -151,6 +156,8 @@ function _cleanup_ceilometer_apache_wsgi {
|
|
151
|
151
|
# runs that a clean run would need to clean up
|
|
152
|
152
|
function cleanup_ceilometer {
|
|
153
|
153
|
if [ "$CEILOMETER_BACKEND" = 'mongodb' ] ; then
|
|
|
154
|
+ echo "### cleaning database"
|
|
|
155
|
+ read
|
|
154
|
156
|
mongo ceilometer --eval "db.dropDatabase();"
|
|
155
|
157
|
elif [ "$CEILOMETER_BACKEND" = 'es' ] ; then
|
|
156
|
158
|
curl -XDELETE "localhost:9200/events_*"
|
|
...
|
...
|
@@ -165,16 +172,22 @@ function _config_ceilometer_apache_wsgi {
|
|
165
|
165
|
|
|
166
|
166
|
local ceilometer_apache_conf=$(apache_site_config_for ceilometer)
|
|
167
|
167
|
local apache_version=$(get_apache_version)
|
|
|
168
|
+ local venv_path=""
|
|
168
|
169
|
|
|
169
|
170
|
# Copy proxy vhost and wsgi file
|
|
170
|
171
|
sudo cp $CEILOMETER_DIR/ceilometer/api/app.wsgi $CEILOMETER_WSGI_DIR/app
|
|
171
|
172
|
|
|
|
173
|
+ if [[ ${USE_VENV} = True ]]; then
|
|
|
174
|
+ venv_path="python-path=${PROJECT_VENV["ceilometer"]}/lib/$(python_version)/site-packages"
|
|
|
175
|
+ fi
|
|
|
176
|
+
|
|
172
|
177
|
sudo cp $FILES/apache-ceilometer.template $ceilometer_apache_conf
|
|
173
|
178
|
sudo sed -e "
|
|
174
|
179
|
s|%PORT%|$CEILOMETER_SERVICE_PORT|g;
|
|
175
|
180
|
s|%APACHE_NAME%|$APACHE_NAME|g;
|
|
176
|
181
|
s|%WSGIAPP%|$CEILOMETER_WSGI_DIR/app|g;
|
|
177
|
|
- s|%USER%|$STACK_USER|g
|
|
|
182
|
+ s|%USER%|$STACK_USER|g;
|
|
|
183
|
+ s|%VIRTUALENV%|$venv_path|g
|
|
178
|
184
|
" -i $ceilometer_apache_conf
|
|
179
|
185
|
}
|
|
180
|
186
|
|
|
...
|
...
|
@@ -232,12 +245,14 @@ function configure_ceilometer {
|
|
232
|
232
|
iniset $CEILOMETER_CONF DEFAULT collector_workers $API_WORKERS
|
|
233
|
233
|
${TOP_DIR}/pkg/elasticsearch.sh start
|
|
234
|
234
|
cleanup_ceilometer
|
|
235
|
|
- else
|
|
|
235
|
+ elif [ "$CEILOMETER_BACKEND" = 'mongodb' ] ; then
|
|
236
|
236
|
iniset $CEILOMETER_CONF database alarm_connection mongodb://localhost:27017/ceilometer
|
|
237
|
237
|
iniset $CEILOMETER_CONF database event_connection mongodb://localhost:27017/ceilometer
|
|
238
|
238
|
iniset $CEILOMETER_CONF database metering_connection mongodb://localhost:27017/ceilometer
|
|
239
|
239
|
configure_mongodb
|
|
240
|
240
|
cleanup_ceilometer
|
|
|
241
|
+ else
|
|
|
242
|
+ die $LINENO "Unable to configure unknown CEILOMETER_BACKEND $CEILOMETER_BACKEND"
|
|
241
|
243
|
fi
|
|
242
|
244
|
|
|
243
|
245
|
if [[ "$VIRT_DRIVER" = 'vsphere' ]]; then
|
|
...
|
...
|
@@ -263,10 +278,8 @@ function configure_mongodb {
|
|
263
|
263
|
local packages=mongodb-server
|
|
264
|
264
|
|
|
265
|
265
|
if is_fedora; then
|
|
266
|
|
- # mongodb client + python bindings
|
|
267
|
|
- packages="${packages} mongodb pymongo"
|
|
268
|
|
- else
|
|
269
|
|
- packages="${packages} python-pymongo"
|
|
|
266
|
+ # mongodb client
|
|
|
267
|
+ packages="${packages} mongodb"
|
|
270
|
268
|
fi
|
|
271
|
269
|
|
|
272
|
270
|
install_package ${packages}
|
|
...
|
...
|
@@ -319,6 +332,18 @@ function install_ceilometer {
|
|
319
|
319
|
install_redis
|
|
320
|
320
|
fi
|
|
321
|
321
|
|
|
|
322
|
+ if [ "$CEILOMETER_BACKEND" = 'mongodb' ] ; then
|
|
|
323
|
+ pip_install_gr pymongo
|
|
|
324
|
+ fi
|
|
|
325
|
+
|
|
|
326
|
+ if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then
|
|
|
327
|
+ pip_install_gr libvirt-python
|
|
|
328
|
+ fi
|
|
|
329
|
+
|
|
|
330
|
+ if [[ "$VIRT_DRIVER" = 'vsphere' ]]; then
|
|
|
331
|
+ pip_instal_gr oslo.vmware
|
|
|
332
|
+ fi
|
|
|
333
|
+
|
|
322
|
334
|
if [ "$CEILOMETER_BACKEND" = 'es' ] ; then
|
|
323
|
335
|
${TOP_DIR}/pkg/elasticsearch.sh download
|
|
324
|
336
|
${TOP_DIR}/pkg/elasticsearch.sh install
|
|
...
|
...
|
@@ -349,13 +374,13 @@ function install_ceilometermiddleware {
|
|
349
|
349
|
|
|
350
|
350
|
# start_ceilometer() - Start running processes, including screen
|
|
351
|
351
|
function start_ceilometer {
|
|
352
|
|
- run_process ceilometer-acentral "ceilometer-agent-central --config-file $CEILOMETER_CONF"
|
|
353
|
|
- run_process ceilometer-anotification "ceilometer-agent-notification --config-file $CEILOMETER_CONF"
|
|
354
|
|
- run_process ceilometer-collector "ceilometer-collector --config-file $CEILOMETER_CONF"
|
|
355
|
|
- run_process ceilometer-aipmi "ceilometer-agent-ipmi --config-file $CEILOMETER_CONF"
|
|
|
352
|
+ run_process ceilometer-acentral "$CEILOMETER_BIN_DIR/ceilometer-agent-central --config-file $CEILOMETER_CONF"
|
|
|
353
|
+ run_process ceilometer-anotification "$CEILOMETER_BIN_DIR/ceilometer-agent-notification --config-file $CEILOMETER_CONF"
|
|
|
354
|
+ run_process ceilometer-collector "$CEILOMETER_BIN_DIR/ceilometer-collector --config-file $CEILOMETER_CONF"
|
|
|
355
|
+ run_process ceilometer-aipmi "$CEILOMETER_BIN_DIR/ceilometer-agent-ipmi --config-file $CEILOMETER_CONF"
|
|
356
|
356
|
|
|
357
|
357
|
if [[ "$CEILOMETER_USE_MOD_WSGI" == "False" ]]; then
|
|
358
|
|
- run_process ceilometer-api "ceilometer-api -d -v --log-dir=$CEILOMETER_API_LOG_DIR --config-file $CEILOMETER_CONF"
|
|
|
358
|
+ run_process ceilometer-api "$CEILOMETER_BIN_DIR/ceilometer-api -d -v --log-dir=$CEILOMETER_API_LOG_DIR --config-file $CEILOMETER_CONF"
|
|
359
|
359
|
else
|
|
360
|
360
|
enable_apache_site ceilometer
|
|
361
|
361
|
restart_apache_server
|
|
...
|
...
|
@@ -367,10 +392,10 @@ function start_ceilometer {
|
|
367
|
367
|
# Start the compute agent last to allow time for the collector to
|
|
368
|
368
|
# fully wake up and connect to the message bus. See bug #1355809
|
|
369
|
369
|
if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then
|
|
370
|
|
- run_process ceilometer-acompute "ceilometer-agent-compute --config-file $CEILOMETER_CONF" $LIBVIRT_GROUP
|
|
|
370
|
+ run_process ceilometer-acompute "$CEILOMETER_BIN_DIR/ceilometer-agent-compute --config-file $CEILOMETER_CONF" $LIBVIRT_GROUP
|
|
371
|
371
|
fi
|
|
372
|
372
|
if [[ "$VIRT_DRIVER" = 'vsphere' ]]; then
|
|
373
|
|
- run_process ceilometer-acompute "ceilometer-agent-compute --config-file $CEILOMETER_CONF"
|
|
|
373
|
+ run_process ceilometer-acompute "$CEILOMETER_BIN_DIR/ceilometer-agent-compute --config-file $CEILOMETER_CONF"
|
|
374
|
374
|
fi
|
|
375
|
375
|
|
|
376
|
376
|
# Only die on API if it was actually intended to be turned on
|
|
...
|
...
|
@@ -381,8 +406,8 @@ function start_ceilometer {
|
|
381
|
381
|
fi
|
|
382
|
382
|
fi
|
|
383
|
383
|
|
|
384
|
|
- run_process ceilometer-alarm-notifier "ceilometer-alarm-notifier --config-file $CEILOMETER_CONF"
|
|
385
|
|
- run_process ceilometer-alarm-evaluator "ceilometer-alarm-evaluator --config-file $CEILOMETER_CONF"
|
|
|
384
|
+ run_process ceilometer-alarm-notifier "$CEILOMETER_BIN_DIR/ceilometer-alarm-notifier --config-file $CEILOMETER_CONF"
|
|
|
385
|
+ run_process ceilometer-alarm-evaluator "$CEILOMETER_BIN_DIR/ceilometer-alarm-evaluator --config-file $CEILOMETER_CONF"
|
|
386
|
386
|
}
|
|
387
|
387
|
|
|
388
|
388
|
# stop_ceilometer() - Stop running processes
|