Skip to content

Commit

Permalink
Adding global-timeout, individual command timeout, log files collecti…
Browse files Browse the repository at this point in the history
…on (sonic-net#1249)

 and some other enhancements to techsupport

**- What I did**
Following is the brief description of the changes,
- Adding a ‘--silent’ option to ‘show techsupport’ command. Various  tar/untar, addition and removal logs appear on the console by default. This option would disable above logs.
- Adding global and per-command timeouts. This would provide more user control on ‘show techsupport’ CLI.
- Adding time profiling information for the commands in techsupport. Time profiling information would be part of the tarball and helps to analyse the time consumption per command.
- Sometimes ‘syncd’ docker is down and bcmshell is unavailable. In such cases all the bcmcmd commands would timeout and result in tremendous increase in the total techsupport collection time. We provided an option to skip rest of the bcmcmd commands once one command times out.
- Added ‘show services’, ‘show reboot-cause’ and various BGP, BFD, bcm shell and other commands
- Optimised the /var/log files collection. If the number of files are large in /var/log folder, it takes a long time to add each individually to the tarball. If the folder is tar'ed at once, the time taken reduces significantly. 
- Following error was observed while tar'ing softlinks inside .etc folder. 
  ** Tar append operation failed. Aborting for safety. **
  This issue was due to softlinks present at /etc folder where the destination file is absent. Fixed this issue by deleting such softlinks before adding them to the tarball. 

**- How I did it**
- Added new options to the CLICK command 'show techsupport'
- Modified the 'generate_dump' script to accomodate other changes

**- How to verify it**
Here are some outputs,
root@sonic:/home/admin# show techsupport --silent
Techsupport is running with silent option. This command might take a long time.

HW Mgmt dump script /usr/bin/hw-management-generate-dump.sh does not exist
/var/dump/sonic_dump_sonic_20201117_161246.tar.gz
root@sonic:/home/admin#
root@sonic:~# show techsupport -h
Usage: show techsupport [OPTIONS]

  Gather information for troubleshooting

Options:
  --since TEXT                  Collect logs and core files since given date
  -g, --global-timeout INTEGER  Global timeout for techsupport in minutes.
                                Default 30 mins
  -c, --cmd-timeout INTEGER     Command timeout for techsupport in minutes.
                                Default 5 mins
  --verbose                     Enable verbose output
  --silent                      Run techsupport in silent mode
  -?, -h, --help                Show this message and exit.
root@sonic:~#

**- Previous command output (if the output of a command-line utility has changed)**
- Previous command "show techsupport" works as is
**- New command output (if the output of a command-line utility has changed)**
  • Loading branch information
FuzailBrcm authored and anand-kumar-subramanian committed Mar 2, 2021
1 parent 04b207f commit 7006ed4
Show file tree
Hide file tree
Showing 2 changed files with 434 additions and 34 deletions.
Loading

0 comments on commit 7006ed4

Please sign in to comment.