4 # Collect system & network configuration information.
9 PATH
=/bin
:/usr
/bin
:/sbin
:/usr
/sbin
12 if [ ${EUID} -ne 0 ]; then
22 ps axlww
> ${OUT}/ps
2>&1
25 # network interface configuration
27 ifconfig
-a -b > ${OUT}/ifconfig
2>&1
30 # network route configuration
32 netstat
-n -r >> ${OUT}/netstat
2>&1
37 for if in `ifconfig -l`
41 en
* ) ipconfig getpacket
${if} > ${OUT}/ipconfig
-${if} 2>&1
49 if [ -e /System
/Library
/CoreServices
/SystemVersion.plist
]; then
50 cat /System
/Library
/CoreServices
/SystemVersion.plist \
51 > ${OUT}/SystemVersion.plist
2>&1
53 if [ -e /System
/Library
/CoreServices
/ServerVersion.plist
]; then
54 cat /System
/Library
/CoreServices
/ServerVersion.plist \
55 > ${OUT}/ServerVersion.plist
2>&1
61 ioreg
-l > ${OUT}/ioreg
2>&1
66 hostinfo
> ${OUT}/hostinfo
2>&1
67 if [ -e /etc
/hostconfig
]; then
68 cat /etc
/hostconfig
> ${OUT}/etc.hostconfig
2>&1
74 scutil
--dns > ${OUT}/dns
-configuration 2>&1
75 if [ -e /etc
/resolv.conf
]; then
76 cat /etc
/resolv.conf
> ${OUT}/etc.resolv.conf
2>&1
78 if [ -e /var
/run
/resolv.conf
]; then
79 cat /var
/run
/resolv.conf
> ${OUT}/var.run.resolv.conf
2>&1
83 # NetInfo configuration
85 niutil
-statistics .
> ${OUT}/netinfo
-statistics 2>&1
86 if [ -f /var
/run
/niconfig_local.xml
]; then
87 cat /var
/run
/niconfig_local.xml
> ${OUT}/niconfig_local.xml
2>&1
91 # System / network preferences
94 /Library
/Preferences
/SystemConfiguration
/NetworkInterfaces.plist \
95 /Library
/Preferences
/SystemConfiguration
/com.apple.PowerManagement.plist \
96 /Library
/Preferences
/SystemConfiguration
/com.apple.airport.preferences.plist \
97 /Library
/Preferences
/SystemConfiguration
/com.apple.nat.plist \
98 /Library
/Preferences
/SystemConfiguration
/preferences.plist \
99 /Library
/Preferences
/com.apple.sharing.firewall.plist \
104 cat ${f} > ${OUT}/${b} 2>&1
111 ${PRIV} scutil
-p <<_END_OF_INPUT
116 if [ -f /var
/tmp
/configd
-store.xml
]; then
117 cp /var
/tmp
/configd
-store.xml
${OUT}/configd
-store.xml
119 if [ -f /var
/tmp
/configd
-pattern.xml
]; then
120 cp /var
/tmp
/configd
-pattern.xml
${OUT}/configd
-pattern.xml
122 if [ -f /var
/tmp
/configd
-session.xml
]; then
123 cp /var
/tmp
/configd
-session.xml
${OUT}/configd
-session.xml
127 # network reachability
129 scutil
-d -v -r www.apple.com
> ${OUT}/reachability
-info 2>&1
130 if [ -f /usr
/bin
/dig ]; then
131 dig -t any
-c any www.apple.com
> ${OUT}/dig-results 2>&1
135 # mounted filesystems
137 mount
> ${OUT}/mounted
-filesystems 2>&1
142 tail -1000 /var
/log
/system.log
> ${OUT}/system.log
147 if [ -f /var
/log
/ppp.log
]; then
148 cp /var
/log
/ppp.log
${OUT}/ppp.log
152 # kernel extensions statistic
154 if [ -f /usr
/sbin
/kextstat
]; then
155 kextstat
> ${OUT}/kextstat
2>&1
156 elif [ -f /usr
/sbin
/kmodstat
]; then
157 kmodstat
> ${OUT}/kmodstat
2>&1
163 echo "#" >> ${OUT}/network
-statistics
164 echo "# netstat -n -a -A -f inet" >> ${OUT}/network
-statistics
165 echo "#" >> ${OUT}/network
-statistics
166 netstat
-n -a -A -f inet
>> ${OUT}/network
-statistics 2>&1
167 echo "#" >> ${OUT}/network
-statistics
168 echo "# lsof -n -i -P" >> ${OUT}/network
-statistics
169 echo "#" >> ${OUT}/network
-statistics
170 lsof
-n -i -P >> ${OUT}/network
-statistics 2>&1
171 echo "#" >> ${OUT}/network
-statistics
172 echo "# netstat -s" >> ${OUT}/network
-statistics
173 echo "#" >> ${OUT}/network
-statistics
174 netstat
-s >> ${OUT}/network
-statistics 2>&1
175 echo "#" >> ${OUT}/network
-statistics
176 echo "# netstat -m" >> ${OUT}/network
-statistics
177 echo "#" >> ${OUT}/network
-statistics
178 netstat
-m >> ${OUT}/network
-statistics 2>&1
179 echo "#" >> ${OUT}/network
-statistics
180 echo "# netstat -i -n -d" >> ${OUT}/network
-statistics
181 echo "#" >> ${OUT}/network
-statistics
182 netstat
-i -n -d >> ${OUT}/network
-statistics 2>&1
183 echo "#" >> ${OUT}/network
-statistics
184 echo "# ipfw -at show" >> ${OUT}/network
-statistics
185 echo "#" >> ${OUT}/network
-statistics
186 ipfw
-at show
>> ${OUT}/network
-statistics 2>&1
187 echo "#" >> ${OUT}/network
-statistics
188 echo "# appletalk -s" >> ${OUT}/network
-statistics
189 echo "#" >> ${OUT}/network
-statistics
190 appletalk
-s >> ${OUT}/network
-statistics 2>&1
193 # system usage statistics
195 echo "#" > ${OUT}/system
-statistics
196 echo "# uptime" >> ${OUT}/system
-statistics
197 echo "#" >> ${OUT}/system
-statistics
198 uptime
>> ${OUT}/system
-statistics 2>&1
199 echo "#" >> ${OUT}/system
-statistics
200 echo "# pstat -t" >> ${OUT}/system
-statistics
201 echo "#" >> ${OUT}/system
-statistics
202 pstat
-t >> ${OUT}/system
-statistics 2>&1
203 echo "#" >> ${OUT}/system
-statistics
204 echo "# sysctl -a" >> ${OUT}/system
-statistics
205 echo "#" >> ${OUT}/system
-statistics
206 sysctl
-a >> ${OUT}/system
-statistics 2>&1
207 echo "#" >> ${OUT}/system
-statistics
208 echo "# zprint" >> ${OUT}/system
-statistics
209 echo "#" >> ${OUT}/system
-statistics
210 zprint
>> ${OUT}/system
-statistics 2>&1
211 echo "#" >> ${OUT}/system
-statistics
212 echo "# top -l5 -s2" >> ${OUT}/system
-statistics
213 echo "#" >> ${OUT}/system
-statistics
215 echo "Please wait, collecting statistics"
217 top
-s 2 -l 5 >> ${OUT}/system
-statistics 2>&1
220 # collect crash reports
222 for daemon
in bootpd configd pppd
224 LOG
=${daemon}.crash.log
225 if [ -e /Library
/Logs
/CrashReporter
/${LOG} ]; then
226 cat /Library
/Logs
/CrashReporter
/${LOG} > ${OUT}/${LOG} 2>&1
231 # collect everything into a single archive
233 tar cfz
${OUT}.
tar.gz
${OUT}
236 echo "Network data collected to /tmp/${OUT}.tar.gz"