Monitoring RAID status on Adaptec 5405 controller

#!/bin/bash

DETECTOR=`/bin/arcconf getconfig 1 |grep -i optimal |wc -l`

if [ "$DETECTOR" -ne "2" ] 
then

	echo  "`/bin/arcconf getconfig 1`" | mail -s "There is problem with RAID" [email protected]

fi

Of course, you must add it to cron, for example like this:

*/10 * * * * /usr/local/bin/raid_check.sh

This is what: arcconf getconfig 1  command returns:

Bellow command, show information about RAID configuration and status, and also about logical and physical devices.

server:~# arcconf getconfig 1
Controllers found: 1
----------------------------------------------------------------------
Controller information
----------------------------------------------------------------------
   Controller Status                        : Optimal
   Channel description                      : SAS/SATA
   Controller Model                         : Adaptec 5405
   Controller Serial Number                 : 9D31112A78D
   Physical Slot                            : 49
   Temperature                              : 75 C/ 167 F (Normal)
   Installed memory                         : 256 MB
   Copyback                                 : Disabled
   Background consistency check             : Disabled
   Automatic Failover                       : Enabled
   Global task priority                     : High
   Performance Mode                         : Default/Dynamic
   Stayawake period                         : Disabled
   Spinup limit internal drives             : 0
   Spinup limit external drives             : 0
   Defunct disk drive count                 : 0
   Logical devices/Failed/Degraded          : 1/0/0
   SSDs assigned to MaxIQ Cache pool        : 0
   Maximum SSDs allowed in MaxIQ Cache pool : 8
   NCQ status                               : Enabled
   --------------------------------------------------------
   Controller Version Information
   --------------------------------------------------------
   BIOS                                     : 5.2-0 (17899)
   Firmware                                 : 5.2-0 (17899)
   Driver                                   : 1.1-5 (2461)
   Boot Flash                               : 5.2-0 (17899)
   --------------------------------------------------------
   Controller Battery Information
   --------------------------------------------------------
   Status                                   : Not Installed

----------------------------------------------------------------------
Logical device information
----------------------------------------------------------------------
Logical device number 0
   Logical device name                      : Device 0
   RAID level                               : 5
   Status of logical device                 : Optimal
   Size                                     : 342890 MB
   Stripe-unit size                         : 256 KB
   Read-cache mode                          : Enabled
   MaxIQ preferred cache setting            : Enabled
   MaxIQ cache setting                      : Disabled
   Write-cache mode                         : Enabled (write-back)
   Write-cache setting                      : Enabled (write-back)
   Partitioned                              : Yes
   Protected by Hot-Spare                   : No
   Bootable                                 : Yes
   Failed stripes                           : No
   Power settings                           : Disabled
   --------------------------------------------------------
   Logical device segment information
   --------------------------------------------------------
   Segment 0                                : Present (0,0) 10486536320009980002
   Segment 1                                : Present (0,1) 11096504340004610020
   Segment 2                                : Present (0,2) 1110652233000461006C
   Segment 3                                : Present (0,3) 10486536320009980024

----------------------------------------------------------------------
Physical Device information
----------------------------------------------------------------------
      Device #0
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SATA 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,0(0:0)
         Reported Location                  : Connector 0, Device 0
         Vendor                             :
         Model                              : Corsair CSSD-F12
         Firmware                           : 2.0
         Serial number                      : 10486536320009980002
         Size                               : 114473 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No
         S.M.A.R.T. warnings                : 0
         Power State                        : Full rpm
         Supported Power States             : Full rpm,Powered off
         SSD                                : Yes
         MaxIQ Cache Capable                : No
         MaxIQ Cache Assigned               : No
         NCQ status                         : Enabled
      Device #1
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SATA 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,1(1:0)
         Reported Location                  : Connector 0, Device 1
         Vendor                             :
         Model                              : Corsair CSSD-F12
         Firmware                           : 2.0
         Serial number                      : 11096504340004610020
         Size                               : 114473 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No
         S.M.A.R.T. warnings                : 0
         Power State                        : Full rpm
         Supported Power States             : Full rpm,Powered off
         SSD                                : Yes
         MaxIQ Cache Capable                : No
         MaxIQ Cache Assigned               : No
         NCQ status                         : Enabled
      Device #2
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SATA 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,2(2:0)
         Reported Location                  : Connector 0, Device 2
         Vendor                             :
         Model                              : Corsair CSSD-F12
         Firmware                           : 2.0
         Serial number                      : 1110652233000461006C
         Size                               : 114473 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No
         S.M.A.R.T. warnings                : 0
         Power State                        : Full rpm
         Supported Power States             : Full rpm,Powered off
         SSD                                : Yes
         MaxIQ Cache Capable                : No
         MaxIQ Cache Assigned               : No
         NCQ status                         : Enabled
      Device #3
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SATA 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,3(3:0)
         Reported Location                  : Connector 0, Device 3
         Vendor                             :
         Model                              : Corsair CSSD-F12
         Firmware                           : 2.0
         Serial number                      : 10486536320009980024
         Size                               : 114473 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No
         S.M.A.R.T. warnings                : 0
         Power State                        : Full rpm
         Supported Power States             : Full rpm,Powered off
         SSD                                : Yes
         MaxIQ Cache Capable                : No
         MaxIQ Cache Assigned               : No
         NCQ status                         : Enabled

Command completed successfully.

Shorter version of this command, exactly: arcconf getconfig 1 ld  , showing only logical device information. This means it only show information about RAID:

server:~# arcconf getconfig 1 ld
Controllers found: 1
----------------------------------------------------------------------
Logical device information
----------------------------------------------------------------------
Logical device number 0
   Logical device name                      : Device 0
   RAID level                               : 5
   Status of logical device                 : Optimal
   Size                                     : 342890 MB
   Stripe-unit size                         : 256 KB
   Read-cache mode                          : Enabled
   MaxIQ preferred cache setting            : Enabled
   MaxIQ cache setting                      : Disabled
   Write-cache mode                         : Enabled (write-back)
   Write-cache setting                      : Enabled (write-back)
   Partitioned                              : Yes
   Protected by Hot-Spare                   : No
   Bootable                                 : Yes
   Failed stripes                           : No
   Power settings                           : Disabled
   --------------------------------------------------------
   Logical device segment information
   --------------------------------------------------------
   Segment 0                                : Present (0,0) 10486536320009980002
   Segment 1                                : Present (0,1) 11096504340004610020
   Segment 2                                : Present (0,2) 1110652233000461006C
   Segment 3                                : Present (0,3) 10486536320009980024

Command completed successfully.

Last command: arcconf getconfig 1 AL , show information about all kinds of devices, this means, controller itself, RAID status and configuration, and also logical and physical devices:

server:~# arcconf getconfig 1 AL
Controllers found: 1
----------------------------------------------------------------------
Controller information
----------------------------------------------------------------------
   Controller Status                        : Optimal
   Channel description                      : SAS/SATA
   Controller Model                         : Adaptec 5405
   Controller Serial Number                 : 9D31112A78D
   Physical Slot                            : 49
   Temperature                              : 75 C/ 167 F (Normal)
   Installed memory                         : 256 MB
   Copyback                                 : Disabled
   Background consistency check             : Disabled
   Automatic Failover                       : Enabled
   Global task priority                     : High
   Performance Mode                         : Default/Dynamic
   Stayawake period                         : Disabled
   Spinup limit internal drives             : 0
   Spinup limit external drives             : 0
   Defunct disk drive count                 : 0
   Logical devices/Failed/Degraded          : 1/0/0
   SSDs assigned to MaxIQ Cache pool        : 0
   Maximum SSDs allowed in MaxIQ Cache pool : 8
   NCQ status                               : Enabled
   --------------------------------------------------------
   Controller Version Information
   --------------------------------------------------------
   BIOS                                     : 5.2-0 (17899)
   Firmware                                 : 5.2-0 (17899)
   Driver                                   : 1.1-5 (2461)
   Boot Flash                               : 5.2-0 (17899)
   --------------------------------------------------------
   Controller Battery Information
   --------------------------------------------------------
   Status                                   : Not Installed

----------------------------------------------------------------------
Logical device information
----------------------------------------------------------------------
Logical device number 0
   Logical device name                      : Device 0
   RAID level                               : 5
   Status of logical device                 : Optimal
   Size                                     : 342890 MB
   Stripe-unit size                         : 256 KB
   Read-cache mode                          : Enabled
   MaxIQ preferred cache setting            : Enabled
   MaxIQ cache setting                      : Disabled
   Write-cache mode                         : Enabled (write-back)
   Write-cache setting                      : Enabled (write-back)
   Partitioned                              : Yes
   Protected by Hot-Spare                   : No
   Bootable                                 : Yes
   Failed stripes                           : No
   Power settings                           : Disabled
   --------------------------------------------------------
   Logical device segment information
   --------------------------------------------------------
   Segment 0                                : Present (0,0) 10486536320009980002
   Segment 1                                : Present (0,1) 11096504340004610020
   Segment 2                                : Present (0,2) 1110652233000461006C
   Segment 3                                : Present (0,3) 10486536320009980024

----------------------------------------------------------------------
Physical Device information
----------------------------------------------------------------------
      Device #0
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SATA 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,0(0:0)
         Reported Location                  : Connector 0, Device 0
         Vendor                             :
         Model                              : Corsair CSSD-F12
         Firmware                           : 2.0
         Serial number                      : 10486536320009980002
         Size                               : 114473 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No
         S.M.A.R.T. warnings                : 0
         Power State                        : Full rpm
         Supported Power States             : Full rpm,Powered off
         SSD                                : Yes
         MaxIQ Cache Capable                : No
         MaxIQ Cache Assigned               : No
         NCQ status                         : Enabled
      Device #1
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SATA 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,1(1:0)
         Reported Location                  : Connector 0, Device 1
         Vendor                             :
         Model                              : Corsair CSSD-F12
         Firmware                           : 2.0
         Serial number                      : 11096504340004610020
         Size                               : 114473 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No
         S.M.A.R.T. warnings                : 0
         Power State                        : Full rpm
         Supported Power States             : Full rpm,Powered off
         SSD                                : Yes
         MaxIQ Cache Capable                : No
         MaxIQ Cache Assigned               : No
         NCQ status                         : Enabled
      Device #2
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SATA 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,2(2:0)
         Reported Location                  : Connector 0, Device 2
         Vendor                             :
         Model                              : Corsair CSSD-F12
         Firmware                           : 2.0
         Serial number                      : 1110652233000461006C
         Size                               : 114473 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No
         S.M.A.R.T. warnings                : 0
         Power State                        : Full rpm
         Supported Power States             : Full rpm,Powered off
         SSD                                : Yes
         MaxIQ Cache Capable                : No
         MaxIQ Cache Assigned               : No
         NCQ status                         : Enabled
      Device #3
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SATA 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,3(3:0)
         Reported Location                  : Connector 0, Device 3
         Vendor                             :
         Model                              : Corsair CSSD-F12
         Firmware                           : 2.0
         Serial number                      : 10486536320009980024
         Size                               : 114473 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No
         S.M.A.R.T. warnings                : 0
         Power State                        : Full rpm
         Supported Power States             : Full rpm,Powered off
         SSD                                : Yes
         MaxIQ Cache Capable                : No
         MaxIQ Cache Assigned               : No
         NCQ status                         : Enabled

Command completed successfully.