Skip to content
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

[debug dump util] Techsupport addition #1669

Merged
merged 7 commits into from
Sep 7, 2021
Merged
Show file tree
Hide file tree
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
38 changes: 37 additions & 1 deletion scripts/generate_dump
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ HOME=${HOME:-/root}
USER=${USER:-root}
TIMEOUT_MIN="5"
SKIP_BCMCMD=0
DEBUG_DUMP=false

handle_signal()
{
Expand Down Expand Up @@ -1015,6 +1016,31 @@ save_counter_snapshot() {
save_cmd_all_ns "ifconfig -a" "ifconfig.counters_$idx"
}

###############################################################################
# save the debug dump output
###############################################################################
save_dump_state_all_ns() {
MODULES="$(dump state -s | sed '1d;2d' | awk '{print $1}')"
local UVDUMP="unified_view_dump"
echo "DEBUG DUMP: Modules Available to Generate Debug Dump Output"
echo $MODULES
$MKDIR $V -p $LOGDIR/$UVDUMP

for addr in $MODULES;
do
save_cmd "dump state $addr all --key-map" "$UVDUMP/$addr"
if [[ ( "$NUM_ASICS" > 1 ) ]] ; then
for (( i=0; i<$NUM_ASICS; i++ ))
do
local cmd="dump state $addr all --key-map --namespace asic$i"
local file="$UVDUMP/$addr.asic$i"
save_cmd "$cmd" "$file"
done
fi
done
}


###############################################################################
# Main generate_dump routine
# Globals:
Expand Down Expand Up @@ -1127,6 +1153,11 @@ main() {
save_bfd_info
save_redis_info

if $DEBUG_DUMP
then
save_dump_state_all_ns
fi

save_cmd "docker ps -a" "docker.ps"
save_cmd "docker top pmon" "docker.pmon"

Expand Down Expand Up @@ -1262,11 +1293,13 @@ OPTIONS
"24 March", "yesterday", etc.
-t TIMEOUT_MINS
Command level timeout in minutes
-d
Collect the output of debug dump cli

EOF
}

while getopts ":xnvhzas:t:" opt; do
while getopts ":xnvhzas:t:d" opt; do
case $opt in
x)
# enable bash debugging
Expand Down Expand Up @@ -1308,6 +1341,9 @@ while getopts ":xnvhzas:t:" opt; do
t)
TIMEOUT_MIN="${OPTARG}"
;;
d)
DEBUG_DUMP=true
;;
/?)
echo "Invalid option: -$OPTARG" >&2
exit 1
Expand Down
7 changes: 6 additions & 1 deletion show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,8 @@ def users(verbose):
@click.option('--verbose', is_flag=True, help="Enable verbose output")
@click.option('--allow-process-stop', is_flag=True, help="Dump additional data which may require system interruption")
@click.option('--silent', is_flag=True, help="Run techsupport in silent mode")
def techsupport(since, global_timeout, cmd_timeout, verbose, allow_process_stop, silent):
@click.option('--debug-dump', is_flag=True, help="Collect Debug Dump Output")
def techsupport(since, global_timeout, cmd_timeout, verbose, allow_process_stop, silent, debug_dump):
"""Gather information for troubleshooting"""
cmd = "sudo timeout -s SIGTERM --foreground {}m".format(global_timeout)

Expand All @@ -1031,6 +1032,10 @@ def techsupport(since, global_timeout, cmd_timeout, verbose, allow_process_stop,

if since:
cmd += " -s '{}'".format(since)

if debug_dump:
cmd += " -d "

cmd += " -t {}".format(cmd_timeout)
run_command(cmd, display_cmd=verbose)

Expand Down