Add custom unit mapping to Gnocchi
- Add new UNIT block to sample conf. - Configure the UNIT block for Gnocchi. - Add a new config_units function - Change COLLECTD_CUSTOM_UNITS to COLLECTD_CEILOMETER_CUSTOM_UNITS - Add COLLECTD_GNOCCHI_CUSTOM_UNITS config option Change-Id: I93088f2299ac4b5679289b1526febcf5e773be02
This commit is contained in:
parent
fc514f3f0f
commit
fbf2959d6e
|
@ -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|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_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
|
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
|
fi
|
||||||
|
|
||||||
# configure collectd-gnocchi plugin
|
# 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|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_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
|
sudo sed -i 's|OS_TENANT_NAME.*$|OS_TENANT_NAME "'$SERVICE_TENANT_NAME'"|g' $COLLECTD_CONF_DIR/collectd-gnocchi-plugin.conf
|
||||||
fi
|
config_custom_units "gnocchi" "$COLLECTD_GNOCCHI_UNITS"
|
||||||
|
|
||||||
# Configure custom units
|
|
||||||
if [[ "$COLLECTD_CEILOMETER_UNITS" != none ]]; then
|
|
||||||
OIFS=$IFS
|
|
||||||
IFS=','
|
|
||||||
for UNIT in $COLLECTD_CEILOMETER_UNITS
|
|
||||||
do
|
|
||||||
sudo sed -i '/<UNITS>/a\ UNIT '"$UNIT"'' $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf
|
|
||||||
done
|
|
||||||
IFS=$OIFS
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure collectd logfile plugin
|
# 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 '/<UNITS>/a\ UNIT '"$UNIT"'' $COLLECTD_CONF_DIR/collectd-$service_name-plugin.conf
|
||||||
|
done
|
||||||
|
IFS=$OIFS
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# remove plugin conf file
|
# remove plugin conf file
|
||||||
function restore_collectd_conf {
|
function restore_collectd_conf {
|
||||||
|
|
||||||
|
|
|
@ -31,4 +31,5 @@ if [ -z $COLLECTD_CONF_DIR ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Custom units feature
|
#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}
|
||||||
|
|
|
@ -61,13 +61,23 @@ COLLECTD_LOG_LEVEL
|
||||||
Default: info
|
Default: info
|
||||||
|
|
||||||
|
|
||||||
COLLECTD_CUSTOM_UNITS
|
COLLECTD_CEILOMETER_CUSTOM_UNITS
|
||||||
(meter=unit) a comma seperated list of pairs, defining meters and their 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.
|
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
|
The "meter" is generally in the form of "plugin.type", where plugin and
|
||||||
plugin type are attributes of the collectd data.
|
plugin type are attributes of the collectd data.
|
||||||
|
|
||||||
Example: COLLECTD_CUSTOM_UNITS="<meter> <unit>,<meter> <unit>"
|
Example: COLLECTD_CEILOMETER_CUSTOM_UNITS="<meter> <unit>,<meter> <unit>"
|
||||||
|
|
||||||
|
|
||||||
|
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="<meter> <unit>,<meter> <unit>"
|
||||||
|
|
||||||
|
|
||||||
COLLECTD_CEILOMETER_ENABLED
|
COLLECTD_CEILOMETER_ENABLED
|
||||||
(True|False) Toggle whether collectd-ceilometer-plugin is enabled.
|
(True|False) Toggle whether collectd-ceilometer-plugin is enabled.
|
||||||
|
|
|
@ -30,5 +30,7 @@
|
||||||
OS_PASSWORD "password"
|
OS_PASSWORD "password"
|
||||||
OS_TENANT_NAME "service"
|
OS_TENANT_NAME "service"
|
||||||
|
|
||||||
|
<UNITS>
|
||||||
|
</UNITS>
|
||||||
</Module>
|
</Module>
|
||||||
</Plugin>
|
</Plugin>
|
||||||
|
|
Loading…
Reference in New Issue