Wednesday, May 28, 2014

Linux: find hba information

-bash-3.2$ nsu
Password:
[root@redhat ~]# cd /opt/hp
[root@redhat hp]# ls
hpdiags        hp-ilo       hpsmh             hpssa
hp_fibreutils  hpmouse      hp-smh-templates  hpssacli
hp-health      hp-OpenIPMI  hp-snmp-agents
[root@redhat hp]# cd hp_fibreutils
[root@redhat hp_fibreutils]# ls
adapter_info  hp_rescan  lssd  lssg  scsi_info
[root@redhat hp_fibreutils]# ./hp_rescan -h
NAME

hp_rescan

DESCRIPTION

Sends the rescan signal to all or selected Fibre Channel HBAs/CNAs.

OPTIONS

-a, --all      - Rescan all Fibre Channel HBAs
-h, --help     - Prints this help message
-i, --instance - Rescan a particular instance
-l, --list     - List all supported Fibre Channel HBAs
[root@redhat hp_fibreutils]# ./hp_rescan -l
QLogic adapters:

/sys/class/scsi_host/1
/sys/class/scsi_host/2

Emulex adapters:


Brocade adapters:

[root@redhat hp_fibreutils]# cd /sys/class/scsi_host
[root@redhat scsi_host]# ls
host0  host1  host2
[root@redhat scsi_host]# ls -la
total 0
drwxr-xr-x  5 root root 0 May 23 14:25 .
drwxr-xr-x 43 root root 0 May 23 14:26 ..
drwxr-xr-x  2 root root 0 May 26 11:13 host0
drwxr-xr-x  2 root root 0 May 26 11:13 host1
drwxr-xr-x  2 root root 0 May 26 11:13 host2
[root@redhat scsi_host]# cd host1
[root@redhat host1]# ls
84xx_fw_version   model_desc            state
beacon            model_name            subsystem
cmd_per_lun       mpi_version           total_isp_aborts
device            npiv_vports_inuse     uevent
driver_version    optrom_bios_version   unchecked_isa_dma
fabric_param      optrom_efi_version    unique_id
flash_block_size  optrom_fcode_version  vlan_id
fw_dump_size      optrom_fw_version     vn_port_mac_address
fw_state          pci_info              vport_create
fw_version        phy_version           vport_delete
host_busy         proc_name             zio
isp_id            scan                  zio_timer
isp_name          serial_num
max_npiv_vports   sg_tablesize
[root@redhat host1]# more driver_version
8.04.00.12.5.6-k2
[root@redhat host1]# more model_name
QMH2462
[root@redhat host1]#

UNIX: How to print column nicely using printf

[user@hostfwnms1-oam tmp]# cat b.sh printf "%-26s %-19s %-8s %-8s %-s %-s\n" HOSTNAME IP PING SNMPWALK 0-ok 1-fail for i in `cat n...