Skip to content

Commit

Permalink
Merge pull request #1268 from seokho-son/main
Browse files Browse the repository at this point in the history
Add weavescope script
  • Loading branch information
seokho-son authored Nov 12, 2022
2 parents 8cd3d9d + c12093c commit ab3e201
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
43 changes: 43 additions & 0 deletions scripts/usecases/weavescope/startServer.sh
Original file line number Diff line number Diff line change
@@ -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\"}"
7 changes: 7 additions & 0 deletions scripts/usecases/weavescope/statusServer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

PS=$(ps -ef | head -1; ps -ef | grep scope)
echo "[Process status of scope]"
echo "$PS"

echo ""
12 changes: 12 additions & 0 deletions scripts/usecases/weavescope/stopServer.sh
Original file line number Diff line number Diff line change
@@ -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 ""

0 comments on commit ab3e201

Please sign in to comment.