diff --git a/devstack/libs/collectd b/devstack/libs/collectd index 8c2668d..130a086 100644 --- a/devstack/libs/collectd +++ b/devstack/libs/collectd @@ -58,6 +58,8 @@ function adapt_collectd_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 + + config_custom_units "ceilometer" "$COLLECTD_CEILOMETER_UNITS" fi # configure collectd-gnocchi plugin @@ -74,17 +76,7 @@ function adapt_collectd_conf { sudo sed -i 's|CEILOMETER_TIMEOUT.*$|CEILOMETER_TIMEOUT "'$CEILOMETER_TIMEOUT'"|g' $COLLECTD_CONF_DIR/collectd-gnocchi-plugin.conf sudo sed -i 's|OS_PASSWORD.*$|OS_PASSWORD "'$SERVICE_PASSWORD'"|g' $COLLECTD_CONF_DIR/collectd-gnocchi-plugin.conf sudo sed -i 's|OS_TENANT_NAME.*$|OS_TENANT_NAME "'$SERVICE_TENANT_NAME'"|g' $COLLECTD_CONF_DIR/collectd-gnocchi-plugin.conf - fi - - # Configure custom units - if [[ "$COLLECTD_CEILOMETER_UNITS" != none ]]; then - OIFS=$IFS - IFS=',' - for UNIT in $COLLECTD_CEILOMETER_UNITS - do - sudo sed -i '//a\ UNIT '"$UNIT"'' $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf - done - IFS=$OIFS + config_custom_units "gnocchi" "$COLLECTD_GNOCCHI_UNITS" fi # Configure collectd logfile plugin @@ -99,6 +91,22 @@ function adapt_collectd_conf { } +function config_custom_units { + service_name=$1 + custom_units=$2 + if [[ $custom_units != none ]]; then + + OIFS=$IFS + IFS=',' + + for UNIT in $custom_units + do + sudo sed -i '//a\ UNIT '"$UNIT"'' $COLLECTD_CONF_DIR/collectd-$service_name-plugin.conf + done + IFS=$OIFS + fi +} + # remove plugin conf file function restore_collectd_conf { diff --git a/devstack/settings b/devstack/settings index 4b3b297..dd7bb29 100644 --- a/devstack/settings +++ b/devstack/settings @@ -31,4 +31,5 @@ if [ -z $COLLECTD_CONF_DIR ]; then fi #Custom units feature -COLLECTD_CEILOMETER_UNITS=${COLLECTD_CUSTOM_UNITS:-none} +COLLECTD_CEILOMETER_UNITS=${COLLECTD_CEILOMETER_CUSTOM_UNITS:-none} +COLLECTD_GNOCCHI_UNITS=${COLLECTD_GNOCCHI_CUSTOM_UNITS:-none} diff --git a/doc/source/usage.rst b/doc/source/usage.rst index e2a9b90..e98f7de 100644 --- a/doc/source/usage.rst +++ b/doc/source/usage.rst @@ -61,13 +61,23 @@ COLLECTD_LOG_LEVEL Default: info -COLLECTD_CUSTOM_UNITS +COLLECTD_CEILOMETER_CUSTOM_UNITS (meter=unit) a comma seperated list of pairs, defining meters and their units. Allows existing units to be changed and new units to be set for new meters. The "meter" is generally in the form of "plugin.type", where plugin and plugin type are attributes of the collectd data. - Example: COLLECTD_CUSTOM_UNITS=" , " + Example: COLLECTD_CEILOMETER_CUSTOM_UNITS=" , " + + +COLLECTD_GNOCCHI_CUSTOM_UNITS + (meter=unit) a comma seperated list of pairs, defining meters and their units. + Allows existing units to be changed and new units to be set for new meters. + The "meter" is generally in the form of "plugin.type", where plugin and + plugin type are attributes of the collectd data. + + Example: COLLECTD_GNOCCHI_CUSTOM_UNITS=" , " + COLLECTD_CEILOMETER_ENABLED (True|False) Toggle whether collectd-ceilometer-plugin is enabled. diff --git a/etc/collectd.conf.d/collectd-gnocchi-plugin.conf b/etc/collectd.conf.d/collectd-gnocchi-plugin.conf index 8162e93..f28f638 100644 --- a/etc/collectd.conf.d/collectd-gnocchi-plugin.conf +++ b/etc/collectd.conf.d/collectd-gnocchi-plugin.conf @@ -30,5 +30,7 @@ OS_PASSWORD "password" OS_TENANT_NAME "service" + +