Files
collectd-openstack-plugins/devstack/libs/collectd
Emma Foley fe6d579a28 Fix path issue for devstack
Add collectd_ceilometer_plugin.py so collectd doesn't get confused
between module and file.

Change-Id: Icd63feafebc3e057e4e0cf9392237464b7c7a5f1
Co-Authored-By: Jaroslav Safka <jaroslavx.safka@intel.com>
2016-03-01 13:41:22 +00:00

75 lines
1.5 KiB
Bash

#!/bin/bash
#
# common functions for collectd ceilometer plugin
# -----------------------------------------------
# start/stop service
#
function start_collectd {
if [ -e /usr/lib/systemd/system/collectd.service ]; then
sudo service collectd start
fi
}
function stop_collectd {
if [ -e /usr/lib/systemd/system/collectd.service ]; then
sudo service collectd stop
fi
}
# install collectd service
function install_collectd {
install_package collectd
}
# Add conf file for plugin
function adapt_collectd_conf {
cat << EOF | sudo tee /etc/collectd.d/collectd-ceilometer-plugin.conf
<LoadPlugin python>
Globals true
</LoadPlugin>
<Plugin python>
ModulePath "$COLLECTD_DIR"
LogTraces true
Interactive false
Import "collectd_ceilometer_plugin"
<Module collectd_ceilometer_plugin>
# Batch size
BATCH_SIZE 3
# Service endpoint addresses
OS_AUTH_URL "$OS_AUTH_URL"
# Ceilometer address
#CEILOMETER_ENDPOINT
CEILOMETER_URL_TYPE "$CEILOMETER_URL_TYPE"
# Ceilometer timeout in ms
CEILOMETER_TIMEOUT "$CEILOMETER_TIMEOUT"
# # Ceilometer user creds
OS_USERNAME "$OS_USERNAME"
OS_PASSWORD "$OS_PASSWORD"
OS_TENANT_NAME "service"
</Module>
</Plugin>
EOF
}
# remove plugin conf file
function restore_collectd_conf {
if [ -f '/etc/collectd.d/collectd-ceilometer-plugin.conf' ]; then
sudo rm -f /etc/collectd.d/collectd-ceilometer-plugin.conf
fi
}