alibek Posted December 28, 2016 · Report post Есть старый сервер Dell PowerEdge 2950 с RHEL4. На сервере установлен RAID-контроллер LSI Logic SAS based MegaRAID 1078, к нему подключены 4 диска, объединенных в RAID5, которые смонтированы в LVM. Можно ли как-то просмотреть состояние RAID-котроллера и массивов? Я подозреваю, что на RAID-контроллере сдохла батарейка и выключился кеш записи. Вставить ник Quote Ответить с цитированием Share this post Link to post Share on other sites More sharing options...
roysbike Posted December 28, 2016 (edited) · Report post Можно . У меня стоит LSI Logic / Symbios Logic MegaRAID SAS 2208. Через megacli получаю данные . Скрипт вызывает zabbix Утилита mkdir MegaCLI $ cd MegaCLI/ $ wget http://www.lsi.com/downloads/Public/RAID%20Controllers/RAID%20Controllers%20Common%20Files/8.07.14_MegaCLI.zip unzip 8.07.14_MegaCLI.zip megacli -AdpAllInfo -aAll cd Linux/ rpm -ihv MegaCli-8.07.14-1.noarch.rpm Zabbix #cat /etc/zabbix/scripts/lsimegaraid.sh #!/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 ##### 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 cat /etc/zabbix/zabbix_agentd.d/userparameter_hwraid.conf UserParameter=lsimegaraid[*],sudo /etc/zabbix/scripts/lsimegaraid.sh "none" $1 $2 zbx_lsi_raid.xml Edited December 28, 2016 by roysbike Вставить ник Quote Ответить с цитированием Share this post Link to post Share on other sites More sharing options...
alibek Posted December 28, 2016 · Report post Ага, спасибо, помогло. Правда сайт www.lsi.com уже неживой, но я нашел зеркало. Вставить ник Quote Ответить с цитированием Share this post Link to post Share on other sites More sharing options...
snvoronkov Posted December 29, 2016 · Report post Правда сайт www.lsi.com уже неживой https://en.wikipedia.org/wiki/LSI_Corporation On May 6, 2014, LSI Corporation was acquired by Avago Technologies (now Broadcom) for $6.6 billion. Вставить ник Quote Ответить с цитированием Share this post Link to post Share on other sites More sharing options...