-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiperf_munin.sh
43 lines (35 loc) · 1.46 KB
/
iperf_munin.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
#!/bin/bash
# Available servers from Bouygues ISP :
# - bouygues.testdebit.info (Paris) : From port 9200 to port 9240
# - lyon.testdebit.info (Lyon) : From port 9200 to port 9240
# - aix-marseille.testdebit.info (Aix) : From port 9200 to port 9240
# - bordeaux.testdebit.info (Bordeaux) : From port 9200 to port 9240
# - lille.testdebit.info (Lille) : From port 9200 to port 9240
sleep $[ ( $RANDOM % 20 ) + 15 ]s
#Ajust the -f 12 option of cut for your version of iperf3 (sometimes it's more or less)
down=`iperf3 -f m -c lyon.testdebit.info -p 9217 -6 -R -P8 -O 2 -t 8\
| grep Mbits \
| cut -d ' ' -f 12 \
| sed '{$!d;}'`
echo "down.value $down" > /etc/munin/iperf.down
#No update if server is busy
if [ "$down" = "" ]
then
exit
else
echo "down.value $down" > /etc/munin/iperf.down
fi
#Upload speed for 10s with 4 parallels updtream in ipv4 an omitting the first 2 seconds (-O 2)
#Ajust the -f 12 option of cut for your version of iperf3 (sometimes it's more or less)
up=`iperf3 -f m -c lyon.testdebit.info -p 9219 -6 -P4 -O 2 -t 10\
| grep Mbits \
| cut -d ' ' -f 13 \
| sed '{$!d;}'`
echo "up.value $up" > /etc/munin/iperf.up
#No update if server is busy
if [ "$up" = "" ]
then
exit
else
echo "up.value $up" > /etc/munin/iperf.up
fi