2012-03-27 22:41:26 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# tcp_retries revision 2 (Feb 2012)
|
|
|
|
#
|
|
|
|
# TCP retransmission rate. Useful for network debugging.
|
|
|
|
#
|
|
|
|
# Required privileges: none
|
|
|
|
#
|
|
|
|
# OS: Linux with procfs
|
|
|
|
#
|
|
|
|
# Author: Artem Sheremet <dot.doom@gmail.com>
|
|
|
|
#
|
|
|
|
|
|
|
|
#%# family=auto
|
|
|
|
#%# capabilities=autoconf
|
|
|
|
|
|
|
|
TCPSTAT=/proc/net/tcp
|
2011-10-23 00:01:39 +02:00
|
|
|
|
|
|
|
case $1 in
|
2012-03-27 22:41:26 +02:00
|
|
|
autoconf)
|
|
|
|
[ -r $TCPSTAT -o -r ${TCPSTAT}6 ] && echo "yes" || echo "no"
|
|
|
|
;;
|
2011-10-23 00:01:39 +02:00
|
|
|
config)
|
2012-03-27 22:41:26 +02:00
|
|
|
cat <<CONFIG
|
2011-10-23 00:01:39 +02:00
|
|
|
graph_title TCP retransmissions
|
|
|
|
graph_vlabel Rate, retrs/sockets
|
|
|
|
graph_category network
|
2012-03-27 22:41:26 +02:00
|
|
|
graph_info TCP sockets retransmission counters from $TCPSTAT
|
2011-10-23 00:01:39 +02:00
|
|
|
rate.label Retransmission rate
|
|
|
|
rate.draw LINE2
|
2012-03-27 22:41:26 +02:00
|
|
|
rate.min 0
|
|
|
|
CONFIG
|
|
|
|
;;
|
2011-10-23 00:01:39 +02:00
|
|
|
esac
|
|
|
|
|
|
|
|
cat /proc/net/tcp* | awk '
|
|
|
|
{
|
|
|
|
TOTAL += $7;
|
|
|
|
COUNT++;
|
|
|
|
}
|
|
|
|
|
|
|
|
END {
|
|
|
|
printf "rate.value %.3f\n", TOTAL/COUNT
|
|
|
|
}
|
|
|
|
'
|