Архив метки: arcconf

Мониторинг дисков используя arcconf

Для начала нужно убедиться, что у нас именно Adaptec AAC-Raid

root@s05:~# lspci | grep -i raid
04:00.0 RAID bus controller: Adaptec AAC-RAID (Rocket) (rev 02)

Вывод может быть и такого типа

RAID bus controller [0104]: Adaptec AAC-RAID
RAID bus controller [0104]: Dell PowerEdge Expandable RAID Controller 3/Di
RAID bus controller [0104]: Adaptec AAC-RAID (Rocket)

Следующим шагом нужно установить opensource утилиту arcconf с моего любимого репозитория.

root@s05:~#echo 'deb http://hwraid.le-vert.net/ubuntu precise main' > /etc/apt/sources.list.d/raid.list
root@s05:~#wget -O - http://hwraid.le-vert.net/debian/hwraid.le-vert.net.gpg.key | sudo apt-key add -
root@s05:~#apt-get update
root@s05:~#apt-get install arcconf

Первой командой нужно вытянуть информацию об контроллере. Эта же команда нам даст всю необходимую информацию о статусе батарее, логических и физических дисках.

root@s05:~#arcconf GETCONFIG 1
Controllers found: 1
----------------------------------------------------------------------
Controller information
----------------------------------------------------------------------
   Controller Status                        : Optimal
   Channel description                      : SAS/SATA
   Controller Model                         : IBM ServeRAID 8k
   Controller Serial Number                 : 11AE500
   Physical Slot                            : 0
   Installed memory                         : 256 MB
   Copyback                                 : Disabled
   Background consistency check             : Enabled
   Automatic Failover                       : Enabled
   Stayawake period                         : Disabled
   Spinup limit internal drives             : 0
   Spinup limit external drives             : 0
   Defunct disk drive count                 : 0
   Logical devices/Failed/Degraded: 2/0/0
   --------------------------------------------------------
   Controller Version Information
   --------------------------------------------------------
   BIOS                                     : 5.2-0 (11835)
   Firmware                                 : 5.2-0 (11835)
   Driver                                   : 1.2-0 (29801)
   Boot Flash                               : 5.1-0 (11835)
   --------------------------------------------------------
   Controller Battery Information
   --------------------------------------------------------
   Status                                   : Optimal
   Over temperature                         : No
   Capacity remaining                       : 100 percent
   Time remaining (at current draw)         : 4 days, 15 hours, 11 minutes
----------------------------------------------------------------------
Logical device information
----------------------------------------------------------------------
Logical device number 0
   Logical device name                      : OS
   RAID level                               : 1
   Status of logical device                 : Optimal
   Size                                     : 953690 MB
   Read-cache mode                          : Enabled
   Write-cache mode                         : Enabled (write-back)
   Write-cache setting                      : Enabled (write-back) when protected by
attery/ZMM
   Partitioned                              : Yes
   Protected by Hot-Spare                   : No
   Bootable                                 : Yes
   Failed stripes                           : No
   Power settings                           : Disabled
   --------------------------------------------------------
   Logical device segment information
   --------------------------------------------------------
   Segment 0                                : Present
Controller:1,Enclosure:0,Slot:0) 9WK1J5H8
   Segment 1                                : Present
Controller:1,Enclosure:0,Slot:1) 9WK5S550
Logical device number 1
   Logical device name                      : DATA
   RAID level                               : 5
   Status of logical device                 : Optimal
   Size                                     : 2861090 MB
   Stripe-unit size                         : 256 KB
   Read-cache mode                          : Enabled
   Write-cache mode                         : Enabled (write-back)
   Write-cache setting                      : Enabled (write-back) when protected by
attery/ZMM
   Partitioned                              : Yes
   Protected by Hot-Spare                   : No
   Bootable                                 : No
   Failed stripes                           : No
   Power settings                           : Disabled
   --------------------------------------------------------
   Logical device segment information
   --------------------------------------------------------
   Segment 0                                : Present
Controller:1,Channel:0,Device:2)
   Segment 1                                : Present
Controller:1,Enclosure:0,Slot:3) 9WK1J37S
   Segment 2                                : Present
Controller:1,Enclosure:0,Slot:4) 9WK0KN2E
   Segment 3                                : Present
Controller:1,Enclosure:0,Slot:5) 9WK1J547
----------------------------------------------------------------------
Physical Device information
----------------------------------------------------------------------
      Device #0
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SAS 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,0(0:0)
         Reported Location                  : Enclosure 0, Slot 0
         Reported ESD(T:L)                  : 2,0(0:0)
         Vendor                             : IBM-ESXS
         Model                              : ST31000424SS
         Firmware                           : BC21
         Serial number                      : 9WK1J5H8
         World-wide name                    : 5000C50021389DDC
         Size                               : 953869 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : 49Y1880
         S.M.A.R.T.                         : No
         S.M.A.R.T. warnings                : 0
      Device #1
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SAS 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,1(1:0)
         Reported Location                  : Enclosure 0, Slot 1
         Reported ESD(T:L)                  : 2,0(0:0)
         Vendor                             : IBM-ESXS
         Model                              : ST31000424SS
         Firmware                           : BC29
         Serial number                      : 9WK5S550
         World-wide name                    : 5000C5004164ABFC
         Size                               : 953869 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : 49Y1880
         S.M.A.R.T.                         : No
         S.M.A.R.T. warnings                : 0
      Device #2
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SAS 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,2(2:0)
         Vendor                             : IBM-ESXS
         Model                              : ST31000424SS
         Firmware                           : BC21
         World-wide name                    : 5000C50021388F60
         Size                               : 953869 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : None
         S.M.A.R.T.                         : No
         S.M.A.R.T. warnings                : 0
      Device #3
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SAS 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,3(3:0)
         Reported Location                  : Enclosure 0, Slot 3
         Reported ESD(T:L)                  : 2,0(0:0)
         Vendor                             : IBM-ESXS
         Model                              : ST31000424SS
         Firmware                           : BC21
         Serial number                      : 9WK1J37S
         World-wide name                    : 5000C5002138E354
         Size                               : 953869 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : 49Y1880
         S.M.A.R.T.                         : No
         S.M.A.R.T. warnings                : 0
      Device #4
         Device is a Hard drive
         State                              : Online
         Supported                          : Yes
         Transfer Speed                     : SAS 3.0 Gb/s
         Reported Channel,Device(T:L)       : 0,4(4:0)
         Reported Location                  : Enclosure 0, Slot 4
         Reported ESD(T:L)                  : 2,0(0:0)
         Vendor                             : IBM-ESXS
         Model                              : ST31000424SS
         Firmware                           : BC21
         Serial number                      : 9WK0KN2E
         World-wide name                    : 5000C5002103D428
         Size                               : 953869 MB
         Write Cache                        : Enabled (write-back)
         FRU                                : 49Y1880
         S.M.A.R.T.                         : No
         S.M.A.R.T. warnings                : 0
      Device #6
         Device is an Enclosure services device
         Reported Channel,Device(T:L)       : 2,0(0:0)
         Enclosure ID                       : 0
         Type                               : SES2
         Vendor                             : IBM-ESXS
         Model                              : VSC7160
         Firmware                           : 1.06
         Status of Enclosure services device
Command completed successfully.

Из всего полученного вывода нам нужны только такие параметра как состояние контроллера (Controller Status), статус батареи BBU (Controller Battery Information), статус логических дисковых масивов (Status of logical device) и статус каждого физического диска (Device #*). Для этого я написал маленький скрипт, подобный скрипту в предыдущей статье.

#!/bin/bash
ERROR_COUNT=0
LOG="/tmp/aacraid.log"
arcconf GETCONFIG 1 > $LOG
if [ "$?" -ne "0" ]
then
ERROR_STR="Cannot write to log"
let "ERROR_COUNT += 1"
fi
CONTROLLER=cat $LOG | grep -E 'Controller Status' | awk '{ print $4 }'
BATTERY=cat $LOG | grep -A 2 'Controller Battery Information' | grep Status | awk '{print $3}'
LOGICAL_DEVICE=cat $LOG | grep -E 'Status of logical device' | awk '{print $6}'
PHISICAL_DEVICE=cat $LOG | grep -A 2 -E 'Device #[0-9]' | grep State | awk '{print $3}'
get_status() {
while read line ; do
if [ -n "$line" ]
then
if [ "$line" = "Optimal" ] || [ "$line" = "Online" ]
then
echo "Test result is OK" > /dev/null
else
#echo "Test result is FAIL"
ERROR_STR="Some poblem with ACC-raid. Please check $LOG file
"
let "ERROR_COUNT += 1"
fi
fi
done <<< "$1"
}
get_status "${CONTROLLER}"
get_status "${BATTERY}"
get_status "${LOGICAL_DEVICE}"
get_status "${PHISICAL_DEVICE}"
.
if [ -n "$1" ] && [ "$1" = "log" ]
then
echo ${ERROR_STR}
echo "Controller Status is ${CONTROLLER}"
echo "Controller Battery Status is ${BATTERY}"
echo "Status of LDs are ${LOGICAL_DEVICE}"
echo "Status of PDs are:" && cat $LOG | grep -A 2 -E 'Device #[0-9]'
else
echo ${ERROR_COUNT}
fi

Опишу немного данный скрипт. Сначала мы сохраняем всю информацию о здоровье контроллера в файл /tmp/aacraid.log. Далее вытаскиваем значение статуса контроллера, батареи, логических и физических дисков. В функции get_status перебираются все полученные значения и сравниваются со статусами Optimal и Online. Если значения отличны от нормальных, значит есть проблема и число ошибок растет. Если скрипт запустить без аргументов, то мы получим число ошибок, если добавить аргумент log – узнаем с чем именно у нас проблемы.
Проверяем.

root@s05:~# ./aacraid.sh
0
root@s05:~# ./aacraid.sh log
Controller Status is Optimal
Controller Battery Status is Optimal
Status of LDs are
Optimal
Optimal
Status of PDs are:
      Device #0
         Device is a Hard drive
         State                              : Online
--
      Device #1
         Device is a Hard drive
         State                              : Online
--
      Device #2
         Device is a Hard drive
         State                              : Online
--
      Device #3
         Device is a Hard drive
         State                              : Online
--
      Device #4
         Device is a Hard drive
         State                              : Online
--
      Device #5
         Device is a Hard drive
         State                              : Online

Полезные команды утилиты arcconf

# Получить информацию только об адаптере(включая батарею и прошивку)
ARCCONF GETCONFIG 1 AD
# Получить информацию только о логических устройствах
ARCCONF GETCONFIG 1 LD
# Получить информацию только о логическом устройстве с номером 0
ARCCONF GETCONFIG 1 LD 0
# Получить информацию только о физических устройствах
ARCCONF GETCONFIG 1 PD
# Получить информацию только о логических устройствах
ARCCONF GETCONFIG 1 LD
# Поставить/удалить Secure Erase пароль на диск с каналом 0 и ID 0
# Узнать нужны канал и ID диска можно так - arcconf GETCONFIG 1 PD | grep 'Reported hannel,Device'
ARCCONF ATAPASSWORD 1 SET uR8ryx 0 1
ARCCONF ATAPASSWORD 1 CLEAR uR8ryx 0 1
# Создание логического диска с размером блока 64КБ(STRIPESIZE 64) с максимально допустимым размером(MAX), с нулевым рейдом (RAID# = 0) состоящим из дисков (CHANNEL# DRIVE# = 0 1, 0 2, 0 3) без задания лишних вопросов (NOPROMPT)
ARCCONF CREATE 1 LOGICALDRIVE STRIPESIZE 64 MAX 0 0 1 0 2 0 3 NOPROMPT
# Проверка целостности контроллера с номером 1 каждые 30 дней
ARCCONF DATASCRUB 1 PERIOD 30
# Выключить проверку целостности
ARCCONF DATASCRUB 1 OFF
# Удалить логические устройства 1,2 и 3
ARCCONF DELETE 1 LOGICALDRIVE 1 2 3
# Получить лог по ошибках дисков (DEVICE), по умерших устройствах (DEAD), по последних событиях (EVENT) и статистику использования контроллера (STATS) в читабельном формате (Tabular)
ARCCONF GETLOGS 1 DEVICE Tabular
ARCCONF GETLOGS 1 DEAD Tabular
ARCCONF GETLOGS 1 EVENT Tabular
ARCCONF GETLOGS 1 STATS Tabular
# Засветить LED к котором подсоединены логические или физические диски контроллера с номером 1
ARCCONF IDENTIFY 1 DEVICE 0 0
ARCCONF IDENTIFY 1 DEVICE 0 1
ARCCONF IDENTIFY 1 ALL
ARCCONF IDENTIFY 1 LOGICALDRIVE 0
ARCCONF IDENTIFY 1 LOGICALDRIVE 1
# Установка режима кэширования
# Для логических устройств есть режимы
#• RON - read cache on
#• ROFF - read cache off
#• WT - write through disabled
#• WB - write back enabled
#• WBB - write back enabled (when protected by battery or flash backup module)
# Для физических устройств
#• WT - write through disabled
#• WB - write back enabled
ARCCONF SETCACHE LOGICALDRIVE 1 RON
ARCCONF SETCACHE DEVICE 0 0 WB