Add devstack support
Add devstack plugin for deploying the plugin. Change-Id: I4ecbc8e30025604eae5d159b4f2506fe3ed484ce
This commit is contained in:
parent
a00f360f8f
commit
ecc9a6ee9d
74
devstack/libs/collectd
Normal file
74
devstack/libs/collectd
Normal file
@ -0,0 +1,74 @@
|
||||
#!/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"
|
||||
|
||||
<Module collectd_ceilometer>
|
||||
|
||||
# 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
|
||||
|
||||
}
|
39
devstack/plugin.sh
Normal file
39
devstack/plugin.sh
Normal file
@ -0,0 +1,39 @@
|
||||
local xtrace=$(set +o | grep xtrace)
|
||||
set -o xtrace
|
||||
|
||||
# Initial source of lib script
|
||||
source $COLLECTD_DIR/devstack/libs/collectd
|
||||
|
||||
case $1 in
|
||||
"stack")
|
||||
case $2 in
|
||||
"pre-install")
|
||||
# install system package
|
||||
install_collectd
|
||||
;;
|
||||
"install")
|
||||
# adapt collectd.conf
|
||||
adapt_collectd_conf
|
||||
;;
|
||||
"post-config")
|
||||
# start collectd service
|
||||
start_collectd
|
||||
;;
|
||||
"extra")
|
||||
# no-op
|
||||
:
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"unstack")
|
||||
# stop the service and restore original /etc/collect.conf
|
||||
stop_collectd
|
||||
restore_collectd_conf
|
||||
;;
|
||||
"clean")
|
||||
# no cleaning required as of now
|
||||
:
|
||||
;;
|
||||
esac
|
||||
|
||||
$xtrace
|
15
devstack/settings
Normal file
15
devstack/settings
Normal file
@ -0,0 +1,15 @@
|
||||
# General settings
|
||||
COLLECTD_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )
|
||||
COLLECTD_BATCH_SIZE=${COLLECTD_BATCH_SIZE:-3}
|
||||
|
||||
# Ceilometer connection info.
|
||||
CEILOMETER_URL_TYPE=${CEILOMETER_URL_TYPE:-internalURL}
|
||||
CEILOMETER_TIMEOUT=${CEILOMETER_TIMEOUT:-1000}
|
||||
|
||||
# Auth info
|
||||
OS_AUTH_URL="$KEYSTONE_AUTH_URI/v$IDENTITY_API_VERSION"
|
||||
OS_USERNAME="ceilometer"
|
||||
OS_PASSWORD=${SERVICE_PASSWORD}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user