Skip to content

Commit

Permalink
[debug dump util] Techsupport addition (#1669)
Browse files Browse the repository at this point in the history
What I did
HLD for Dump Utility: HLD.
For More info on Tech Support Addition: TechSupport

How I did it
Module Names are retrieved by parsing the output of dump state --show command.
  • Loading branch information
vivekrnv authored Sep 7, 2021
1 parent 9f2326e commit 26e700a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
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 @@ -1018,6 +1019,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 @@ -1130,6 +1156,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 @@ -1265,11 +1296,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 @@ -1311,6 +1344,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 @@ -1066,7 +1066,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 @@ -1081,6 +1082,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

0 comments on commit 26e700a

Please sign in to comment.