3 IBPATH=${IBPATH:-@IBSCRIPTPATH@}
6 echo Usage: `basename $0` "[-h] [-b] [-v] [-N | -nocolor]"\
7 "[<topology-file> | -C ca_name -P ca_port -t(imeout) timeout_ms]"
11 function user_abort() {
16 trap user_abort SIGINT
44 -P | -C | -t | -timeout)
53 ca_info="$ca_info $1 $2"
60 if [ "$topofile" ]; then
69 if [ "$topofile" ]; then
70 netcmd="cat $topofile"
72 netcmd="$IBPATH/ibnetdiscover $ca_info"
81 function check_node(lid, port)
83 if (system("'$IBPATH'/ibchecknode '"$ca_info"' '$gflags' '$verbose' " lid)) {
85 print "\n# " ntype ": nodeguid 0x" nodeguid " failed"
88 if (system("'$IBPATH'/ibcheckerrs '"$ca_info"' '$gflags' '$verbose' '$brief' " lid " " port))
93 /^Ca/ || /^Switch/ || /^Rt/ {
95 ntype=$1; nodeguid=substr($3, 4, 16); ports=$2
97 print "\n# Checking " ntype ": nodeguid 0x" nodeguid
100 if (ntype != "Switch")
103 lid = substr($0, index($0, "port 0 lid ") + 11)
104 lid = substr(lid, 1, index(lid, " ") - 1)
105 err = check_node(lid, 255)
110 sub("\\(.*\\)", "", port)
111 gsub("[\\[\\]]", "", port)
112 if (ntype != "Switch") {
113 lid = substr($0, index($0, " lid ") + 5)
114 lid = substr(lid, 1, index(lid, " ") - 1)
115 if (check_node(lid, port) == 2)
118 system("'$IBPATH'/ibcheckerrs '"$ca_info"' '$gflags' '$verbose' '$brief' " lid " " port))
122 /^ib/ {print $0; next}
123 /ibpanic:/ {print $0}
125 /iberror:/ {print $0}
128 printf "\n## Summary: %d nodes checked, %d bad nodes found\n", nnodes, ne
129 printf "## %d ports checked, %d ports have errors beyond threshold\n", nports, pcnterr