Skip to content

Commit

Permalink
Add platform options to 'show techsupport' command (sonic-net#865)
Browse files Browse the repository at this point in the history
Signed-off-by: Shlomi Bitton <shlomibi@mellanox.com>
  • Loading branch information
shlomibitton authored Apr 13, 2020
1 parent 3bb70c0 commit c0b2416
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions scripts/generate_dump
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,37 @@ save_redis() {
save_cmd "sonic-db-dump -n '$db_name' -y" "$db_name.json"
}

###############################################################################
# Runs a 'show platform' command, append the output to 'filename' and add to the incrementally built tar.
# Globals:
# LOGDIR
# BASE
# MKDIR
# TAR
# TARFILE
# DUMPDIR
# V
# RM
# Arguments:
# type: the type of platform information
# filename: the filename to save the output as in $BASE/dump
# Returns:
# None
###############################################################################
save_platform() {
local type="$1"
local filename=$2
local filepath="${LOGDIR}/$filename"
local tarpath="${BASE}/dump/$filename"
[ ! -d $LOGDIR ] && $MKDIR $V -p $LOGDIR

eval "show platform $type" &>> "$filepath"
echo $'\r' >> "$filepath"

($TAR $V -uhf $TARFILE -C $DUMPDIR "$tarpath" \
|| abort "${ERROR_TAR_FAILED}" "tar append operation failed. Aborting to prevent data loss.")
}

###############################################################################
# Runs a comamnd and saves its output to the incrementally built tar.
# Globals:
Expand Down Expand Up @@ -327,17 +358,20 @@ main() {
/proc/zoneinfo \
|| abort "${ERROR_PROCFS_SAVE_FAILED}" "Proc saving operation failed. Aborting for safety."

save_platform "syseeprom" "platform"
save_platform "psustatus" "platform"
save_platform "ssdhealth" "platform"
save_platform "temperature" "platform"
save_platform "fan" "platform"

save_cmd "show version" "version"
save_cmd "show platform summary" "platform.summary"
save_cmd "show platform syseeprom" "platform.syseeprom"
save_cmd "cat /host/machine.conf" "machine.conf"
save_cmd "docker stats --no-stream" "docker.stats"

save_cmd "sensors" "sensors"
save_cmd "show platform psustatus" "platform.psustatus"
save_cmd "lspci -vvv -xx" "lspci"
save_cmd "lsusb -v" "lsusb"

save_cmd "sysctl -a" "sysctl"
save_ip "link" "link"
save_ip "addr" "addr"
Expand Down

0 comments on commit c0b2416

Please # to comment.