Merge "Indent bash functions for better readability"
This commit is contained in:
commit
7231032cba
@ -30,24 +30,24 @@ function install_collectd {
|
||||
|
||||
# Add conf file for plugin
|
||||
function adapt_collectd_conf {
|
||||
if [ ! -d "$COLLECTD_CONF_DIR" ]; then
|
||||
if [ ! -d "$COLLECTD_CONF_DIR" ]; then
|
||||
sudo mkdir -p "$COLLECTD_CONF_DIR"
|
||||
fi
|
||||
fi
|
||||
|
||||
sudo cp $COLLECTD_CEILOMETER_DIR/etc/collectd.conf.d/collectd-ceilometer-plugin.conf $COLLECTD_CONF_DIR/
|
||||
sudo cp $COLLECTD_CEILOMETER_DIR/etc/collectd.conf.d/collectd-ceilometer-plugin.conf $COLLECTD_CONF_DIR/
|
||||
|
||||
# Configure collectd-ceiloemter-plugin.conf
|
||||
sudo sed -i 's|ModulePath.*$|ModulePath "'$COLLECTD_CEILOMETER_DIR'"|g' $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf
|
||||
sudo sed -i 's|VERBOSE.*$|VERBOSE '$COLLECTD_CEILOMETER_VERBOSE'|g' $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf
|
||||
sudo sed -i 's|BATCH_SIZE.*$|BATCH_SIZE "'$COLLECTD_BATCH_SIZE'"|g' $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf
|
||||
sudo sed -i 's|OS_AUTH_URL.*$|OS_AUTH_URL "'$OS_AUTH_URL'"|g' $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf
|
||||
sudo sed -i 's|CEILOMETER_URL_TYPE.*$|CEILOMETER_URL_TYPE "'$CEILOMETER_URL_TYPE'"|g' $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf
|
||||
sudo sed -i 's|CEILOMETER_TIMEOUT.*$|CEILOMETER_TIMEOUT "'$CEILOMETER_TIMEOUT'"|g' $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf
|
||||
sudo sed -i 's|OS_PASSWORD.*$|OS_PASSWORD "'$SERVICE_PASSWORD'"|g' $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf
|
||||
sudo sed -i 's|OS_TENANT_NAME.*$|OS_TENANT_NAME "'$SERVICE_TENANT_NAME'"|g' $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf
|
||||
# Configure collectd-ceiloemter-plugin.conf
|
||||
sudo sed -i 's|ModulePath.*$|ModulePath "'$COLLECTD_CEILOMETER_DIR'"|g' $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf
|
||||
sudo sed -i 's|VERBOSE.*$|VERBOSE '$COLLECTD_CEILOMETER_VERBOSE'|g' $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf
|
||||
sudo sed -i 's|BATCH_SIZE.*$|BATCH_SIZE "'$COLLECTD_BATCH_SIZE'"|g' $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf
|
||||
sudo sed -i 's|OS_AUTH_URL.*$|OS_AUTH_URL "'$OS_AUTH_URL'"|g' $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf
|
||||
sudo sed -i 's|CEILOMETER_URL_TYPE.*$|CEILOMETER_URL_TYPE "'$CEILOMETER_URL_TYPE'"|g' $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf
|
||||
sudo sed -i 's|CEILOMETER_TIMEOUT.*$|CEILOMETER_TIMEOUT "'$CEILOMETER_TIMEOUT'"|g' $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf
|
||||
sudo sed -i 's|OS_PASSWORD.*$|OS_PASSWORD "'$SERVICE_PASSWORD'"|g' $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf
|
||||
sudo sed -i 's|OS_TENANT_NAME.*$|OS_TENANT_NAME "'$SERVICE_TENANT_NAME'"|g' $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf
|
||||
|
||||
# Configure custom units
|
||||
if [[ "$COLLECTD_CEILOMETER_UNITS" != none ]]; then
|
||||
# Configure custom units
|
||||
if [[ "$COLLECTD_CEILOMETER_UNITS" != none ]]; then
|
||||
OIFS=$IFS
|
||||
IFS=','
|
||||
for UNIT in $COLLECTD_CEILOMETER_UNITS
|
||||
@ -55,17 +55,17 @@ if [[ "$COLLECTD_CEILOMETER_UNITS" != none ]]; then
|
||||
sudo sed -i '/<UNITS>/a\ UNIT '"$UNIT"'' $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf
|
||||
done
|
||||
IFS=$OIFS
|
||||
fi
|
||||
fi
|
||||
|
||||
# Configure collectd logfile plugin
|
||||
if [ -n $COLLECTD_LOG_FILE ]; then
|
||||
# Configure collectd logfile plugin
|
||||
if [ -n $COLLECTD_LOG_FILE ]; then
|
||||
touch $COLLECTD_LOG_FILE
|
||||
fi
|
||||
fi
|
||||
|
||||
sudo cp $COLLECTD_CEILOMETER_DIR/etc/collectd.conf.d/logfile.conf $COLLECTD_CONF_DIR/
|
||||
sudo cp $COLLECTD_CEILOMETER_DIR/etc/collectd.conf.d/logfile.conf $COLLECTD_CONF_DIR/
|
||||
|
||||
sudo sed -i 's|LogLevel.*$|LogLevel "'$COLLECTD_LOG_LEVEL'"|g' $COLLECTD_CONF_DIR/logfile.conf
|
||||
sudo sed -i 's|File.*$|File "'$COLLECTD_LOG_FILE'"|g' $COLLECTD_CONF_DIR/logfile.conf
|
||||
sudo sed -i 's|LogLevel.*$|LogLevel "'$COLLECTD_LOG_LEVEL'"|g' $COLLECTD_CONF_DIR/logfile.conf
|
||||
sudo sed -i 's|File.*$|File "'$COLLECTD_LOG_FILE'"|g' $COLLECTD_CONF_DIR/logfile.conf
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user