diff --git a/devstack/lib/node_exporter b/devstack/lib/node_exporter index bbb2a88..72697be 100644 --- a/devstack/lib/node_exporter +++ b/devstack/lib/node_exporter @@ -15,14 +15,19 @@ function pre_install_node_exporter { } function install_node_exporter { + + local ne_tarball=node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64.tar.gz + local ne_url=https://github.com/prometheus/node_exporter/releases/download/v${NODE_EXPORTER_VERSION}/${ne_tarball} + # Download node_exporter - wget https://github.com/prometheus/node_exporter/releases/download/v${NODE_EXPORTER_VERSION}/node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64.tar.gz + local ne_dest + ne_dest=`get_extra_file ${ne_url}` # Extract the tarball - tar -xvf node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64.tar.gz + tar xzf ${ne_dest} -C $DEST # Move binaries to /usr/local/bin - sudo mv node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64/node_exporter /usr/local/bin/ + sudo mv $DEST/node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64/node_exporter /usr/local/bin/ # Set ownership sudo chown $(whoami):$(whoami) ${NODE_EXPORTER_BINARY} @@ -69,6 +74,9 @@ function cleanup_node_exporter { # Remove Node Exporter binaries sudo rm -rf $NODE_EXPORTER_BINARY + + # Remove untar location + sudo rm -rf $DEST/node_exporter-${NODE_EXPORTER_VERSION}.linux-amd64 } function wait_for_data { diff --git a/devstack/lib/prometheus b/devstack/lib/prometheus index 10b325a..c74193a 100644 --- a/devstack/lib/prometheus +++ b/devstack/lib/prometheus @@ -15,15 +15,20 @@ function pre_install_prometheus { } function install_prometheus { + + local prom_tarball=prometheus-${PROMETHEUS_VERSION}.linux-amd64.tar.gz + local prom_url=https://github.com/prometheus/prometheus/releases/download/v${PROMETHEUS_VERSION}/${prom_tarball} + # Download Prometheus - wget https://github.com/prometheus/prometheus/releases/download/v${PROMETHEUS_VERSION}/prometheus-${PROMETHEUS_VERSION}.linux-amd64.tar.gz + local prom_dest + prom_dest=`get_extra_file ${prom_url}` # Extract the tarball - tar -xvf prometheus-${PROMETHEUS_VERSION}.linux-amd64.tar.gz + tar xzf ${prom_dest} -C $DEST # Move binaries to /usr/local/bin - sudo mv prometheus-${PROMETHEUS_VERSION}.linux-amd64/prometheus /usr/local/bin/ - sudo mv prometheus-${PROMETHEUS_VERSION}.linux-amd64/promtool /usr/local/bin/ + sudo mv $DEST/prometheus-${PROMETHEUS_VERSION}.linux-amd64/prometheus /usr/local/bin/ + sudo mv $DEST/prometheus-${PROMETHEUS_VERSION}.linux-amd64/promtool /usr/local/bin/ # Set ownership sudo chown $(whoami):$(whoami) /usr/local/bin/prometheus @@ -87,6 +92,9 @@ function cleanup_prometheus { # Remove binaries sudo rm /usr/local/bin/prometheus sudo rm /usr/local/bin/promtool + + # Remove untar location + sudo rm -rf $DEST/prometheus-${PROMETHEUS_VERSION}.linux-amd64 } function wait_for_data { diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 4fba25c..ca13731 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -45,6 +45,8 @@ if is_service_enabled prometheus; then # no-op echo_summary "Stoping prometheus service" stop_prometheus + echo_summary "Cleaning prometheus service" + cleanup_prometheus fi if [[ "$1" == "clean" ]]; then @@ -89,6 +91,8 @@ if is_service_enabled node_exporter; then # no-op echo_summary "Stoping node_exporter service" stop_node_exporter + echo_summary "Cleaning node exporter service" + cleanup_node_exporter fi if [[ "$1" == "clean" ]]; then