Jump to content

Recommended Posts

Posted

Есть старый сервер Dell PowerEdge 2950 с RHEL4.

На сервере установлен RAID-контроллер LSI Logic SAS based MegaRAID 1078, к нему подключены 4 диска, объединенных в RAID5, которые смонтированы в LVM.

Можно ли как-то просмотреть состояние RAID-котроллера и массивов? Я подозреваю, что на RAID-контроллере сдохла батарейка и выключился кеш записи.

Posted (edited)

Можно . У меня стоит 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 by roysbike

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...
На сайте используются файлы cookie и сервисы аналитики для корректной работы форума и улучшения качества обслуживания. Продолжая использовать сайт, вы соглашаетесь с использованием файлов cookie и с Политикой конфиденциальности.