Skip to content

Commit 40cc8e1

Browse files
authored
[scripts/generate_dump] add information to tech-support file (sonic-net#2357)
#### What I did I added/extended some commands of the generate_dump script to collect more information about the system and processes. In addition, I removed some errors when trying to remove files that don't exist. #### How I did it create new function and add new calls for commands to get more information. Regarding the error messages - I checked before removing the files and remove with force parameter. #### How to verify it verified that the new files and information are part of the dump
1 parent 8473517 commit 40cc8e1

File tree

1 file changed

+64
-2
lines changed

1 file changed

+64
-2
lines changed

scripts/generate_dump

+64-2
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,7 @@ save_ip_info() {
658658
save_ip "route show table all" "route"
659659
save_ip "neigh" "neigh"
660660
save_ip "-s neigh show nud noarp" "neigh.noarp"
661+
save_ip "-s link" "link.stats"
661662
}
662663

663664
###############################################################################
@@ -773,6 +774,59 @@ save_proc() {
773774
$RM $V -rf $TARDIR/proc
774775
}
775776

777+
###############################################################################
778+
# Dump io stats for processes
779+
# Globals:
780+
# V
781+
# TARDIR
782+
# MKDIR
783+
# CP
784+
# DUMPDIR
785+
# TAR
786+
# RM
787+
# BASE
788+
# TARFILE
789+
# NOOP
790+
# Arguments:
791+
# None
792+
# Returns:
793+
# None
794+
###############################################################################
795+
save_proc_stats() {
796+
trap 'handle_error $? $LINENO' ERR
797+
$MKDIR $V -p $TARDIR/proc_stats
798+
799+
local stats_file=/tmp/stats
800+
echo > $stats_file
801+
for pid in /proc/[[:digit:]]*
802+
do
803+
pid_num=${pid//[!0-9]/}
804+
cmdline=`eval ps -p $pid_num -o args --no-headers`
805+
if test -n "$cmdline"; then
806+
echo pid $pid
807+
echo cmdline: $cmdline
808+
cat $pid/io; echo
809+
else
810+
#Dump also internal kernel processes if they perform writes
811+
write_bytes=$(cat $pid/io | grep -w write_bytes: | cut -b 14-)
812+
if [ "$write_bytes" != "0" ]; then
813+
echo pid $pid - `cat $pid/comm`:
814+
cat $pid/io; echo
815+
fi
816+
fi
817+
done >> $stats_file 2>&1
818+
819+
if $NOOP; then
820+
echo "$CP $V -r $stats_file $TARDIR/proc_stats"
821+
else
822+
( $CP $V -r $stats_file $TARDIR/proc_stats ) || echo "$stats_file error" > $TARDIR/$stats_file
823+
fi
824+
825+
$TAR $V -rhf $TARFILE -C $DUMPDIR --mode=+rw $BASE/proc_stats
826+
$RM $V -rf $TARDIR/proc_stats
827+
$RM -rf $stats_file
828+
}
829+
776830
###############################################################################
777831
# Dumps all fields and values from given Redis DB.
778832
# Arguments:
@@ -830,7 +884,7 @@ save_platform_info() {
830884
if [[ ! $PLATFORM =~ .*(mlnx|nvidia).*simx.* ]]; then
831885
save_cmd "show platform syseeprom" "syseeprom"
832886
save_cmd "show platform psustatus" "psustatus"
833-
save_cmd "show platform ssdhealth" "ssdhealth"
887+
save_cmd "show platform ssdhealth --vendor" "ssdhealth"
834888
save_cmd "show platform temperature" "temperature"
835889
save_cmd "show platform fan" "fan"
836890
fi
@@ -1412,6 +1466,7 @@ main() {
14121466
/proc/uptime /proc/version /proc/vmallocinfo /proc/vmstat \
14131467
/proc/zoneinfo \
14141468
|| abort "${EXT_PROCFS_SAVE_FAILED}" "Proc saving operation failed. Aborting for safety."
1469+
save_proc_stats
14151470
end_t=$(date +%s%3N)
14161471
echo "[ Capture Proc State ] : $(($end_t-$start_t)) msec" >> $TECHSUPPORT_TIME_INFO
14171472

@@ -1435,6 +1490,7 @@ main() {
14351490
save_cmd "show version" "version"
14361491
save_cmd "show platform summary" "platform.summary"
14371492
save_cmd "cat /host/machine.conf" "machine.conf"
1493+
save_cmd "cat /boot/config-$(uname -r)" "boot.conf"
14381494
save_cmd "docker stats --no-stream" "docker.stats"
14391495

14401496
save_cmd "sensors" "sensors"
@@ -1498,6 +1554,12 @@ main() {
14981554
done
14991555
fi
15001556

1557+
save_cmd "dpkg -l" "dpkg"
1558+
save_cmd "who -a" "who"
1559+
save_cmd "swapon -s" "swapon"
1560+
save_cmd "hdparm -i /dev/sda" "hdparm"
1561+
save_cmd "ps -AwwL -o user,pid,lwp,ppid,nlwp,pcpu,pri,nice,vsize,rss,tty,stat,wchan:12,start,bsdtime,command" "ps.extended"
1562+
15011563
save_saidump
15021564

15031565
if [ "$asic" = "barefoot" ]; then
@@ -1527,7 +1589,7 @@ main() {
15271589
rm_list=$(find -L $TARDIR/etc -maxdepth 5 -type l)
15281590
if [ ! -z "$rm_list" ]
15291591
then
1530-
rm $rm_list
1592+
rm -f $rm_list
15311593
fi
15321594

15331595
# Remove secret from /etc files before tar

0 commit comments

Comments
 (0)