-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathping-iperf-check.v2.sh
285 lines (245 loc) · 11.8 KB
/
ping-iperf-check.v2.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
#!/bin/bash
#
# Name : ping-iperf-check.v1.sh
# Description : Script for OF@TEIN Infrastructure Resources Checking and Verification
#
# Created by : TEIN_GIST@nm.gist.ac.kr
# Version : 0.1
#
# Configuration Parameter
LOGDIR="log"
LOGRES="/home/tein/infra_checking_software/result"
#LOGFILE=experiment.check.`date +%Y%m%d.%H%M%S`.log
#B_SITES="MYREN MY TH PKS ID PH VN TEST GIST TW IN"
B_SITES="GIST ID IN MYREN PH PKS VN"
B_PLUS_SITES="MY TEST TH TW"
VM_SITES_GIST="ID PKS PH"
VM_SITES_MYREN="ID PKS PH"
#VM_SITES_MYREN="PH MY PKS ID"
#BP_SITES="GIST ID" # separated by spaces
GIST_PING_RESULT=$(date)
MYREN_PING_RESULT=$(date)
TEST_PING_RESULT=$(date)
GIST_CONTROL_VM_PING_RESULT=$(date)
MYREN_CONTROL_VM_PING_RESULT=$(date)
if [ -f "$LOGRES/PING_RESULT_GIST.log" ]
then
rm $LOGRES/PING_RESULT_GIST.log
echo "$file found."
fi
if [ -f "$LOGRES/PING_RESULT_MYREN.log" ]
then
rm $LOGRES/PING_RESULT_MYREN.log
echo "$file found."
fi
if [ -f "$LOGRES/PING_RESULT_TEST.log" ]
then
rm $LOGRES/PING_RESULT_TEST.log
echo "$file found."
fi
if [ -f "$LOGRES/IPERF_TCP_RESULT_GIST_BOX.log" ]
then
rm $LOGRES/IPERF_TCP_RESULT_GIST_BOX.log
rm $LOGRES/IPERF_UDP_RESULT_GIST_BOX.log
touch $LOGRES/IPERF_TCP_RESULT_GIST_BOX.log
touch $LOGRES/IPERF_UDP_RESULT_GIST_BOX.log
echo "$file found."
fi
if [ -f "$LOGRES/IPERF_TCP_RESULT_MYREN_BOX.log" ]
then
rm $LOGRES/IPERF_TCP_RESULT_MYREN_BOX.log
rm $LOGRES/IPERF_UDP_RESULT_MYREN_BOX.log
touch $LOGRES/IPERF_TCP_RESULT_MYREN_BOX.log
touch $LOGRES/IPERF_UDP_RESULT_MYREN_BOX.log
echo "$file found."
fi
if [ -f "$LOGRES/PING_RESULT_CONTROL_GIST_VM.log" ]
then
rm $LOGRES/PING_RESULT_CONTROL_GIST_VM.log
rm $LOGRES/PING_RESULT_CONTROL_MYREN_VM.log
echo "$file found."
fi
#
# [1] Compute Resource Checking
#
function check_box {
echo -e "\n"
echo -e "--------------------------------------------------"
echo -e "| Start Compute Resource (Box) Checking |"
echo -e "--------------------------------------------------"
echo -e "\n"
ACTIVE_OVS_VM_GIST=`ssh root@SmartX-BPlus-GIST 'virsh list --all | grep ovs-vm | grep running' | awk '{print $2}'`
ACTIVE_OVS_VM_MYREN=`ssh root@SmartX-BPlus-MYREN 'virsh list --all | grep ovs-vm | grep running' | awk '{print $2}'`
if [ "$ACTIVE_OVS_VM_GIST" == "ovs-vm1" ]; then
ACTIVE_OVS_VM_GIST="GIST-OVS-VM1"
else
ACTIVE_OVS_VM_GIST="GIST-OVS-VM2"
fi
if [ "$ACTIVE_OVS_VM_MYREN" == "ovs-vm1" ]; then
ACTIVE_OVS_VM_MYREN="MYREN-OVS-VM1"
else
ACTIVE_OVS_VM_MYREN="MYREN-OVS-VM2"
fi
for countryID in $B_SITES
do
echo -e "Checking for SmartX-BPlus-$countryID"
echo -e "------------------------"
#ACTIVE_OVS_VM_GIST=`ssh root@SmartX-BPlus-GIST 'virsh list --all | grep ovs-vm | grep running' | awk '{print $2}'`
#ACTIVE_OVS_VM_MYREN=`ssh root@SmartX-BPlus-MYREN 'virsh list --all | grep ovs-vm | grep running' | awk '{print $2}'`
#if [ "$ACTIVE_OVS_VM_GIST" == "ovs-vm1" ]; then
# ACTIVE_OVS_VM_GIST="GIST-OVS-VM1"
#else
# ACTIVE_OVS_VM_GIST="GIST-OVS-VM2"
#fi
#if [ "$ACTIVE_OVS_VM_MYREN" == "ovs-vm1" ]; then
# ACTIVE_OVS_VM_MYREN="MYREN-OVS-VM1"
#else
# ACTIVE_OVS_VM_MYREN="MYREN-OVS-VM2"
#fi
GIST_PING=`ssh tein@$ACTIVE_OVS_VM_GIST 'ping 'Data-$countryID' -c 1 | grep icmp_seq'`
MYREN_PING=`ssh tein@$ACTIVE_OVS_VM_MYREN 'ping 'Data-$countryID' -c 1 | grep icmp_seq'`
echo -e $GIST_PING
echo -e $MYREN_PING
#GIST Ping Checking
if [ "${GIST_PING:-null}" = null ]; then
echo "Host SmartX-BPlus-$countryID is not reachable !!!"
COMPUTE_RESULT="FAILED"
GIST_PING_RESULT=$GIST_PING_RESULT,DOWN
else
echo "Host SmartX-BPlus-$countryID is reachable."
GIST_PING_RESULT=$GIST_PING_RESULT,UP
fi
#MYREN Ping Checking
if [ "${MYREN_PING:-null}" = null ]; then
echo "Host SmartX-BPlus-$countryID is not reachable !!!"
COMPUTE_RESULT="FAILED"
MYREN_PING_RESULT=$GIST_PING_RESULT,DOWN
else
echo "Host SmartX-BPlus-$countryID is reachable."
MYREN_PING_RESULT=$GIST_PING_RESULT,UP
fi
done
for countryID in $B_PLUS_SITES
do
echo -e "Checking for SmartX-BPlus-$countryID"
echo -e "------------------------"
TEST_PING=`ssh root@SmartX-BPlus-GIST 'ping 'SmartX-BPlus-$countryID' -c 1 | grep icmp_seq'`
echo -e $TEST_PING
#TEST Ping Checking
if [ "${TEST_PING:-null}" = null ]; then
echo "Host SmartX-BPlus-$countryID is not reachable !!!"
TEST_PING_RESULT=$TEST_PING_RESULT,DOWN
else
echo "Host SmartX-BPlus-$countryID is reachable."
TEST_PING_RESULT=$TEST_PING_RESULT,UP
fi
done
#echo -e $GIST_PING_RESULT
echo $GIST_PING_RESULT >> $LOGRES/PING_RESULT_GIST.log
echo $MYREN_PING_RESULT >> $LOGRES/PING_RESULT_MYREN.log
echo $TEST_PING_RESULT >> $LOGRES/PING_RESULT_TEST.log
echo -e "Box Checking is done...\n"
}
function check_box_bandwidth {
echo -e "\n"
echo -e "------------------------------------------------------------"
echo -e "| Start Iperf Test For (Box) |"
echo -e "------------------------------------------------------------"
echo -e " Start Iperf Server Application at Box SmartX-BPlus-MYREN "
echo -e "------------------------------------------------------------"
#Execute Iperf Server on Server
ssh root@SmartX-BPlus-MYREN 'iperf3 -s -D'&
sleep 5
for countryID in $VM_SITES_MYREN
do
#Execute Iperf Client on Client Site
echo -e " Start iperf TCP Client on SmartX-BPlus-$countryID Site"
ssh root@SmartX-BPlus-$countryID "iperf3 -c 103.26.47.229 -i 3 -t 20 -l 1M -O 12 -4 -N" | grep -A 1 "sender" | awk '{print $7" "$8}' | sed 'N;s/\n/ /' | sed 's/^/MYREN '$countryID' TCP /' >> $LOGRES/IPERF_TCP_RESULT_MYREN_BOX.log
echo -e " Start iperf UDP Client on SmartX-BPlus-$countryID Site"
ssh root@SmartX-BPlus-$countryID "iperf3 -c 103.26.47.229 -u -i 3 -t 15 -b 20M " | grep "0.00-15.00" | awk '{print $7" "$8" "$9" "$11" "$12}' | sed 's/^/MYREN '$countryID' UDP /' >> $LOGRES/IPERF_UDP_RESULT_MYREN_BOX.log
#Execute Iperf Server on Client Side
echo -e "************************************************************"
echo -e " Start Iperf Server Application at Box SmartX-BPlus-$countryID"
echo -e "************************************************************"
ssh root@SmartX-BPlus-$countryID 'iperf3 -s -D'&
sleep 5
echo -e " Start iperf TCP Client on SmartX-BPlus-MYREN Site"
ssh root@SmartX-BPlus-MYREN "iperf3 -c Data-$countryID -i 3 -t 20 -l 1M -O 12 -4 -N" | grep -A 1 "sender" | awk '{print $7" "$8}' | sed 'N;s/\n/ /' | sed 's/^/'$countryID' MYREN TCP /' >> $LOGRES/IPERF_TCP_RESULT_MYREN_BOX.log
echo -e " Start iperf UDP Client on SmartX-BPlus-MYREN Site\n"
ssh root@SmartX-BPlus-MYREN "iperf3 -c Data-$countryID -u -i 3 -t 15 -b 20M " | grep "0.00-15.00" | awk '{print $7" "$8" "$9" "$11" "$12}' | sed 's/^/'$countryID' MYREN UDP /' >> $LOGRES/IPERF_UDP_RESULT_MYREN_BOX.log
echo " Terminate iperf Server on the SmartX-BPlus-$countryID Site"
ssh root@SmartX-BPlus-$countryID 'killall -r -s KILL iperf3'
done
echo " Terminate iperf Server on the SmartX-BPlus-MYREN Site"
ssh root@SmartX-BPlus-MYREN 'killall -r -s KILL iperf3'
echo -e "-----------------------------------------------------------"
echo -e "\n"
echo -e "------------------------------------------------------------"
echo -e " Start Iperf Server Application at Box SmartX-BPlus-GIST "
echo -e "------------------------------------------------------------"
#Execute Iperf Server on GIST
ssh root@SmartX-BPlus-GIST 'iperf3 -s -D'&
sleep 5
for countryID in $VM_SITES_GIST
do
#Execute Iperf Client on Client Site
#Iperf Experiment
echo -e " Start iperf TCP Client on SmartX-BPlus-$countryID Site"
ssh root@SmartX-BPlus-$countryID "iperf3 -c 61.252.52.11 -i 3 -t 20 -l 1M -O 12 -4 -N" | grep -A 1 "sender" | awk '{print $7" "$8}' | sed 'N;s/\n/ /' | sed 's/^/GIST '$countryID' TCP /' >> $LOGRES/IPERF_TCP_RESULT_GIST_BOX.log
echo -e " Start iperf UDP Client on SmartX-BPlus-$countryID Site"
ssh root@SmartX-BPlus-$countryID "iperf3 -c 61.252.52.11 -u -i 3 -t 15 -b 20M " | grep "0.00-15.00" | awk '{print $7" "$8" "$9" "$11" "$12}' | sed 's/^/GIST '$countryID' UDP /' >> $LOGRES/IPERF_UDP_RESULT_GIST_BOX.log
#Execute Iperf Server on Client Side
echo -e "************************************************************"
echo -e " Start Iperf Server Application at Box SmartX-BPlus-$countryID"
echo -e "************************************************************"
ssh root@SmartX-BPlus-$countryID 'iperf3 -s -D'&
sleep 10
echo -e " Start iperf TCP Client on SmartX-BPlus-GIST Site"
ssh root@SmartX-BPlus-GIST "iperf3 -c Data-$countryID -i 3 -t 20 -l 1M -O 12 -4 -N" | grep -A 1 "sender" | awk '{print $7" "$8}' | sed 'N;s/\n/ /' | sed 's/^/'$countryID' GIST TCP /' >> $LOGRES/IPERF_TCP_RESULT_GIST_BOX.log
echo -e " Start iperf UDP Client on SmartX-BPlus-GIST Site"
ssh root@SmartX-BPlus-GIST "iperf3 -c Data-$countryID -u -i 3 -t 15 -b 20M " | grep "0.00-15.00" | awk '{print $7" "$8" "$9" "$11" "$12}' | sed 's/^/'$countryID' GIST UDP /' >> $LOGRES/IPERF_UDP_RESULT_GIST_BOX.log
echo " Terminate iperf Server on the SmartX-BPlus-$countryID Site"
ssh root@SmartX-BPlus-$countryID 'killall -r -s KILL iperf3'
done
echo " Terminate iperf Server on the $SRVNAME Site"
echo -e "-----------------------------------------------------------\n"
ssh root@SmartX-BPlus-GIST 'killall -r -s KILL iperf3'
echo -e "Iperf is done...\n"
}
function check_vm {
echo -e "\n"
echo -e "--------------------------------------------------"
echo -e "| Start Compute Resource (VM) Checking |"
echo -e "--------------------------------------------------"
for vmID in $VM_SITES_GIST
do
echo -e "Checking for SmartX-BPlus-$vmID"
echo -e "-------------------------------"
GIST_CONTROL_PING_VM=`ssh root@SmartX-BPlus-GIST 'ping 'VM-Control-$vmID' -c 1 | grep icmp_seq'`
echo -e $GIST_CONTROL_PING_VM
#GIST VM Ping Checking
if [ "${GIST_CONTROL_PING_VM:-null}" = null ]; then
echo "Host VM-Control-$vmID is not reachable !!!"
GIST_CONTROL_VM_PING_RESULT=$GIST_CONTROL_VM_PING_RESULT,DOWN
else
echo "Host vm-SmartX-BPlus-$vmID is reachable."
GIST_CONTROL_VM_PING_RESULT=$GIST_CONTROL_VM_PING_RESULT,UP
fi
done
echo -e $GIST_CONTROL_VM_PING_RESULT
echo $GIST_CONTROL_VM_PING_RESULT >> $LOGRES/PING_RESULT_CONTROL_GIST_VM.log
echo $MYREN_CONTROL_VM_PING_RESULT >> $LOGRES/PING_RESULT_CONTROL_MYREN_VM.log
echo -e "VM Checking is done...\n"
}
#
# Main Script
#
echo -e "\n"
echo -e "#######################################################"
echo -e "# Checking Playground Resources for Health Monitoring #"
echo -e "#######################################################"
check_box
#check_box_bandwidth
#check_vm
echo -e "Checking Playground Resources is Completed.\n"
echo -e "\n"