#!/bin/bash # Copyright 2017-2018 AT&T Intellectual Property, Inc # # 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. # #. What this is: Cleanup script for the VES monitoring framework. #. With this script a VES deployment can be cleaned from one or more hosts. #. #. Prerequisites: #. - VES framework deployed as in ves-setup.sh in this repo #. #. Usage: #. bash ~/ves/ves-setup.sh clean [cloudify] #. what: one of all|influxdb|grafana|collector|kafka|collectd|agent|nodes #. barometer: clean barometer #. agent: clean VES agent #. kafka: clean kafka #. zookeeper: clean zookeeper #. grafana: clean grafana #. influxdb: clean influxdb #. collector: clean VES collector #. nodes: clean VES code etc at nodes #. cloudify: (optional) clean up cloudify-based deployments #. #. See demo_deploy.sh in this repo for a recommended sequence of the above. #. #. Status: this is a work in progress, under test. # http://docs.opnfv.org/en/latest/submodules/barometer/docs/release/userguide/collectd.ves.userguide.html function fail() { log "$1" exit 1 } function log() { f=$(caller 0 | awk '{print $2}') l=$(caller 0 | awk '{print $1}') echo "" echo "$f:$l ($(date)) $1" } function clean_all() { log "clean installation" clean_barometer clean_agent clean_kafka clean_zookeeper clean_grafana clean_influxdb clean_collector clean_nodes } function clean_via_docker() { log "clean docker container $1 at k8s master $k8s_master" ssh -x -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \ $k8s_user@$k8s_master <