blob: 069e5395bf67adce05586512a1469a296ff9def3 [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
26CEILOMETER_CONF_DIR=/etc/ceilometer
27CEILOMETER_AGENT_CONF=$CEILOMETER_CONF_DIR/ceilometer-agent.conf
28CEILOMETER_COLLECTOR_CONF=$CEILOMETER_CONF_DIR/ceilometer-collector.conf
29
30# cleanup_ceilometer() - Remove residual data files, anything left over from previous
31# runs that a clean run would need to clean up
32function cleanup_ceilometer() {
33 # This function intentionally left blank
34 :
35}
36
37# configure_ceilometer() - Set config files, create data dirs, etc
38function configure_ceilometer() {
39 setup_develop $CEILOMETER_DIR
40 if [ ! -d $CEILOMETER_CONF_DIR ]; then
41 sudo mkdir -m 755 -p $CEILOMETER_CONF_DIR
42 fi
43 sudo chown `whoami` $CEILOMETER_CONF_DIR
44
45 # ceilometer confs are copy of /etc/nova/nova.conf which must exist first
46 grep -v format_string $NOVA_CONF_DIR/$NOVA_CONF > $CEILOMETER_AGENT_CONF
47 grep -v format_string $NOVA_CONF_DIR/$NOVA_CONF > $CEILOMETER_COLLECTOR_CONF
48}
49
50# install_ceilometer() - Collect source and prepare
51function install_ceilometer() {
52 git_clone $CEILOMETER_REPO $CEILOMETER_DIR $CEILOMETER_BRANCH
53}
54
55# start_ceilometer() - Start running processes, including screen
56function start_ceilometer() {
57 screen_it ceilometer-acompute "cd $CEILOMETER_DIR && $CEILOMETER_DIR/bin/ceilometer-agent-compute --config-file $CEILOMETER_AGENT_CONF"
58 screen_it ceilometer-acentral "cd $CEILOMETER_DIR && $CEILOMETER_DIR/bin/ceilometer-agent-central --config-file $CEILOMETER_AGENT_CONF"
59 screen_it ceilometer-collector "cd $CEILOMETER_DIR && $CEILOMETER_DIR/bin/ceilometer-collector --config-file $CEILOMETER_COLLECTOR_CONF"
60}