From 32fe4dacebc16f6dcfabe8569900fec093b2c9f6 Mon Sep 17 00:00:00 2001 From: Tony Floeder Date: Wed, 14 Aug 2024 10:15:44 -0500 Subject: [PATCH] tools script additions and improvements (#104) Signed-off-by: Anthony Floeder --- tools/collectNVLogs.sh | 38 +++++++++++++ tools/rabbit-s.sh | 42 ++++++++++++++- tools/show-drive-ports.sh | 109 ++++++++++++++++++++++++++++++++++++++ tools/switch.sh | 83 +++++++++++++++++++++-------- tools/timestamp-log.sh | 2 +- 5 files changed, 250 insertions(+), 24 deletions(-) create mode 100755 tools/collectNVLogs.sh create mode 100755 tools/show-drive-ports.sh diff --git a/tools/collectNVLogs.sh b/tools/collectNVLogs.sh new file mode 100755 index 0000000..719afa9 --- /dev/null +++ b/tools/collectNVLogs.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# Copyright 2024 Hewlett Packard Enterprise Development LP +# Other additional copyright holders may be indicated within. +# +# The entirety of this work is licensed under the Apache License, +# Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. +# +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# set -e +# set -o xtrace + +shopt -s expand_aliases + +logSources=("FLASH" "MEMLOG" "REGS" "THRD_STACK" "SYS_STACK" "THRDS" "NVHDR" "RAM") +switches=("/dev/switchtec0" "/dev/switchtec1") + +for switch in "${switches[@]}"; do + PAX_ID=$(switchtec fabric gfms-dump "$switch" | grep "^PAX ID:" | awk '{print $3}') + if ! (( PAX_ID >= 0 && PAX_ID <= 1 )); then + echo "$PAX_ID not in range 0-1" + exit 1 + fi + + for logSource in "${logSources[@]}"; do + echo pax"$PAX_ID"-"$logSource".log + switchtec log-dump "$switch" pax"$PAX_ID"-"$logSource".log --type="$logSource" + done +done \ No newline at end of file diff --git a/tools/rabbit-s.sh b/tools/rabbit-s.sh index 0c70a2e..3d5dbb5 100755 --- a/tools/rabbit-s.sh +++ b/tools/rabbit-s.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright 2020-2023 Hewlett Packard Enterprise Development LP +# Copyright 2020-2024 Hewlett Packard Enterprise Development LP # Other additional copyright holders may be indicated within. # # The entirety of this work is licensed under the Apache License, @@ -181,6 +181,46 @@ EOF EOF done ;; + hpecray-29) + for SESSION in "${SESSIONS[@]}" + do + + # For this run, we want to enable some logging settings that we have been leaving off for a while. + # FABIOV - 0x82 + # log -m 0x82 -s 3 + # log -m 0x82 -s 3 -p on + # PTD - 0x53 + # log -m 0x53 -s 3 + # log -m 0x53 -s 3 -p on + # fabdbg -s pax + # fabdbg -s fio + # fabdbg -s gfms + + $SSHPASS ssh root@$SYSTEM <<-EOF + screen -S $SESSION -X stuff "fabdbg -s pax\nfabdbg -s fio\nfabdbg -s gfms\nlog -m 0x82 -s 3\nlog -m 0x82 -s 3 -p on\nlog -m 0x53 -s 3\nlog -m 0x53 -s 3 -p on\n" +EOF + done + ;; + hpecray-32) + for SESSION in "${SESSIONS[@]}" + do + # Enables medium severity and turns on logging for the PSC module + # log -m 0x54 -s 3 + # log -m 0x54 -s 3 -p on + + # Enables logs for the fabric debug modules + # fabdbg -s pax + # fabdbg -s fio + # fabdbg -s gfms + + # Turn on the logging for all modules + # log -p on + $SSHPASS ssh root@$SYSTEM <<-EOF + screen -S $SESSION -X stuff "fabdbg -s pax\nfabdbg -s fio\nfabdbg -s gfms\nlog -m 0x54 -s 3\nlog -m 0x54 -s 3 -p on\nlog -p on\n" +EOF + done + ;; + quit-sessions) for SESSION in "${SESSIONS[@]}" do diff --git a/tools/show-drive-ports.sh b/tools/show-drive-ports.sh new file mode 100755 index 0000000..e67fc6b --- /dev/null +++ b/tools/show-drive-ports.sh @@ -0,0 +1,109 @@ +#!/bin/bash + +# Copyright 2024 Hewlett Packard Enterprise Development LP +# Other additional copyright holders may be indicated within. +# +# The entirety of this work is licensed under the Apache License, +# Version 2.0 (the "License"); you may not use this file except +# in compliance with the License. +# +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +usage() { + cat < /dev/null; then + CHASSIS=$("$COMMAND" $(hostname) | cut -c -7) + else + CHASSIS="x****c*" + fi +} + getPAXID() { local SWITCH_NAME=$1 @@ -104,6 +119,18 @@ getPAXID() { fi } +getPAXTemperature() { + local SWITCH_NAME=$1 + + # Make sure we can get the PAX ID + if [ ! "$(switchtec temp "$SWITCH_NAME")" ]; then + echo "Unable to retrieve PAX Temperature" + exit $? + fi + + PAX_TEMPERATURE=$(switchtec temp "$SWITCH_NAME") +} + setDeviceName() { DRIVES=() getDriveList @@ -118,6 +145,8 @@ setDeviceName() { displayDriveSlotStatus() { local SWITCH_NAME=$1 + getChassis + # Physical slot ids are set into the hardware. These are the mappings declare -a PAX0_DriveSlotFromPhysicalPort=( # Drives @@ -203,6 +232,8 @@ displayDriveSlotStatus() { displayStatus() { local SWITCH_NAME=$1 + getChassis + # Physical slot ids are set into the hardware. These are the mappings declare -a PAX0_ConnectedEPToPhysicalPort=( # Drives @@ -218,15 +249,15 @@ displayStatus() { # Other Links [0]="Interswitch Link " - [24]="Rabbit, x9000c?j7b0" - [32]="Compute 0, x9000c?s0b0n0" - [34]="Compute 1, x9000c?s0b1n0" - [36]="Compute 2, x9000c?s1b0n0" - [38]="Compute 3, x9000c?s1b1n0" - [40]="Compute 4, x9000c?s2b0n0" - [42]="Compute 5, x9000c?s2b1n0" - [44]="Compute 6, x9000c?s3b0n0" - [46]="Compute 7, x9000c?s3b1n0" + [24]="Rabbit, ${CHASSIS}r7b0n0" + [32]="Compute 0, ${CHASSIS}s0b0n0" + [34]="Compute 1, ${CHASSIS}s0b1n0" + [36]="Compute 2, ${CHASSIS}s1b0n0" + [38]="Compute 3, ${CHASSIS}s1b1n0" + [40]="Compute 4, ${CHASSIS}s2b0n0" + [42]="Compute 5, ${CHASSIS}s2b1n0" + [44]="Compute 6, ${CHASSIS}s3b0n0" + [46]="Compute 7, ${CHASSIS}s3b1n0" ) declare -a PAX1_ConnectedEPToPhysicalPort=( # Drives @@ -242,15 +273,15 @@ displayStatus() { # Other Links [0]="Interswitch Link " - [24]="Rabbit, x9000c?j7b0" - [32]="Compute 8, x9000c?s4b0n0" - [34]="Compute 9, x9000c?s4b1n0" - [36]="Compute 10, x9000c?s5b0n0" - [38]="Compute 11, x9000c?s5b1n0" - [40]="Compute 12, x9000c?s6b0n0" - [42]="Compute 13, x9000c?s6b1n0" - [44]="Compute 14, x9000c?s7b0n0" - [46]="Compute 15, x9000c?s7b1n0" + [24]="Rabbit, ${CHASSIS}r7b0n0" + [32]="Compute 8, ${CHASSIS}s4b0n0" + [34]="Compute 9, ${CHASSIS}s4b1n0" + [36]="Compute 10, ${CHASSIS}s5b0n0" + [38]="Compute 11, ${CHASSIS}s5b1n0" + [40]="Compute 12, ${CHASSIS}s6b0n0" + [42]="Compute 13, ${CHASSIS}s6b1n0" + [44]="Compute 14, ${CHASSIS}s7b0n0" + [46]="Compute 15, ${CHASSIS}s7b1n0" ) getPAXID "$SWITCH_NAME" @@ -258,7 +289,12 @@ displayStatus() { mapfile -t physicalPortIdStrings < <(switchtec status "$SWITCH_NAME" | grep "Phys Port ID:") local physicalPortString - printf "DEVICE: %s PAX_ID: %d\n\n" "$SWITCH_NAME" "$PAX_ID" + if [ "$VERBOSE" == "true" ]; then + getPAXTemperature "$SWITCH_NAME" + printf "DEVICE: %s PAX_ID: %d TEMP: %s\n\n" "$SWITCH_NAME" "$PAX_ID" "$PAX_TEMPERATURE" + else + printf "DEVICE: %s PAX_ID: %d\n\n" "$SWITCH_NAME" "$PAX_ID" + fi printf "Switch Connection \tStatus\n" printf "===========================\t======\n" for physicalPortString in "${physicalPortIdStrings[@]}"; @@ -285,13 +321,16 @@ displayStatus() { alias TIME="" -while getopts "th:" OPTION +while getopts "tvh:" OPTION do case "${OPTION}" in 't') alias TIME=time export TIMEFORMAT='%3lR' ;; + 'v') + export VERBOSE="true" + ;; 'h',*) usage exit 0 diff --git a/tools/timestamp-log.sh b/tools/timestamp-log.sh index c52f2bc..d390aa2 100755 --- a/tools/timestamp-log.sh +++ b/tools/timestamp-log.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright 2024 Hewlett Packard Enterprise Development LP +# Copyright 2020, 2021, 2022 Hewlett Packard Enterprise Development LP # Other additional copyright holders may be indicated within. # # The entirety of this work is licensed under the Apache License,