Le script vérifie la présence d’erreurs « er_enc_out er_rx_c3_timeout er_tx_c3_timeout er_c3_dest_unreach er_other_discard » sur les ports actifs d’un switch FC, pour le contexte par defaut (128) et le contexte 10.
Il est testé pour Fabric OS V6.4.0a. Il nécessite un accès ssh sur le compte root (mais on doit pouvoir faire la même chose avec un compte moins privilégié, en faisant le traitement en local).
#!/bin/bash SWLIST="sw1 sw2" BCKPATH="/brocade/log" set -- $(date +%F) DATE=$1 # Récupération des compteurs dans des fichiers horodatés for switch in $SWLIST do FILE="$BCKPATH/errors_${switch}-${DATE}.txt" # Si le fichier est vide ou n'existe pas, on cree la ligne de description des colonnes [ -z $FILE ] || echo "port;er_enc_out;er_rx_c3_timeout;er_tx_c3_timeout;er_c3_dest_unreach;er_other_discard;" > $FILE echo "Recuperation er_enc_out, er_rx_c3_timeout, er_tx_c3_timeout, er_c3_dest_unreach, er_other_discard sur $switch, context 128 et context 10" ssh root@$switch " for port in $(/fabos/link_bin/switchshow | grep -v Disabled | awk '{print $1}' | grep [0-9]); do echo -n "$port;"; /fabos/link_bin/portstatsshow $port | grep "er_enc_out|er_rx_c3_timeout|er_tx_c3_timeout|er_c3_dest_unreach|er_other_discard" | awk '{printf "%d;",$2}'; echo "" ; done export FABOS_SWITCHNO CURRENT_VF ROLE_ID; FABOS_SWITCHNO=1; CURRENT_VF=10; ROLE_ID=root; for port in $(/fabos/link_bin/switchshow | grep -v Disabled | awk '{print $1}' | grep [0-9]); do echo -n "$port;"; /fabos/link_bin/portstatsshow $port | grep "er_enc_out|er_rx_c3_timeout|er_tx_c3_timeout|er_c3_dest_unreach|er_other_discard" | awk '{printf "%d;",$2}'; echo "" ; done " > $FILE done # Affichage des ports ayant des compteurs d'erreurs non nul for switch in $SWLIST do FILE="$BCKPATH/errors_${switch}-${DATE}.txt" echo "** $switch" grep -v ";0;0;0;0;0;" $FILE done