HBA Port Status (Linux)
This checks for port state changes for HBA's on Linux. There is a specific command, array_info, that I parse and output the results.
This is an example of what i get when i run the array_info command.
/sys/class/scsi_host/host1: wwnn=0x2000d00d00d00 wwpn=0x2000d00d00d00 state=Online
/sys/class/scsi_host/host2: wwnn=0x211d11d11d11d wwpn=0x211d11d11d11d state=Online
/sys/class/scsi_host/host3: wwnn=0x222d22d222fa2 wwpn=0x222d22d222fa2 state=Linkdown
/sys/class/scsi_host/host4: wwnn=0x233d33d333fa3 wwpn=0x233d33d333fa3 state=Linkdown
I save the output in a temp file located /tmp/previous_array_info.txt. Each time it runs it compares the values from the previous poll to determine change.
If everything is OK i output this:
If a single port has an issue i output this:
If multiple ports are affected I output this: