root / plugins / network / tcp_retries @ 580c41ea
Historique | Voir | Annoter | Télécharger (728 octets)
| 1 |
#!/bin/sh |
|---|---|
| 2 |
|
| 3 |
# tcp_retries revision 2 (Feb 2012) |
| 4 |
# |
| 5 |
# TCP retransmission rate. Useful for network debugging. |
| 6 |
# |
| 7 |
# Required privileges: none |
| 8 |
# |
| 9 |
# OS: Linux with procfs |
| 10 |
# |
| 11 |
# Author: Artem Sheremet <dot.doom@gmail.com> |
| 12 |
# |
| 13 |
|
| 14 |
#%# family=auto |
| 15 |
#%# capabilities=autoconf |
| 16 |
|
| 17 |
TCPSTAT=/proc/net/tcp |
| 18 |
|
| 19 |
case $1 in |
| 20 |
autoconf) |
| 21 |
[ -r $TCPSTAT -o -r ${TCPSTAT}6 ] && echo "yes" || echo "no"
|
| 22 |
;; |
| 23 |
config) |
| 24 |
cat <<CONFIG |
| 25 |
graph_title TCP retransmissions |
| 26 |
graph_vlabel Rate, retrs/sockets |
| 27 |
graph_category network |
| 28 |
graph_info TCP sockets retransmission counters from $TCPSTAT |
| 29 |
rate.label Retransmission rate |
| 30 |
rate.draw LINE2 |
| 31 |
rate.min 0 |
| 32 |
CONFIG |
| 33 |
;; |
| 34 |
esac |
| 35 |
|
| 36 |
cat /proc/net/tcp* | awk ' |
| 37 |
{
|
| 38 |
TOTAL += $7; |
| 39 |
COUNT++; |
| 40 |
} |
| 41 |
|
| 42 |
END {
|
| 43 |
printf "rate.value %.3f\n", TOTAL/COUNT |
| 44 |
} |
| 45 |
' |
