summaryrefslogtreecommitdiff
path: root/openstack-ceilometer.configure
diff options
context:
space:
mode:
authorPatrick Darley <patrick.darley@codethink.co.uk>2015-04-17 14:10:53 +0000
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2015-04-17 17:30:20 +0000
commit63c135ee31fa870650039bc7657c54b028fa7f70 (patch)
treef042fc24e49e9834f4fdb6a01e800b2ec6429c69 /openstack-ceilometer.configure
parent3505ba2dda17bbc5c2790db129ae7cc50db97f14 (diff)
downloaddefinitions-63c135ee31fa870650039bc7657c54b028fa7f70.tar.gz
Openstack: Make Ceilometer configurable
This commit configures ceilometer to integrate with Keystone, Glance, Cinder and Nova. Change-Id: I19e8580de87858033ce1c2caf86a828d6377bb91
Diffstat (limited to 'openstack-ceilometer.configure')
-rw-r--r--openstack-ceilometer.configure82
1 files changed, 82 insertions, 0 deletions
diff --git a/openstack-ceilometer.configure b/openstack-ceilometer.configure
new file mode 100644
index 00000000..b8ed7eab
--- /dev/null
+++ b/openstack-ceilometer.configure
@@ -0,0 +1,82 @@
+#!/bin/sh
+
+# Copyright (C) 2015 Codethink Limited
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+set -e
+
+ROOT="$1"
+
+##########################################################################
+
+ln -s "/usr/lib/systemd/system/openstack-ceilometer-setup.service" \
+ "$ROOT/etc/systemd/system/multi-user.target.wants/openstack-ceilometer-setup.service"
+
+##########################################################################
+# Check variables
+##########################################################################
+
+if [ -z "$CEILOMETER_SERVICE_USER" -a \
+ -z "$CEILOMETER_SERVICE_PASSWORD" -a \
+ -z "$CEILOMETER_DB_USER" -a \
+ -z "$CEILOMETER_DB_PASSWORD" -a \
+ -z "$METERING_SECRET" ]; then
+ # No Ceilometer options defined, do nothing.
+ exit 0
+fi
+
+if [ -z "$KEYSTONE_TEMPORARY_ADMIN_TOKEN" -o \
+ -z "$CEILOMETER_SERVICE_USER" -o \
+ -z "$CEILOMETER_SERVICE_PASSWORD" -o \
+ -z "$CEILOMETER_DB_USER" -o \
+ -z "$CEILOMETER_DB_PASSWORD" -o \
+ -z "$METERING_SECRET" -o \
+ -z "$RABBITMQ_HOST" -o \
+ -z "$RABBITMQ_PORT" -o \
+ -z "$RABBITMQ_USER" -o \
+ -z "$RABBITMQ_PASSWORD" -o \
+ -z "$MANAGEMENT_INTERFACE_IP_ADDRESS" -o \
+ -z "$CONTROLLER_HOST_ADDRESS" ]; then
+ echo Some options required for Ceilometer were defined, but not all.
+ exit 1
+fi
+
+##########################################################################
+# Generate configuration file
+##########################################################################
+
+OPENSTACK_DATA="$ROOT/etc/openstack"
+mkdir -p "$OPENSTACK_DATA"
+
+python <<'EOF' >"$OPENSTACK_DATA/ceilometer.conf"
+import os, sys, yaml
+
+ceilometer_configuration={
+ 'KEYSTONE_TEMPORARY_ADMIN_TOKEN': os.environ['KEYSTONE_TEMPORARY_ADMIN_TOKEN'],
+ 'CEILOMETER_SERVICE_PASSWORD': os.environ['CEILOMETER_SERVICE_PASSWORD'],
+ 'CEILOMETER_SERVICE_USER': os.environ['CEILOMETER_SERVICE_USER'],
+ 'CEILOMETER_DB_USER': os.environ['CEILOMETER_DB_USER'],
+ 'CEILOMETER_DB_PASSWORD': os.environ['CEILOMETER_DB_PASSWORD'],
+ 'METERING_SECRET': os.environ['METERING_SECRET'],
+ 'RABBITMQ_HOST': os.environ['RABBITMQ_HOST'],
+ 'RABBITMQ_PORT': os.environ['RABBITMQ_PORT'],
+ 'RABBITMQ_USER': os.environ['RABBITMQ_USER'],
+ 'RABBITMQ_PASSWORD': os.environ['RABBITMQ_PASSWORD'],
+ 'MANAGEMENT_INTERFACE_IP_ADDRESS': os.environ['MANAGEMENT_INTERFACE_IP_ADDRESS'],
+ 'CONTROLLER_HOST_ADDRESS': os.environ['CONTROLLER_HOST_ADDRESS'],
+}
+
+yaml.dump(ceilometer_configuration, sys.stdout, default_flow_style=False)
+EOF