Skip to content

[scripts/generate_dump] add information to tech-support file #2357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 64 additions & 2 deletions scripts/generate_dump
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,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 @@ -700,6 +701,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 @@ -757,7 +811,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 @@ -1309,6 +1363,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 @@ -1332,6 +1387,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 @@ -1394,6 +1450,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 All @@ -1419,7 +1481,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