Skip to content

Commit

Permalink
[scripts/generate_dump] add information to tech-support file (#2357)
Browse files Browse the repository at this point in the history
#### 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
  • Loading branch information
LimorAmit authored Oct 31, 2022
1 parent 8473517 commit 40cc8e1
Showing 1 changed file with 64 additions and 2 deletions.
66 changes: 64 additions & 2 deletions scripts/generate_dump
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,7 @@ save_ip_info() {
save_ip "route show table all" "route"
save_ip "neigh" "neigh"
save_ip "-s neigh show nud noarp" "neigh.noarp"
save_ip "-s link" "link.stats"
}

###############################################################################
Expand Down Expand Up @@ -773,6 +774,59 @@ save_proc() {
$RM $V -rf $TARDIR/proc
}

###############################################################################
# Dump io stats for processes
# Globals:
# V
# TARDIR
# MKDIR
# CP
# DUMPDIR
# TAR
# RM
# BASE
# TARFILE
# NOOP
# Arguments:
# None
# Returns:
# None
###############################################################################
save_proc_stats() {
trap 'handle_error $? $LINENO' ERR
$MKDIR $V -p $TARDIR/proc_stats

local stats_file=/tmp/stats
echo > $stats_file
for pid in /proc/[[:digit:]]*
do
pid_num=${pid//[!0-9]/}
cmdline=`eval ps -p $pid_num -o args --no-headers`
if test -n "$cmdline"; then
echo pid $pid
echo cmdline: $cmdline
cat $pid/io; echo
else
#Dump also internal kernel processes if they perform writes
write_bytes=$(cat $pid/io | grep -w write_bytes: | cut -b 14-)
if [ "$write_bytes" != "0" ]; then
echo pid $pid - `cat $pid/comm`:
cat $pid/io; echo
fi
fi
done >> $stats_file 2>&1

if $NOOP; then
echo "$CP $V -r $stats_file $TARDIR/proc_stats"
else
( $CP $V -r $stats_file $TARDIR/proc_stats ) || echo "$stats_file error" > $TARDIR/$stats_file
fi

$TAR $V -rhf $TARFILE -C $DUMPDIR --mode=+rw $BASE/proc_stats
$RM $V -rf $TARDIR/proc_stats
$RM -rf $stats_file
}

###############################################################################
# Dumps all fields and values from given Redis DB.
# Arguments:
Expand Down Expand Up @@ -830,7 +884,7 @@ save_platform_info() {
if [[ ! $PLATFORM =~ .*(mlnx|nvidia).*simx.* ]]; then
save_cmd "show platform syseeprom" "syseeprom"
save_cmd "show platform psustatus" "psustatus"
save_cmd "show platform ssdhealth" "ssdhealth"
save_cmd "show platform ssdhealth --vendor" "ssdhealth"
save_cmd "show platform temperature" "temperature"
save_cmd "show platform fan" "fan"
fi
Expand Down Expand Up @@ -1412,6 +1466,7 @@ main() {
/proc/uptime /proc/version /proc/vmallocinfo /proc/vmstat \
/proc/zoneinfo \
|| abort "${EXT_PROCFS_SAVE_FAILED}" "Proc saving operation failed. Aborting for safety."
save_proc_stats
end_t=$(date +%s%3N)
echo "[ Capture Proc State ] : $(($end_t-$start_t)) msec" >> $TECHSUPPORT_TIME_INFO

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

save_cmd "sensors" "sensors"
Expand Down Expand Up @@ -1498,6 +1554,12 @@ main() {
done
fi

save_cmd "dpkg -l" "dpkg"
save_cmd "who -a" "who"
save_cmd "swapon -s" "swapon"
save_cmd "hdparm -i /dev/sda" "hdparm"
save_cmd "ps -AwwL -o user,pid,lwp,ppid,nlwp,pcpu,pri,nice,vsize,rss,tty,stat,wchan:12,start,bsdtime,command" "ps.extended"

save_saidump

if [ "$asic" = "barefoot" ]; then
Expand Down Expand Up @@ -1527,7 +1589,7 @@ main() {
rm_list=$(find -L $TARDIR/etc -maxdepth 5 -type l)
if [ ! -z "$rm_list" ]
then
rm $rm_list
rm -f $rm_list
fi

# Remove secret from /etc files before tar
Expand Down

0 comments on commit 40cc8e1

Please sign in to comment.