#/bin/bash
test -n "$title" || title="download"
test -n "$names" || names="8to-sng-223.25.232.20 egihosting-sjc-72.13.91.89 gigenet-lax-66.55.88.48 linode-atlanta-50.116.39.117 linode-dallas-50.116.25.154 linode-fremont-50.116.14.9 linode-newark
-50.116.57.237 linode-tokyo-106.187.96.148 newmediaexpress-sng-202.150.221.170 peer1-atl-209.35.23.73 peer1-fmt-209.25.248.70 peer1-lax-76.74.154.100 peer1-mia-209.213.117.62 peer1-sa-69.174.244.23
5 peer1-tor-209.15.236.107 peer1-va-64.34.190.79 quadranet-lax-216.144.225.250 softlayer-sea-67.228.112.250 softlayer-sjc-50.97.237.130 softlayer-sng-216.12.198.98 voxel-sjc-107.6.90.66 voxel-sng-1
80.92.185.67 voxel-sng-180.92.185.70 worria-hk-103.246.244.174"
dates=`date +%d`
case $1 in
config)
printf "multigraph download_speed_$graph_id\n"
printf "graph_title $title speed\n";
printf "graph_args --base 1000 -l 0 -u 500 -r\n"
printf "graph_scale no\n"
printf "graph_vlabel download speed \n"
printf "graph_category $category\n"
printf "graph_info this graph show download speed\n"
k=0;
for name in $names; do
printf "speed$k.label $name-speed\n"
printf "speed$k.draw LINE2\n"
# printf "speed$k.type GAUGE\n"
printf "speed$k.info $name download speed\n"
printf "speed$k.min 0 \n"
printf "speed$k.max 500\n"
k=$(($k+1))
done
;;
*)
if [ "$names"!="" ];then
k=0;
for name in ${names};do
results=`curl -s http://cn2-router-reports-notun-vpn.vm.stm.com/report/throughput-POP-NOTUN/201209/${dates}/${name}.txt|tail -2|awk '{print $3}'|sed 's/(/ /g'`
for v in ${results}; do
printf "speed$k.value %.f\n" $v
k=$(($k+1))
done
done
fi
;;
esac