blob: 4c3bb52a90a81ae3df057bb3fb35d47c7c9cc4cf [file] [log] [blame]
John H. Tran93361642012-07-26 11:22:05 -07001# lib/ceilometer
2# Install and start Ceilometer service
3
4# Dependencies:
5# - functions
6
7# stack.sh
8# ---------
9# install_XXX
10# configure_XXX
11# init_XXX
12# start_XXX
13# stop_XXX
14# cleanup_XXX
15
16# Print the commands being run so that we can see the command that triggers
17# an error. It is also useful for following along as the install occurs.
18set -o xtrace
19
20
21# Defaults
22# --------
23
24# set up default directories
25CEILOMETER_DIR=$DEST/ceilometer
Monty Taylor9fbeedd2012-08-17 12:52:27 -040026# Support potential entry-points console scripts
27if [ -d $CEILOMETER_DIR/bin ] ; then
28 CEILOMETER_BIN_DIR=$CEILOMETER_DIR/bin
29else
30 CEILOMETER_BIN_DIR=/usr/local/bin
31fi
John H. Tran93361642012-07-26 11:22:05 -070032CEILOMETER_CONF_DIR=/etc/ceilometer
33CEILOMETER_AGENT_CONF=$CEILOMETER_CONF_DIR/ceilometer-agent.conf
34CEILOMETER_COLLECTOR_CONF=$CEILOMETER_CONF_DIR/ceilometer-collector.conf
35
36# cleanup_ceilometer() - Remove residual data files, anything left over from previous
37# runs that a clean run would need to clean up
38function cleanup_ceilometer() {
39 # This function intentionally left blank
40 :
41}
42
43# configure_ceilometer() - Set config files, create data dirs, etc
44function configure_ceilometer() {
45 setup_develop $CEILOMETER_DIR
46 if [ ! -d $CEILOMETER_CONF_DIR ]; then
47 sudo mkdir -m 755 -p $CEILOMETER_CONF_DIR
48 fi
49 sudo chown `whoami` $CEILOMETER_CONF_DIR
50
51 # ceilometer confs are copy of /etc/nova/nova.conf which must exist first
52 grep -v format_string $NOVA_CONF_DIR/$NOVA_CONF > $CEILOMETER_AGENT_CONF
53 grep -v format_string $NOVA_CONF_DIR/$NOVA_CONF > $CEILOMETER_COLLECTOR_CONF
54}
55
56# install_ceilometer() - Collect source and prepare
57function install_ceilometer() {
58 git_clone $CEILOMETER_REPO $CEILOMETER_DIR $CEILOMETER_BRANCH
59}
60
61# start_ceilometer() - Start running processes, including screen
62function start_ceilometer() {
Monty Taylor9fbeedd2012-08-17 12:52:27 -040063 screen_it ceilometer-acompute "cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-agent-compute --config-file $CEILOMETER_AGENT_CONF"
64 screen_it ceilometer-acentral "cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-agent-central --config-file $CEILOMETER_AGENT_CONF"
65 screen_it ceilometer-collector "cd $CEILOMETER_DIR && $CEILOMETER_BIN_DIR/ceilometer-collector --config-file $CEILOMETER_COLLECTOR_CONF"
John H. Tran93361642012-07-26 11:22:05 -070066}