diff options
author | blsaws <bryan.sullivan@att.com> | 2016-10-23 19:49:56 +0000 |
---|---|---|
committer | blsaws <bryan.sullivan@att.com> | 2016-10-23 19:49:56 +0000 |
commit | ac118982bf77f435d81517c722cfa10ede661136 (patch) | |
tree | fca754979f99e661844005b7906c923b293979d9 /tests | |
parent | 1995784862923e2578dd93ebff68756c8fa4770b (diff) |
Add removal steps for bare metal collectd agents
JIRA: VES-1
Change-Id: Ia5f70a41750da50df6cb5e83327c23b0e5b9816d
Signed-off-by: blsaws <bryan.sullivan@att.com>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/blueprints/tosca-vnfd-hello-ves/start.sh | 50 | ||||
-rw-r--r-- | tests/vHello_VES.sh | 25 |
2 files changed, 47 insertions, 28 deletions
diff --git a/tests/blueprints/tosca-vnfd-hello-ves/start.sh b/tests/blueprints/tosca-vnfd-hello-ves/start.sh index 5f7ec8a..26fb667 100755 --- a/tests/blueprints/tosca-vnfd-hello-ves/start.sh +++ b/tests/blueprints/tosca-vnfd-hello-ves/start.sh @@ -1,5 +1,3 @@ - - #!/bin/bash # Copyright 2016 AT&T Intellectual Property, Inc # @@ -43,28 +41,28 @@ setup_collectd () { conf="/etc/collectd.conf" fi - if [[ ! -d ~/OpenStackBarcelonaDemo ]]; then - if [ "$dist" == "Ubuntu" ]; then - sudo apt-get update - sudo apt-get install -y collectd - else - sudo yum update -y - sudo yum install -y epel-release - sudo yum install -y collectd - fi - cd ~ + if [ "$dist" == "Ubuntu" ]; then + sudo apt-get update + sudo apt-get install -y collectd + else + sudo yum update -y + sudo yum install -y epel-release + sudo yum install -y collectd + sudo yum install -y collectd-virt + fi + cd ~ - echo "$0: Install VES collectd plugin" - git clone https://github.com/maryamtahhan/OpenStackBarcelonaDemo.git + echo "$0: Install VES collectd plugin" + git clone https://github.com/maryamtahhan/OpenStackBarcelonaDemo.git - sudo sed -i -- "s/FQDNLookup true/FQDNLookup false/" /etc/collectd/collectd.conf - sudo sed -i -- "s/#LoadPlugin cpu/LoadPlugin cpu/" /etc/collectd/collectd.conf - sudo sed -i -- "s/#LoadPlugin disk/LoadPlugin disk/" /etc/collectd/collectd.conf - sudo sed -i -- "s/#LoadPlugin interface/LoadPlugin interface/" /etc/collectd/collectd.conf - sudo sed -i -- "s/#LoadPlugin memory/LoadPlugin memory/" /etc/collectd/collectd.conf + sudo sed -i -- "s/FQDNLookup true/FQDNLookup false/" /etc/collectd/collectd.conf + sudo sed -i -- "s/#LoadPlugin cpu/LoadPlugin cpu/" /etc/collectd/collectd.conf + sudo sed -i -- "s/#LoadPlugin disk/LoadPlugin disk/" /etc/collectd/collectd.conf + sudo sed -i -- "s/#LoadPlugin interface/LoadPlugin interface/" /etc/collectd/collectd.conf + sudo sed -i -- "s/#LoadPlugin memory/LoadPlugin memory/" /etc/collectd/collectd.conf - if [[ "$guest" == true ]]; then - cat <<EOF | sudo tee -a $conf + if [[ "$guest" == true ]]; then + cat <<EOF | sudo tee -a $conf <LoadPlugin python> Globals true </LoadPlugin> @@ -102,13 +100,13 @@ LoadPlugin aggregation </Plugin> LoadPlugin uuid EOF - else - cat <<EOF | sudo tee -a $conf + else + cat <<EOF | sudo tee -a $conf <LoadPlugin python> Globals true </LoadPlugin> <Plugin python> - ModulePath "/home/ubuntu/OpenStackBarcelonaDemo/ves_plugin/" + ModulePath "/home/$USER/OpenStackBarcelonaDemo/ves_plugin/" LogTraces true Interactive false Import "ves_plugin" @@ -146,10 +144,6 @@ LoadPlugin aggregation </Aggregation> </Plugin> EOF - fi - else - echo "$0: Update collectd conf with current Collector IP" - sudo sed -i -- "s/ Domain \".*\"/ Domain \"$collector_ip\"/" $conf fi sudo service collectd restart } diff --git a/tests/vHello_VES.sh b/tests/vHello_VES.sh index 62ce9c8..00a8361 100644 --- a/tests/vHello_VES.sh +++ b/tests/vHello_VES.sh @@ -297,6 +297,31 @@ stop() { fip=($(neutron floatingip-list|grep -v "+"|grep -v id|awk '{print $2}')); for id in ${fip[@]}; do neutron floatingip-delete ${id}; done sg=($(openstack security group list|grep vHello|awk '{print $2}')) for id in ${sg[@]}; do try 10 5 "openstack security group delete ${id}"; done + + echo "$0: $(date) remove collectd agent on bare metal hypervisor hosts" + hosts=($(openstack hypervisor list | grep -v Hostname | grep -v "+" | awk '{print $4}')) + for host in ${hosts[@]}; do + ip=$(openstack hypervisor show $host | grep host_ip | awk '{print $4}') + if [[ "$OS_CLOUDNAME" == "overcloud" ]]; then + u="heat-admin" + p="" + else + u="ubuntu" + p=":ubuntu" + fi + ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $u$p@$ip <<'EOF' +if [[ $USER == "ubuntu" ]]; then + sudo service collectd stop + sudo apt-get remove -y collectd + sudo rm /etc/collectd/collectd.conf +else + sudo service collectd stop + sudo yum remove -y collectd + sudo rm /etc/collectd.conf +fi +EOF + rm -rf $HOME/OpenStackBarcelonaDemo + done } # |