This repository has been archived by the owner on Mar 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-all-metric.sh
executable file
·109 lines (107 loc) · 4.87 KB
/
setup-all-metric.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#! /bin/bash
abs_path_file_execute=$(dirname "$(realpath "$0")")
abs_path_folder_script="$abs_path_file_execute/Script/worker/bash"
arr=("$@")
for i in "${arr[@]}";
do
if [[ $(echo "${arr[@]: -1}") == "up" ]]; then
if [ $i == "all" ]; then
bash -c "$abs_path_folder_script/setup-swarm.sh up" || exit 1
bash -c "$abs_path_folder_script/setup-monitoring.sh up" || exit 1
bash -c "$abs_path_folder_script/setup-worker.sh metric up" || exit 1
fi
if [ $i == "swarm" ]; then
bash -c "$abs_path_folder_script/setup-swarm.sh up"
fi
if [ $i == "worker" ]; then
bash -c "$abs_path_folder_script/setup-worker.sh metric up"
fi
if [ $i == "monitoring" ]; then
bash -c "$abs_path_folder_script/setup-monitoring.sh up"
fi
if [ $i == "visuallizer" ]; then
bash -c "$abs_path_folder_script/setup-swarm-visuallizer.sh up"
fi
if [ $i == "cadvisor" ]; then
bash -c "$abs_path_folder_script/setup-cadvisor.sh up"
fi
if [ $i == "node-exporter" ]; then
bash -c "$abs_path_folder_script/setup-node-exporter.sh up"
fi
fi
if [[ $(echo "${arr[@]: -1}") == "create" ]]; then
if [ $i == "all" ]; then
bash -c "$abs_path_folder_script/setup-swarm.sh create" || exit 1
bash -c "$abs_path_folder_script/setup-monitoring.sh create" || exit 1
bash -c "$abs_path_folder_script/setup-worker.sh metric up" || exit 1
fi
if [ $i == "swarm" ]; then
bash -c "$abs_path_folder_script/setup-swarm.sh create"
fi
if [ $i == "worker" ]; then
bash -c "$abs_path_folder_script/setup-worker.sh metric up"
fi
if [ $i == "monitoring" ]; then
bash -c "$abs_path_folder_script/setup-monitoring.sh create"
fi
if [ $i == "cadvisor" ]; then
bash -c "$abs_path_folder_script/setup-cadvisor.sh create 0.47.0"
fi
if [ $i == "node-exporter" ]; then
bash -c "$abs_path_folder_script/setup-node-exporter.sh create 1.5.0"
fi
if [ $i == "visuallizer" ]; then
bash -c "$abs_path_folder_script/setup-swarm-visuallizer.sh create -n"
fi
fi
if [[ $(echo "${arr[@]: -1}") == "down" ]]; then
if [ $i == "all" ]; then
bash -c "$abs_path_folder_script/setup-swarm.sh down" || exit 1
bash -c "$abs_path_folder_script/setup-monitoring.sh down" || exit 1
bash -c "$abs_path_folder_script/setup-worker.sh metric down" || exit 1
fi
if [ $i == "swarm" ]; then
bash -c "$abs_path_folder_script/setup-swarm.sh down"
fi
if [ $i == "worker" ]; then
bash -c "$abs_path_folder_script/setup-worker.sh metric down"
fi
if [ $i == "monitoring" ]; then
bash -c "$abs_path_folder_script/setup-monitoring.sh down"
fi
if [ $i == "cadvisor" ]; then
bash -c "$abs_path_folder_script/setup-cadvisor.sh down"
fi
if [ $i == "node-exporter" ]; then
bash -c "$abs_path_folder_script/setup-node-exporter.sh down"
fi
if [ $i == "visuallizer" ]; then
bash -c "$abs_path_folder_script/setup-swarm-visuallizer.sh down"
fi
fi
if [[ $(echo "${arr[@]: -1}") == "destroy" ]]; then
if [ $i == "all" ]; then
bash -c "$abs_path_folder_script/setup-swarm.sh destroy" || exit 1
bash -c "$abs_path_folder_script/setup-monitoring.sh destroy" || exit 1
bash -c "$abs_path_folder_script/setup-worker.sh metric down" || exit 1
fi
if [ $i == "swarm" ]; then
bash -c "$abs_path_folder_script/setup-swarm.sh destroy"
fi
if [ $i == "worker" ]; then
bash -c "$abs_path_folder_script/setup-worker.sh metric down"
fi
if [ $i == "monitoring" ]; then
bash -c "$abs_path_folder_script/setup-monitoring.sh destroy"
fi
if [ $i == "cadvisor" ]; then
bash -c "$abs_path_folder_script/setup-cadvisor.sh destroy"
fi
if [ $i == "node-exporter" ]; then
bash -c "$abs_path_folder_script/setup-node-exporter.sh destroy"
fi
if [ $i == "visuallizer" ]; then
bash -c "$abs_path_folder_script/setup-swarm-visuallizer.sh destroy -y"
fi
fi
done