File: netbug

package info (click to toggle)
iproute 20061002-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,344 kB
  • ctags: 3,791
  • sloc: ansic: 29,692; sh: 2,950; cpp: 631; yacc: 339; makefile: 337; lex: 145; perl: 101
file content (45 lines) | stat: -rw-r--r-- 1,420 bytes parent folder | download | duplicates (2)
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
44
45
#! /bin/bash

set -e

echo -n "Send network configuration summary to [ENTER means kuznet@ms2.inr.ac.ru] "
IFS="" read mail || exit 1
[ -z "$mail" ] && mail=kuznet@ms2.inr.ac.ru

netbug=`mktemp -d -t netbug.XXXXXX` || {echo "$0: Cannot create temporary directory" >&2; exit 1;  }
netbugtar=`tempfile -d $netbug --suffix=tar.gz` || {echo "$0: Cannot create temporary file" >&2; exit 1;  }
tmppath=$netbug
trap "/bin/rm -rf $netbug $netbugtar" 0 1 2 3 13 15

mkdir $tmppath/net

cat /proc/slabinfo > $tmppath/slabinfo
cat /proc/net/netstat > $tmppath/net/netstat
cat /proc/net/unix > $tmppath/net/unix
cat /proc/net/packet > $tmppath/net/packet
cat /proc/net/netlink > $tmppath/net/netlink
cat /proc/net/psched > $tmppath/net/psched
cat /proc/net/softnet_stat > $tmppath/net/softnet_stat
cat /proc/net/sockstat > $tmppath/net/sockstat
cat /proc/net/tcp > $tmppath/net/tcp
cat /proc/net/udp > $tmppath/net/udp
cat /proc/net/raw > $tmppath/net/raw
cat /proc/net/snmp > $tmppath/net/snmp

ss -aioem -D $tmppath/tcpdiag

if [ -e /proc/net/tcp6 ]; then
	cat /proc/net/sockstat6 > $tmppath/net/sockstat6
	cat /proc/net/tcp6 > $tmppath/net/tcp6
	cat /proc/net/udp6 > $tmppath/net/udp6
	cat /proc/net/raw6 > $tmppath/net/raw6
	cat /proc/net/snmp6 > $tmppath/net/snmp6
fi

cd /tmp
tar c $tmppath | gzip -9c > $netbugtar
uuencode $netbugtar $netbugtar | mail -s $netbug "$mail"

echo "Sending to <$mail>; subject is $netbug"

exit 0