-
Notifications
You must be signed in to change notification settings - Fork 1
/
payload_script.sh
49 lines (44 loc) · 1.55 KB
/
payload_script.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
#!/usr/bin/env bash
targetIP=$1
displaytargetIP=`sed 's/\./_/g' <<< $targetIP`
targetPath=$2
IFS=';' read -ra testLines <<< $3
numLines=${#testLines[@]}
echo Got $numLines lines to execute
for (( i=0; i<$numLines; i++ ))
do
curLine=${testLines[$i]}
echo Parsing $curLine
IFS=',' read -ra lineParts <<< $curLine
numUsers=${lineParts[0]}
duration=${lineParts[1]}
throughput=${lineParts[2]}
ramp=${lineParts[3]}
curTimeString=`date '+%Y%m%d_%H%M_%S%N'`
outFile="jmeter_""$displaytargetIP""_""$numUsers""users_""$duration""dur_date""$curTimeString"".csv"
echo OutFile: $outFile
tmpDir='/tmp/'
destDir='/mnt/azure/results/'
if [ $numUsers -eq 0 ] && [ $duration -eq 0 ] && [ $throughput -eq 0 ] && [ $ramp -eq 0 ]
then
#TODO - need to add an option for Al's sequential tests
echo "Special Target: CURLing $numUser $duration $throughput $ramp"
curl $targetIP/$targetPath -o /mnt/azure/curl$curTimeString.txt
else
echo Starting JMeter
jMeterCmd="jmeter -n -t \"/tmp/main.jmx\" -JnumUsers=$numUsers -JtargetIP=\"$targetIP\" -JthroughputPerMin=$throughput -Jduration=$duration -JoutFile=\"$tmpDir$outFile\" -Jramp=$ramp -Jpath=\"$targetPath\""
#jMeterCmd='cat parameterizedramp.jmx'
echo $jMeterCmd
#$jMeterCmd
eval $jMeterCmd
fi
done
# Upload to storage
echo 10 second sleep
sleep 10
echo Moving Output
mv $tmpDir*.csv $destDir*.csv
echo Waiting to allow files to sync to Azure
sleep 60
echo Signal completion
echo Complete >> /tmp/isdone