diff --git a/scripts/generate_dump b/scripts/generate_dump index e38b0834f8..87d9fa4496 100755 --- a/scripts/generate_dump +++ b/scripts/generate_dump @@ -38,6 +38,7 @@ HOME=${HOME:-/root} USER=${USER:-root} TIMEOUT_MIN="5" SKIP_BCMCMD=0 +DEBUG_DUMP=false handle_signal() { @@ -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: @@ -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" @@ -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 @@ -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 diff --git a/show/main.py b/show/main.py index ac2cb51ac9..5ac20482eb 100755 --- a/show/main.py +++ b/show/main.py @@ -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) @@ -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)