Tagging module iproute2 - iproute2-2.6.16-2
[iproute2.git] / misc / netbug
1 #! /bin/bash
2
3 echo -n "Send network configuration summary to [ENTER means kuznet@ms2.inr.ac.ru] "
4 IFS="" read mail || exit 1
5 [ -z "$mail" ] && mail=kuznet@ms2.inr.ac.ru
6
7
8 netbug=""
9 while [ "$netbug" = "" ]; do
10         netbug=`echo netbug.$$.$RANDOM`
11         if [ -e /tmp/$netbug ]; then
12                 netbug=""
13         fi
14 done
15
16 tmppath=/tmp/$netbug
17
18 trap "rm -rf $tmppath $tmppath.tar.gz" 0 SIGINT
19
20 mkdir $tmppath
21 mkdir $tmppath/net
22
23 cat /proc/slabinfo > $tmppath/slabinfo
24 cat /proc/net/netstat > $tmppath/net/netstat
25 cat /proc/net/unix > $tmppath/net/unix
26 cat /proc/net/packet > $tmppath/net/packet
27 cat /proc/net/netlink > $tmppath/net/netlink
28 cat /proc/net/psched > $tmppath/net/psched
29 cat /proc/net/softnet_stat > $tmppath/net/softnet_stat
30 cat /proc/net/sockstat > $tmppath/net/sockstat
31 cat /proc/net/tcp > $tmppath/net/tcp
32 cat /proc/net/udp > $tmppath/net/udp
33 cat /proc/net/raw > $tmppath/net/raw
34 cat /proc/net/snmp > $tmppath/net/snmp
35
36 ss -aioem -D $tmppath/tcpdiag
37
38 if [ -e /proc/net/tcp6 ]; then
39         cat /proc/net/sockstat6 > $tmppath/net/sockstat6
40         cat /proc/net/tcp6 > $tmppath/net/tcp6
41         cat /proc/net/udp6 > $tmppath/net/udp6
42         cat /proc/net/raw6 > $tmppath/net/raw6
43         cat /proc/net/snmp6 > $tmppath/net/snmp6
44 fi
45
46 cd /tmp
47 tar c $netbug | gzip -9c > $netbug.tar.gz
48
49 uuencode $netbug.tar.gz $netbug.tar.gz | mail -s $netbug "$mail"
50
51 echo "Sending to <$mail>; subject is $netbug"
52
53 exit 0