2

2 つのドメインのベンチマークを達成し、それらを 1 つのグラフにプロットしました。あとは、各ドメインのプロット ラインの色を変更するだけです。

plot=$plot" 'benchmark_server_data_$counter.dat' using 10 smooth sbezier with lines title '$x' lc rgb 'blue'" # This is the line where i need to replace blue with array 

たとえば、domain1.org の場合は緑色が必要で、domain2.com の場合は青色が必要です。色の配列を作成して for ループを使用する必要があると思います。私は試してみましたが、多くの問題があります。

while [ $i -lt 1 ]
do
what="http://domain1.org/,http://domain2.com/"
if [ -z "${what}" ];
then
echo "You did not specify a webserver to benchmark!"
else
OIFS=$IFS
IFS=','
arr=$what
counter=0
echo "set term png transparent truecolor" >> _temp.txt
#echo "set terminal png" >> _temp.txt
echo "set output 'out.png'" >> _temp.txt
echo "set title 'CodersHangout Webserver' tc rgb 'green' font 'Times-Roman, 20'" >> _temp.txt
echo "set size 1,1" >> _temp.txt
echo "set key left top tc rgb 'black' " >> _temp.txt
echo "set grid y " >> _temp.txt
echo "set xlabel 'Requests' font 'Times-Roman, 25' tc rgb 'green'" >> _temp.txt
echo "set ylabel 'Response time (ms)' font 'Times-Roman, 25' tc rgb 'green'" >> _temp.txt
echo "set xtics font 'Times-Roman, 20' tc rgb 'green'" >> _temp.txt
echo "set ytics font 'Times-Roman, 20' tc rgb 'green'" >> _temp.txt
echo "set object 1 rectangle from graph 0, graph 0 to graph 1, graph 1 behind fc rgbcolor 'gray' fs noborder" >> _temp.txt
plot="plot"
    for x in $arr
    do
            echo "> Running benchmark for $x"
            if [ "$counter" -gt 0 ];
            then
            plot=$plot","
            fi               
            plot=$plot" 'benchmark_server_data_$counter.dat' using 10 smooth sbezier with lines title '$x' lc rgb 'blue'" #Need to change the color of curve for different domains!
            ab -n $total -c $concurrent -k -g benchmark_server_data_$counter.dat -H 'Accept-Encoding:gzip,deflate' $x           
            counter=$(( counter + 1 ))      

    done
IFS=$OIFS
echo $plot >> _temp.txt
gnuplot _temp.txt
rm _temp.txt
rm benchmark_server_data_*
exec /opt/lampp/htdocs/serverstat/autoftp.sh
exit
fi
i=1
done
4

1 に答える 1