diff options
author | Guo Ruijing <ruijing.guo@intel.com> | 2016-07-12 01:57:52 +0800 |
---|---|---|
committer | Guo Ruijing <ruijing.guo@intel.com> | 2016-07-12 01:58:53 +0800 |
commit | 54ea933ac9643d2d2f3714aa06afc978fc60551e (patch) | |
tree | c8df88f89aa75f095af4fbe7d3a3b64746c9f16a /src/fuel-plugin | |
parent | 215a65015908064b6ca996286584933002f0287a (diff) |
Add Fuel Plugin
Change-Id: Ib1a4b7057678e435683b23692310f4e309c3fe10
Signed-off-by: Guo Ruijing <ruijing.guo@intel.com>
Diffstat (limited to 'src/fuel-plugin')
-rw-r--r-- | src/fuel-plugin/LICENSE | 13 | ||||
-rw-r--r-- | src/fuel-plugin/README.md | 33 | ||||
-rwxr-xr-x | src/fuel-plugin/deployment_scripts/install.sh | 54 | ||||
-rw-r--r-- | src/fuel-plugin/deployment_scripts/puppet/manifests/collectd-ceilometer_install.pp | 23 | ||||
-rw-r--r-- | src/fuel-plugin/deployment_scripts/puppet/manifests/collectd_install.pp | 6 | ||||
-rw-r--r-- | src/fuel-plugin/deployment_scripts/puppet/manifests/collectd_restart.pp | 4 | ||||
-rw-r--r-- | src/fuel-plugin/deployment_tasks.yaml | 32 | ||||
-rw-r--r-- | src/fuel-plugin/environment_config.yaml | 0 | ||||
-rw-r--r-- | src/fuel-plugin/metadata.yaml | 32 | ||||
-rwxr-xr-x | src/fuel-plugin/pre_build_hook | 30 | ||||
-rw-r--r-- | src/fuel-plugin/tasks.yaml | 1 | ||||
-rw-r--r-- | src/fuel-plugin/vagrant/Vagrantfile | 21 | ||||
-rwxr-xr-x | src/fuel-plugin/vagrant/build_fuel_plugin.sh | 10 |
13 files changed, 259 insertions, 0 deletions
diff --git a/src/fuel-plugin/LICENSE b/src/fuel-plugin/LICENSE new file mode 100644 index 0000000..da96355 --- /dev/null +++ b/src/fuel-plugin/LICENSE @@ -0,0 +1,13 @@ +Copyright 2015-2016 Intel Corporation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/src/fuel-plugin/README.md b/src/fuel-plugin/README.md new file mode 100644 index 0000000..49eda5c --- /dev/null +++ b/src/fuel-plugin/README.md @@ -0,0 +1,33 @@ +Fuel Plugin for Collectd-Ceilometer +=================================== + +Collectd-Ceilometer plugin +-------------------------- + +Overview +-------- + +Fuel plugin collectd-ceilometer is developed to deploy collectd-ceilometer plugin + +Requirements +------------ + +| Requirement | Version/Comment | +|----------------------------------|-----------------| +| Mirantis OpenStack compatibility | 9.0 | + +Recommendations +--------------- + +None. + +Limitations +----------- + +None. + +Build, Installation & User Guide +================================= + +1. https://wiki.openstack.org/wiki/Fuel +2. https://wiki.openstack.org/wiki/Fuel/Plugins diff --git a/src/fuel-plugin/deployment_scripts/install.sh b/src/fuel-plugin/deployment_scripts/install.sh new file mode 100755 index 0000000..9a9bf61 --- /dev/null +++ b/src/fuel-plugin/deployment_scripts/install.sh @@ -0,0 +1,54 @@ +#!/bin/bash +set -eux + +INSTALL_HOME=/opt/collectd-ceilometer + +HOST=$1 +OS_AUTH_URL=$2 +OS_USERNAME=$3 +OS_PASSWORD=$4 + +CEILOMETER_URL_TYPE=${CEILOMETER_URL_TYPE:-internalURL} +CEILOMETER_TIMEOUT=${CEILOMETER_TIMEOUT:-1000} + +rm -rf $INSTALL_HOME; mkdir -p $INSTALL_HOME +cd $INSTALL_HOME +curl http://$HOST:8080/plugins/fuel-plugin-collectd-ceilometer-0.9/repositories/ubuntu/collectd-ceilometer.tgz | tar xzvf - + +cat << EOF > /etc/collectd/collectd.conf.d/collectd-ceilometer-plugin.conf +<LoadPlugin python> + Globals true +</LoadPlugin> + +<Plugin python> + ModulePath "$INSTALL_HOME" + LogTraces true + Interactive false + Import "collectd_ceilometer_plugin" + + <Module collectd_ceilometer_plugin> + + # Verbosity 1|0 + #VERBOSE 0 + + # 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 diff --git a/src/fuel-plugin/deployment_scripts/puppet/manifests/collectd-ceilometer_install.pp b/src/fuel-plugin/deployment_scripts/puppet/manifests/collectd-ceilometer_install.pp new file mode 100644 index 0000000..6b6a76d --- /dev/null +++ b/src/fuel-plugin/deployment_scripts/puppet/manifests/collectd-ceilometer_install.pp @@ -0,0 +1,23 @@ +$master_ip = hiera('master_ip') +$use_ceilometer = hiera('use_ceilometer', false) + +$management_vip = hiera('management_vip') +$service_endpoint = hiera('service_endpoint', $management_vip) +$ssl_hash = hiera_hash('use_ssl', {}) +$auth_protocol = get_ssl_property($ssl_hash, {}, 'keystone', 'internal', 'protocol', 'http') +$auth_endpoint = get_ssl_property($ssl_hash, {}, 'keystone', 'internal', 'hostname', [$service_endpoint]) +$auth_uri = "${auth_protocol}://${auth_endpoint}:5000/v2.0" + +$ceilometer_hash = hiera_hash('ceilometer', {'user'=>'ceilometer'}) +$auth_user = 'ceilometer' +$auth_password = $ceilometer_hash['user_password'] + +$exe_url = "http://${master_ip}:8080/plugins/fuel-plugin-collectd-ceilometer-0.9/deployment_scripts/install.sh" + +if ($use_ceilometer) { + + exec { "install collectd-ceilometer": + command => "curl ${exe_url} | bash -s ${master_ip} ${auth_uri} ${auth_user} ${auth_password}", + path => "/usr/bin:/usr/sbin:/bin:/sbin"; + } +} diff --git a/src/fuel-plugin/deployment_scripts/puppet/manifests/collectd_install.pp b/src/fuel-plugin/deployment_scripts/puppet/manifests/collectd_install.pp new file mode 100644 index 0000000..63a2e94 --- /dev/null +++ b/src/fuel-plugin/deployment_scripts/puppet/manifests/collectd_install.pp @@ -0,0 +1,6 @@ +if $operatingsystem == 'Ubuntu' { + exec { "install collectd": + command => "apt-get install -y collectd", + path => "/usr/bin:/usr/sbin:/bin:/sbin"; + } +} diff --git a/src/fuel-plugin/deployment_scripts/puppet/manifests/collectd_restart.pp b/src/fuel-plugin/deployment_scripts/puppet/manifests/collectd_restart.pp new file mode 100644 index 0000000..59f5151 --- /dev/null +++ b/src/fuel-plugin/deployment_scripts/puppet/manifests/collectd_restart.pp @@ -0,0 +1,4 @@ +exec { "restart collectd": + command => "service collectd restart", + path => "/usr/bin:/usr/sbin:/bin:/sbin"; +} diff --git a/src/fuel-plugin/deployment_tasks.yaml b/src/fuel-plugin/deployment_tasks.yaml new file mode 100644 index 0000000..7412ccf --- /dev/null +++ b/src/fuel-plugin/deployment_tasks.yaml @@ -0,0 +1,32 @@ +- id: collectd_install + type: puppet + version: 2.0.0 + groups: [compute] + required_for: [deployment_end] + requires: [setup_repositories] + parameters: + puppet_manifest: puppet/manifests/collectd_install.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 720 + +- id: collectd-ceilometer_install + type: puppet + version: 2.0.0 + groups: [compute] + required_for: [deployment_end] + requires: [collectd_install] + parameters: + puppet_manifest: puppet/manifests/collectd-ceilometer_install.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 720 + +- id: collectd_restart + type: puppet + version: 2.0.0 + groups: [compute] + required_for: [post_deployment_end] + requires: [post_deployment_start] + parameters: + puppet_manifest: puppet/manifests/collectd_restart.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 720 diff --git a/src/fuel-plugin/environment_config.yaml b/src/fuel-plugin/environment_config.yaml new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/fuel-plugin/environment_config.yaml diff --git a/src/fuel-plugin/metadata.yaml b/src/fuel-plugin/metadata.yaml new file mode 100644 index 0000000..382eec5 --- /dev/null +++ b/src/fuel-plugin/metadata.yaml @@ -0,0 +1,32 @@ +# Plugin name +name: fuel-plugin-collectd-ceilometer +# Human-readable name for your plugin +title: Deploy Collectd Ceilometer Plugin +# Plugin version +version: '0.9.0' +# Description +description: Deploy Collectd Ceilometer Plugin +# Required fuel version +fuel_version: ['9.0'] +# Specify license of your plugin +licenses: ['Apache License Version 2.0'] +# Specify author or company name +authors: ['ruijing.guo@intel.com'] +# A link to the plugin's page +homepage: 'https://gerrit.opnfv.org/gerrit/fastpathmetrics' +# Specify a group which your plugin implements, possible options: +# network, storage, storage::cinder, storage::glance, hypervisor +groups: ['network'] + +is_hotpluggable: false + +# The plugin is compatible with releases in the list +releases: + - os: ubuntu + version: mitaka-9.0 + mode: ['ha'] + deployment_scripts_path: deployment_scripts/ + repository_path: repositories/ubuntu + +# Version of plugin package +package_version: '4.0.0' diff --git a/src/fuel-plugin/pre_build_hook b/src/fuel-plugin/pre_build_hook new file mode 100755 index 0000000..eda8601 --- /dev/null +++ b/src/fuel-plugin/pre_build_hook @@ -0,0 +1,30 @@ +#!/bin/bash + +# Add here any the actions which are required before plugin build +# like packages building, packages downloading from mirrors and so on. +# The script should return 0 if there were no errors. +#!/bin/bash + +set -eux + +BUILD_FOR=${BUILD_FOR:-ubuntu} +DIR="$(dirname `readlink -f $0`)" + +function build_pkg { + case $1 in + ubuntu) + rm -rf ${DIR}/repositories/ubuntu; mkdir -p ${DIR}/repositories/ubuntu + git clone https://github.com/openstack/collectd-ceilometer-plugin + cd collectd-ceilometer-plugin + git checkout 3a4a1087566d1f9e8dd2d8d2e0608cb975942446 + tar cfvz ${DIR}/repositories/ubuntu/collectd-ceilometer.tgz . --exclude=collectd-ceilometer.tgz + cd ..; rm -rf collectd-ceilometer-plugin + ;; + *) echo "Not supported system"; exit 1;; + esac +} + +for system in $BUILD_FOR +do + build_pkg $system +done diff --git a/src/fuel-plugin/tasks.yaml b/src/fuel-plugin/tasks.yaml new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/src/fuel-plugin/tasks.yaml @@ -0,0 +1 @@ +[] diff --git a/src/fuel-plugin/vagrant/Vagrantfile b/src/fuel-plugin/vagrant/Vagrantfile new file mode 100644 index 0000000..06bbc95 --- /dev/null +++ b/src/fuel-plugin/vagrant/Vagrantfile @@ -0,0 +1,21 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + + config.vm.box = "trusty-server-cloudimg-amd64" + config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box" + + config.vm.define "fuel" do | h | + h.vm.host_name = "fuel" + h.vm.provision :shell, :inline => "/vagrant/build_fuel_plugin.sh", privileged: false + h.vm.synced_folder "..", "/fuel-plugin" + h.vm.provider :virtualbox do |v| + v.customize ["modifyvm", :id, "--memory", 4096] + v.customize ["modifyvm", :id, "--cpus", 4] + end + end +end diff --git a/src/fuel-plugin/vagrant/build_fuel_plugin.sh b/src/fuel-plugin/vagrant/build_fuel_plugin.sh new file mode 100755 index 0000000..a42217f --- /dev/null +++ b/src/fuel-plugin/vagrant/build_fuel_plugin.sh @@ -0,0 +1,10 @@ +#!/bin/bash +sudo apt-get update -y +sudo apt-get install -y ruby-dev rubygems-integration python-pip rpm createrepo dpkg-dev git +sudo gem install fpm +sudo pip install fuel-plugin-builder +cp -r /fuel-plugin /home/vagrant +cd /home/vagrant/fuel-plugin; +rm -rf vagrant/.vagrant +fpb --debug --build . +cp *.rpm /vagrant |