3 IBPATH=${IBPATH:-@IBSCRIPTPATH@}
6 echo Usage: `basename $0` "[-h] [-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
37 -P | -C | -t | -timeout)
46 ca_info="$ca_info $1 $2"
53 if [ "$topofile" ]; then
62 if [ "$topofile" ]; then
63 netcmd="cat $topofile"
65 netcmd="$IBPATH/ibnetdiscover $ca_info"
75 function check_node(lid, port)
77 if (system("'$IBPATH'/ibchecknode '"$ca_info"' '$gflags' '$verbose' " lid)) {
79 print "\n# " ntype ": nodeguid 0x" nodeguid " failed"
82 if (system("'$IBPATH'/ibcheckerrs '"$ca_info"' '$gflags' '$verbose' '$brief' " lid " " port))
87 /^Ca/ || /^Switch/ || /^Rt/ {
89 ntype=$1; nodeguid=substr($3, 4, 16); ports=$2
90 if ('$v' || ntype != "Switch")
91 print "\n# Checking " ntype ": nodeguid 0x" nodeguid
94 if (ntype != "Switch")
97 lid = substr($0, index($0, "port 0 lid ") + 11)
98 lid = substr(lid, 1, index(lid, " ") - 1)
99 err = check_node(lid, 255)
104 sub("\\(.*\\)", "", port)
105 gsub("[\\[\\]]", "", port)
106 if (ntype != "Switch") {
107 lid = substr($0, index($0, " lid ") + 5)
108 lid = substr(lid, 1, index(lid, " ") - 1)
109 if (check_node(lid, port) == 2)
112 system("'$IBPATH'/ibcheckerrs '"$ca_info"' '$gflags' '$verbose' '$brief' " lid " " port))
114 if (system("'$IBPATH'/ibcheckport'"$ca_info"' '$gflags' '$verbose' " lid " " port)) {
115 if (!'$v' && oldlid != lid) {
116 print "# Checked " ntype ": nodeguid 0x" nodeguid " with failure"
123 /^ib/ {print $0; next}
124 /ibpanic:/ {print $0}
126 /iberror:/ {print $0}
129 printf "\n## Summary: %d nodes checked, %d bad nodes found\n", nnodes, ne
130 printf "## %d ports checked, %d bad ports found\n", nports, pe
131 printf "## %d ports have errors beyond threshold\n", pcnterr
132 exit (ne + pe + pcnterr)
136 if [ $av -ne 0 ] ; then