diff --git a/scripts/usecases/weavescope/startServer.sh b/scripts/usecases/weavescope/startServer.sh new file mode 100644 index 000000000..9cc23a9a8 --- /dev/null +++ b/scripts/usecases/weavescope/startServer.sh @@ -0,0 +1,43 @@ +#!/bin/bash + + +echo "[Start Weave Scope Cluster Monitoring]" + +SECONDS=0 + +PublicIPs=${1} +PrivateIPs=${2} + +echo "Installing Weavescope to MCIS..." + +ScopeInstallFile="git.io/scope" +ScopeInstallFile="https://gist.githubusercontent.com/seokho-son/bb2703ca49555f9afe0d0097894c74fa/raw/9eb65b296b85bc53f53af3e8733603d807fb9287/scope" +sudo curl -L $ScopeInstallFile -o /usr/local/bin/scope +sudo chmod a+x /usr/local/bin/scope + +FILE="/usr/local/bin/scope" + +echo "Installing prerequisite" +sudo apt-get update > /dev/null +sudo apt install docker.io -y + +PID=$(ps -ef | grep scope | awk '{print $2}') + +if [ "${PID}" != "" ]; then + echo "scope ${PID} exist. sudo scope stop" + sudo scope stop +fi + +echo "Launching Weavescope" + +sudo scope launch $PublicIPs $PrivateIPs + +echo "Done! elapsed time: $SECONDS" + +IP=$(curl https://api.ipify.org) + +PID=$(ps -ef | grep scope | awk '{print $2}') + + +echo "[Start Scope: complete] PID=$PID" +echo "$IP:4040/#!/state/{\"contrastMode\":true,\"topologyId\":\"containers-by-hostname\"}" diff --git a/scripts/usecases/weavescope/statusServer.sh b/scripts/usecases/weavescope/statusServer.sh new file mode 100644 index 000000000..7f1bdfabe --- /dev/null +++ b/scripts/usecases/weavescope/statusServer.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +PS=$(ps -ef | head -1; ps -ef | grep scope) +echo "[Process status of scope]" +echo "$PS" + +echo "" diff --git a/scripts/usecases/weavescope/stopServer.sh b/scripts/usecases/weavescope/stopServer.sh new file mode 100644 index 000000000..64a372dc9 --- /dev/null +++ b/scripts/usecases/weavescope/stopServer.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +echo "[Stop Weave Scope Cluster Monitoring]" + +PID=$(ps -ef | grep scope | awk '{print $2}') +sudo scope stop +echo "[Stop scope] PID=$PID" +echo "[Check scope Process]" +sleep 2 +ps -ef | grep scope + +echo "" \ No newline at end of file