Skip to content

Commit

Permalink
[202012] [generate_dump] allow to extend dump with plugin scripts (#2269
Browse files Browse the repository at this point in the history
)

- What I did
Added support for tech support extension scripts,
by cherry-picking of #1335 to 202012 branch.

The purpose is to have dumps of extensions in SONiC techsupport, even without App Extension infrastructure.
The new application will write a file that contains the dump command into /usr/bin/debug-dump folder, and it will appear in the output of show techsupport command.

- How I did it
It looks at /usr/bin/debug-dump for scripts, if it finds one it will execute them and save the output to dump/ folder.

- How to verify it
Write a simple scripts with an output and place it under /usr/bin/debug-dump/
  • Loading branch information
noaOrMlnx authored Jul 18, 2022
1 parent ecca18f commit e462c09
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/generate_dump
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ DUMPDIR=/var/dump
TARDIR=$DUMPDIR/$BASE
TARFILE=$DUMPDIR/$BASE.tar
LOGDIR=$DUMPDIR/$BASE/dump
PLUGINS_DIR=/usr/local/bin/debug-dump
NUM_ASICS=1
HOME=${HOME:-/root}
USER=${USER:-root}
Expand Down Expand Up @@ -1216,6 +1217,14 @@ main() {
save_cmd "docker ps -a" "docker.ps"
save_cmd "docker top pmon" "docker.pmon"

if [[ -d ${PLUGINS_DIR} ]]; then
local -r dump_plugins="$(find ${PLUGINS_DIR} -type f -executable)"
for plugin in $dump_plugins; do
# save stdout output of plugin and gzip it
save_cmd "$plugin" "$(basename $plugin)" true
done
fi

save_saidump

if [[ "$asic" = "mellanox" ]]; then
Expand Down

0 comments on commit e462c09

Please sign in to comment.