Shell-script - How to find smart array failed disk, HP Array Configuration Utility CLI - hpacucli

How to find smart array failed disk

The hpacucli utility which is used to add, delete, identify and repair logical and physical disks on the Smart array. Here we have used the hpacucli utility to identify the failure of the disk.
 #!/bin/bash
 pd=`hpacucli controller all show config | awk '$10 ~ "Fail" || $11 ~ "Fail" { print $2}'`
 i=0
 while [ $i -le 3 ]
 do
   hpacucli controller slot=$i pd $pd show
   i=$(($i+1))
 done
OUTPUT:
Smart Array P400 in Slot 1

   array B (Failed)

      physicaldrive 1I:1:5
         Port: 1I
         Box: 1
         Bay: 5
         Status: Failed
         Drive Type: Data Drive
         Interface Type: SAS
         Size: 146 GB
         Rotational Speed: 10000
         Firmware Revision: HPD0
         Serial Number: xxxxxxxxxxx08xxx
         Model: HP      XXXXXXXXXX     
         PHY Count: 2
         PHY Transfer Rate: 3.0GBPS, Unknown
The above script executes and fetch the information of hpacucli.

How does the script works
 # hpacucli controller all show config | awk '$10 ~ "Fail" || $11 ~ "Fail" { print $2}'
OUTPUT:
1I:1:5
The above command displays the information of failed disk of smart array and it is stored in the variable pd. we get the

information by executing the below command with the above output.

 # hpacucli controller slot=1 pd 1I:1:5 show
OUTPUT:
Smart Array P400 in Slot 1

   array B (Failed)

      physicaldrive 1I:1:5
         Port: 1I
         Box: 1
         Bay: 5
         Status: Failed
         Drive Type: Data Drive
         Interface Type: SAS
         Size: 146 GB
         Rotational Speed: 10000
         Firmware Revision: HPD0
         Serial Number: xxxxxxxxxxx08xxx
         Model: HP      XXXXXXXXXX 
         PHY Count: 2
         PHY Transfer Rate: 3.0GBPS, Unknown

Commonly use hpacucli Abbrevations
 chassisname = ch
 controller = ctrl 
 logicaldrive = ld
 physicaldrive = pd 
 drivewritecache = dwc 

 # hpacucli controller all show config 
OUTPUT:
Smart Array P400 in Slot 1                (sn: urdiskserialno)

   array A (SAS, Unused Space: 0 MB)

      logicaldrive 1 (68.3 GB, RAID 1, OK)

      physicaldrive 2I:1:1 (port 2I:box 1:bay 1, SAS, 72 GB, OK)
      physicaldrive 2I:1:2 (port 2I:box 1:bay 2, SAS, 72 GB, OK)

   array B (SAS, Unused Space: 0 MB)

      logicaldrive 2 (410.1 GB, RAID 5, Interim Recovery Mode)

      physicaldrive 1I:1:5 (port 1I:box 1:bay 5, SAS, 146 GB, Failed)
      physicaldrive 1I:1:6 (port 1I:box 1:bay 6, SAS, 146 GB, OK)
      physicaldrive 2I:1:3 (port 2I:box 1:bay 3, SAS, 146 GB, OK)
      physicaldrive 2I:1:4 (port 2I:box 1:bay 4, SAS, 146 GB, OK)

The topic on Shell-script - How to find smart array failed disk is posted by - Math

Hope you have enjoyed, Shell-script - How to find smart array failed diskThanks for your time

Tech Bluff