X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=contrib%2Ftg.sh;fp=contrib%2Ftg.sh;h=7290ab8acaa41538a89cf3a44a46992410d69276;hb=b10d54ea2c267fce4e881b9d7e064427f6e6c34f;hp=0000000000000000000000000000000000000000;hpb=024a679ab580d1778f1f8fe61cc54c91cc3d5634;p=fprobe-ulog.git diff --git a/contrib/tg.sh b/contrib/tg.sh new file mode 100755 index 0000000..7290ab8 --- /dev/null +++ b/contrib/tg.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +Q=10000 + +if [[ $# -ne 2 ]]; then + echo -e "\ +Usage: `basename $0` [target] [number] + +This is simple traffic generator script for stress tests. +It based on the traceroute: ftp://ftp.ee.lbl.gov/traceroute.tar.gz +(FreeBSD and Debian Linux ships with this version). + +Script will send number*$Q UDP packets +and, of course, receive number*$Q ICMP replys. + +Note: for stress test you must turn off ICMP rate limit on target machine: +Linux: sysctl -w net/ipv4/icmp_ratelimit=0 +FreeBSD: sysctl -w net.inet.icmp.icmplim=0 +Solaris: /usr/sbin/ndd -set /dev/ip ip_icmp_err_interval 0 +" + exit +fi + +H=$1 +C=$2 +c=0 +s=$(date +%s) + +while [[ $((C--)) -gt 0 ]]; do + traceroute -n -q $Q $H &>/dev/null + e=$(date +%s) + l=$(($e-$s)) + c=$(($c+2*$Q)) + p=$(($c*10/($l*10+1))) + echo -ne "$l sec. $p pkts/s \r" +done +echo + +# v1.2 by sla@0n.ru