MegaRAID Patrol read MegaRAID Patrol read periodically verifies all sectors(including system reserved area) of drives including hot spare connected to a controller. The goal is to protect data integrity by detecting drive failure before the failure can damage data. The corrective actions depend on the drive group configuration and the type of errors. Patrol read […]
Записи с меткой ‘LSI MegaRaid’
LSI MegaRaid настройка кеширования и системной производительности
Установка и базовое использование утилиты megacli ддля работы с LSI MegaRaid описана в статье https://kamaok.org.ua/?p=1896 В этой статье рассматриваются параметры кеширования чтения/записи, их настройка и влияния на производительность дисковой подсистемы ввода/вывода Состояние RAID в том числе и значения политики кеширования можно получить следующей командой (отобразить все логические устройства всех контроллеров)
1 |
# megacli -LDInfo -Lall –Aall |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
Adapter 0 -- Virtual Drive Information: Virtual Drive: 0 (Target Id: 0) Name : RAID Level : Primary-5, Secondary-0, RAID Level Qualifier-3 Size : 5.457 TB Sector Size : 512 Is VD emulated : Yes Parity Size : 2.728 TB State : Optimal Strip Size : 64 KB Number Of Drives : 3 Span Depth : 1 Default Cache Policy: WriteBack, ReadAhead, Cached, Write Cache OK if Bad BBU Current Cache Policy: WriteBack, ReadAhead, Cached, Write Cache OK if Bad BBU Default Access Policy: Read/Write Current Access Policy: Read/Write Disk Cache Policy : Disk's Default Encryption Type : None Bad Blocks Exist: No Is VD Cached: No |
What do […]
Мониторинг дисков LSI MegaRaid-контроллера средствами megacli
Установка Megacli на Debian
1 |
# nano /etc/apt/sources.list |
1 2 |
#Debian 9 deb http://hwraid.le-vert.net/debian stretch main |
1 2 |
#Debian 8 # deb http://hwraid.le-vert.net/debian jessie main |
1 2 |
#Debian 7 # deb http://hwraid.le-vert.net/debian wheezy main |
1 |
# wget -O - http://hwraid.le-vert.net/debian/hwraid.le-vert.net.gpg.key | apt-key add - |
Установка Megacli на Ubuntu16
1 |
# nano /etc/apt/sources.list |
1 2 |
# Ubuntu 16 deb http://hwraid.le-vert.net/ubuntu xenial main |
1 |
# wget -O - http://hwraid.le-vert.net/ubuntu/hwraid.le-vert.net.gpg.key | apt-key add - |
1 |
# apt-get update |
1 |
# apt-get install megacli |
1 |
# which megacli |
1 |
/usr/sbin/megacli |
1 |
# megacli -V |
1 2 |
MegaCLI SAS RAID Management Tool Ver 8.07.14 Dec 16, 2013 (c)Copyright 2013, LSI Corporation, All Rights Reserved. |
Проверка наличия загруженного модуля в ядре
1 |
# lsmod | grep -i mega |
1 |
megaraid_sas 139264 3 |
Проверка наличия установленной LSI MegaRAID карты на сервере
1 |
# lspci -nn | grep -i lsi |
1 |
02:00.0 RAID bus controller [0104]: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] [1000:0079] (rev 05) |
Получение модели контролера и версии прошивки
1 |
# megacli -AdpAllInfo -aAll | grep -E 'Product Name|Serial No|FW Package Build' |
1 2 3 |
Product Name : LSI MegaRAID SAS 9260-4i Serial No : SV23301736 FW Package Build: 12.15.0-0205 |
Важные параметры для мониторинга
1 |
# megacli -LdPdInfo -aALL | grep -E "(Id|State |Bad Blocks|Firmware state|Error Count|Predictive Failure Count)" |
[…]
Мониторинг LSI MegaRAID в Zabbix
1.Установка скрипта на Zabbix-агенте
1 |
# megacli -LDInfo -LAll -a0 –NoLog |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
Adapter 0 -- Virtual Drive Information: Virtual Drive: 0 (Target Id: 0) Name : RAID Level : Primary-1, Secondary-0, RAID Level Qualifier-0 Size : 2.728 TB Sector Size : 512 Is VD emulated : Yes Mirror Data : 2.728 TB State : Optimal Strip Size : 256 KB Number Of Drives : 2 Span Depth : 1 Default Cache Policy: WriteBack, ReadAhead, Direct, Write Cache OK if Bad BBU Current Cache Policy: WriteBack, ReadAhead, Direct, Write Cache OK if Bad BBU Default Access Policy: Read/Write Current Access Policy: Read/Write Disk Cache Policy : Disk's Default Encryption Type : None Bad Blocks Exist: No Is VD Cached: No Exit Code: 0x00 |
1 |
# megacli -PDlist -a0 -NoLog |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
Adapter #0 Enclosure Device ID: 252 Slot Number: 0 Drive's position: DiskGroup: 0, Span: 0, Arm: 0 Enclosure position: N/A Device Id: 3 WWN: 50014ee65b17627a Sequence Number: 2 Media Error Count: 0 Other Error Count: 0 Predictive Failure Count: 0 Last Predictive Failure Event Seq Number: 0 PD Type: SATA Raw Size: 2.728 TB [0x15d50a3b0 Sectors] Non Coerced Size: 2.728 TB [0x15d40a3b0 Sectors] Coerced Size: 2.728 TB [0x15d400000 Sectors] Sector Size: 0 Logical Sector Size: 0 Physical Sector Size: 0 Firmware state: Online, Spun Up Commissioned Spare : No Emergency Spare : No Device Firmware Level: 1K03 Shield Counter: 0 Successful diagnostics completion on : N/A SAS Address(0): 0x4433221103000000 Connected Port Number: 1(path0) Inquiry Data: WD-WMC1F0E62TV5WDC WD3000FYYZ-01UL1B2 01.01K03 FDE Capable: Not Capable FDE Enable: Disable Secured: Unsecured Locked: Unlocked Needs EKM Attention: No Foreign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Hard Disk Device Drive: Not Certified Drive Temperature :41C (105.80 F) PI Eligibility: No Drive is formatted for PI information: No PI: No PI Drive's NCQ setting : N/A Port-0 : Port status: Active Port's Linkspeed: 6.0Gb/s Drive has flagged a S.M.A.R.T alert : No Enclosure Device ID: 252 Slot Number: 1 Drive's position: DiskGroup: 0, Span: 0, Arm: 1 Enclosure position: N/A Device Id: 2 WWN: 5000c500521a8d55 Sequence Number: 2 Media Error Count: 0 Other Error Count: 0 Predictive Failure Count: 0 Last Predictive Failure Event Seq Number: 0 PD Type: SATA Raw Size: 2.728 TB [0x15d50a3b0 Sectors] Non Coerced Size: 2.728 TB [0x15d40a3b0 Sectors] Coerced Size: 2.728 TB [0x15d400000 Sectors] Sector Size: 0 Logical Sector Size: 0 Physical Sector Size: 0 Firmware state: Online, Spun Up Commissioned Spare : No Emergency Spare : No Device Firmware Level: CC4B Shield Counter: 0 Successful diagnostics completion on : N/A SAS Address(0): 0x4433221102000000 Connected Port Number: 0(path0) Inquiry Data: S1F0YM5XST3000DM001-9YN166 CC4B FDE Capable: Not Capable FDE Enable: Disable Secured: Unsecured Locked: Unlocked Needs EKM Attention: No Foreign State: None Device Speed: 6.0Gb/s Link Speed: 6.0Gb/s Media Type: Hard Disk Device Drive: Not Certified Drive Temperature :39C (102.20 F) PI Eligibility: No Drive is formatted for PI information: No PI: No PI Drive's NCQ setting : N/A Port-0 : Port status: Active Port's Linkspeed: 6.0Gb/s Drive has flagged a S.M.A.R.T alert : No |
Узнаем расположение бинарника megacli
1 |
# which megacli |
1 |
/usr/sbin/megacli |
Если путь к бинарнику отличается,то изменяем его в скрипте и в файле /etc/sudoers
1 |
# nano /etc/zabbix/scripts/lsimegaraid.sh |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
#!/bin/bash export LC_ALL="" export LANG="en_US.UTF-8" # MEGACLI="sudo /usr/sbin/megacli" # if [[ -n ${1} && -n ${2} && -z ${3} ]]; then ##### DISCOVERY ##### TYPE="${2}" if [[ ${TYPE} == "virtdiskovery" ]]; then DRIVES=`${MEGACLI} -LDInfo -LAll -a0 -NoLog | awk '/Virtual Drive:/ {printf("VirtualDrive%d\n", $3)}'` if [[ -n ${DRIVES} ]]; then JSON="{ \"data\":[" SEP="" for DRIVE in ${DRIVES}; do JSON=${JSON}"$SEP{\"{#VIRTNUM}\":\"${DRIVE}\"}" SEP=", " done JSON=${JSON}"]}" echo ${JSON} fi elif [[ ${TYPE} == "physdiskovery" ]]; then DRIVES=`${MEGACLI} -PDlist -a0 -NoLog | awk '/Slot Number:/ {printf("DriveSlot%d\n", $3)}'` if [[ -n ${DRIVES} ]]; then JSON="{ \"data\":[" SEP="" for DRIVE in ${DRIVES}; do JSON=${JSON}"$SEP{\"{#PHYSNUM}\":\"${DRIVE}\"}" SEP=", " done JSON=${JSON}"]}" echo ${JSON} fi fi exit 0 elif [[ -n ${1} && -n ${2} && -n ${3} ]]; then ##### PARAMETERS ##### ##### PARAMETERS ##### HOST="${1}" DRIVE="${2}" METRIC="${3}" FILECACHE="/tmp/zabbix.lsimegaraid.cache" TTLCACHE="55" TIMENOW=`date '+%s'` ##### CACHE ##### if [ -s "${FILECACHE}" ]; then TIMECACHE=`stat -c"%Y" "${FILECACHE}"` else TIMECACHE=0 fi if [ "$((${TIMENOW} - ${TIMECACHE}))" -gt "${TTLCACHE}" ]; then echo "" >> ${FILECACHE} # !!! DATACACHE=`${MEGACLI} -PDlist -a0 -NoLog | awk -F':' ' function ltrim(s) { sub(/^[ \t]+/, "", s); return s } function rtrim(s) { sub(/[ \t]+$/, "", s); return s } function trim(s) { return rtrim(ltrim(s)); } /Slot Number/ {slotcounter+=1; slot[slotcounter]=trim($2)} /Inquiry Data/ {inquiry[slotcounter]=trim($2)} /Firmware state/ {state[slotcounter]=trim($2)} /Drive Temperature/ {temperature[slotcounter]=trim($2)} /S.M.A.R.T/ {smart[slotcounter]=trim($2)} /Media Error Count/ {mediaerror[slotcounter]=trim($2)} /Other Error Count/ {othererror[slotcounter]=trim($2)} /Predictive Failure Count/ {failurecount[slotcounter]=trim($2)} END { for (i=1; i<=slotcounter; i+=1) { printf ( "DriveSlot%d inquiry:%s\n",slot[i], inquiry[i]); printf ( "DriveSlot%d state:%s\n", slot[i], state[i]); printf ( "DriveSlot%d temperature:%d\n", slot[i], temperature[i]); printf ( "DriveSlot%d smart:%s\n", slot[i], smart[i]); printf ( "DriveSlot%d mediaerror:%d\n", slot[i], mediaerror[i]); printf ( "DriveSlot%d othererror:%d\n", slot[i], othererror[i]); printf ( "DriveSlot%d failurecount:%d\n", slot[i], failurecount[i]); } }'; ${MEGACLI} -LDInfo -LAll -a0 -NoLog | awk -F':' ' function ltrim(s) { sub(/^[ \t]+/, "", s); return s } function rtrim(s) { sub(/[ \t]+$/, "", s); return s } function trim(s) { return rtrim(ltrim(s)); } /Virtual Drive:/ {drivecounter+=1; slot[drivecounter]=trim($2);} /State/ {state[drivecounter]=trim($2)} /Bad Blocks/ {badblock[drivecounter]=trim($2)} END { for (i=1; i<=drivecounter; i+=1) { printf ( "VirtualDrive%d state:%s\n", slot[i], state[i]); printf ( "VirtualDrive%d badblock:%s\n", slot[i], badblock[i]); } }'` || exit 1 echo "${DATACACHE}" > ${FILECACHE} # !!! fi # cat "${FILECACHE}" | grep -i ${DRIVE} | awk -F':' "/${METRIC}/ {print \$2}" | head -n1 exit 0 # else exit 0 fi |
Установка прав
1 |
# chown root:zabbix /etc/zabbix/scripts/lsimegaraid.sh |
1 |
# chmod 550 /etc/zabbix/scripts/lsimegaraid.sh |
2.Настройка прав пользователю zabbix в sudo
1 |
# visudo |
1 2 3 |
# zabbix ALL=(ALL) NOPASSWD: /usr/sbin/megacli -LDInfo -LAll -a0 -NoLog # zabbix ALL=(ALL) NOPASSWD: /usr/sbin/megacli -PDlist -a0 –NoLog zabbix ALL=(ALL) NOPASSWD: /usr/sbin/megacli |
Проверка работы скрипта для пользователя Zabbix
1 |
# sudo -u zabbix /etc/zabbix/scripts/lsimegaraid.sh none virtdiskovery |
1 |
# sudo -u zabbix /etc/zabbix/scripts/lsimegaraid.sh none physdiskovery |
1 |
# sudo -u zabbix /etc/zabbix/scripts/lsimegaraid.sh none VirtualDrive0 state |
3.Настройка Zabbix-агента
1 |
# nano /etc/zabbix/zabbix_agentd.d/userparameter_lsimegaraid.conf |
[…]