Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2345906
  • 博文数量: 276
  • 博客积分: 5998
  • 博客等级: 大校
  • 技术积分: 5175
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-24 14:43
文章分类

全部博文(276)

文章存档

2014年(25)

2013年(11)

2012年(69)

2011年(167)

2010年(4)

分类: Python/Ruby

2012-04-24 18:11:21

  1. raid卡类型                       监控工具

    megaraid                         megarc.bin

    megaraidsas                    MegaCli

    lsi mpt                             mpt-status

    smartarray                      hpacucli

    3ware                              tw_cli

点击(此处)折叠或打

  1. #! /usr/bin/env bash
  2. #version=1.1
  3. #1.1 add MediaError
  4. #1.2 add mpt msg
  5. unknow=3
  6. ok=0
  7. warning=1
  8. critical=2
  9. exitstatus=$unknow
  10. host=""
  11. msg=""
  12. raid_type=""
  13. megacli="/opt/MegaRAID/MegaCli/MegaCli"
  14. mpt="/usr/alisys/dragoon/libexec/raidtool/mpt-status"
  15. hpacucli="/usr/sbin/hpacucli"
  16. megarc="/usr/alisys/dragoon/libexec/raidtool/megarc.bin"
  17. smartctl="/usr/sbin/smartctl"
  18. os_type_fun(){
  19.         os_type=`uname -s`
  20. }
  21. smart_fun(){
  22.         disk=`ls /dev/rdsk/`
  23. }
  24. is_vm(){
  25.         if test -f /proc/xen/capabilities;then
  26.                 grep -iq control_d /proc/xen/capabilities
  27.                 if test $? -eq 0;then
  28.                         exitstatus=0
  29.                         return
  30.                 else
  31.                         echo "this host is xen host"
  32.                         exit 0
  33.                 fi
  34.         else
  35.                 exitstatus=0
  36.         fi
  37. # /usr/sbin/dmidecode 2>/dev/null|grep -qi Vendor
  38. # if [ $? -eq 1 ];then
  39. # echo " this host is xen host"
  40. # exit 0

  41.                 fi
  42.         else
  43.                 exitstatus=0
  44.         fi
  45. # /usr/sbin/dmidecode 2>/dev/null|grep -qi Vendor
  46. # if [ $? -eq 1 ];then
  47. # echo " this host is xen host"
  48. # exit 0
  49. # else
  50. # exitstatus=0
  51. # fi
  52. }
  53. read_write(){
  54.         exitstatus=$unknow
  55.         rm -rf test.txt
  56.         touch test.txt > /dev/null
  57.         if [ -r test.txt -a -w test.txt ];then
  58.                 msg="$msg disk rw is ok"
  59.                 exitstatus=$ok
  60.         else
  61.                 msg="$msg disk rw is error!!"
  62.                 exit 2
  63.         fi
  64. }
  65. raid_type(){
  66.         lsmod=`/sbin/lsmod`
  67.         echo $lsmod|egrep -qw "mptsas|mptbase"
  68.         if test $? -eq 0;then
  69.                 raidtype="mptSAS"
  70.         fi
  71.         echo $lsmod|egrep -qw "megaraid_mbox|megaraid2"
  72.         if test $? -eq 0;then
  73.                 raidtype="megaRAIDSCSI"
  74.         fi
  75.         echo $lsmod|egrep -qw "megaraid_sas"
  76.         if test $? -eq 0;then
  77.                 raidtype="megaRAIDSAS"
  78.         fi
  79.         echo $lsmod|egrep -qw "megaraid_sas,mptsas"
  80.         if test $? -eq 0;then
  81.                 raidtype="mptSAS"
  82.                 if test -c /dev/mptctl;then
  83.                 aa="bb"
  84.                 else
  85.                 mknod /dev/mptctl c 10 220
  86.                 fi
  87.                         /sbin/modprobe mptctl
  88.         fi
  89.         lspci|grep -q "Hewlett-Packard"
  90.         if test $? -eq 0;then
  91.                 raidtype="hpraid"
  92.         fi
  93.         if [ -z $raidtype ];then
  94.                 raidtype="unknow"
  95.         # echo "this host raid is unknow raid"
  96.                 return

  97.         fi
  98. }
  99. checkmegasas(){
  100.         exitstatus=$unknow
  101.         if test "$os_type" = "Linux";then
  102.         rpm -aq|grep -q MegaCli-8.00.29-1
  103.         if [ $? -eq 0 ];then
  104.                 if [ -e /opt/MegaRAID/MegaCli/MegaCli64 ];then
  105.                         mv /opt/MegaRAID/MegaCli/{MegaCli64,MegaCli}
  106.                 fi
  107.         else
  108.                                rpm -Uhv http://10.23.230.161/zds/Lib_Utils-1.00-08.noarch.rpm
  109.                rpm -Uhv http://10.23.230.161/zds/MegaCli-8.00.29-1.i386.rpm
  110.                exit 3
  111.         fi
  112.         if test "$os_type" = "SunOS";then
  113.                 megacli = '/usr/alisys/dragoon/libexec/raidtool/MegaCli_sol'
  114.         fi
  115.                 ctrlCount=`$megacli -adpCount|grep -i "Controller Count"|sed 's/.*:.*\([0-9]\)\./\1/'`
  116.                 if test $ctrlCount -eq 0;then
  117.                          diskname=`awk '{print $NF}' /proc/partitions |grep sd|grep -v ssd|grep -v "[0-9]\+"`
  118.                         for t in $diskname
  119.                         do
  120.                                 $smartctl -H /dev/$t|egrep -iq "not an ATA/ATAPI device|Input/output error"
  121.                                 if test $? -ne 0;then
  122.                                         $smartctl -H /dev/$t|egrep -iq "ok|PASSED"
  123.                                         if test $? -ne 0;then
  124.                                          exitstatus=$critical
  125.                                         msg="$msg smartctl check disk $t is fail!"
  126.                                         return
  127.                                 else
  128.                                         exitstatus=$ok
  129.                                         msg="$msg Smartctl: Device Read Identity Failed"
  130.                                         return
  131.                                 fi
  132.                                 else
  133.                                         exitstatus=$ok
  134.                                         msg="$msg Smartctl: Device Read Identity Failed"
  135.                                         return
  136.                                 fi
  137.                         done
  138.                 fi
  139.                 i=0
  140.                 j=0
  141.                         $megacli -AdpAllInfo -aall|grep -i bbu|head -n 1|egrep -iq "Present|absent|not Present"
  142.                         if test $? -ne 0;then
  143.                                 badbbustatus=`$megacli -AdpAllInfo -a0|grep -i bbu|head -n 1|sed 's/.*:\(.*\)/\1/'`
  144.                                         exitstatus=$critical
  145.                                         msg="$msg raid bbu status is $badbbustatus!"
  146.                                         return
  147.                         fi
  148. # bbustatus=`$megacli -AdpAllInfo -aall|grep -i bbu|head -n 1|sed 's/.*: \(.*\)/\1/' `
  149. # if test $bbustatus = "Present";then
  150. # capacity=`$megacli -AdpBbuCmd -getbbucapacityinfo -aall|grep "Remaining Capacity:"|sed -e 's/.* \([0-9]*\) .*/\1/g'`
  151. # if test $capacity -lt 50;then
  152. # exitstatus=$critical
  153. # msg="$msg DELL bbu Remaining Capacity is $capacity low!"
  154. # return
  155. # fi
  156. # fi

  157.                 while test $i -lt $ctrlCount
  158.                 do
  159.                         #i=$(($i+1))
  160.                         NUM_DEGRADED=`$megacli -AdpAllInfo -a$i |grep "Degrade"|cut -d: -f2|tr -d ' '`
  161.                         NUM_FAILED=`$megacli -AdpAllInfo -a$i |grep "Failed Disks"|cut -d: -f2|tr -d ' '`
  162.                         NUM_Critical=`$megacli -AdpAllInfo -a$i |grep "Critical Disks"|cut -d: -f2|tr -d ' '`
  163.                         NUM_Offline=`$megacli -AdpAllInfo -a0 |grep "Offline.*:.*[0-9]"|cut -d: -f2|tr -d " "`
  164.                         MediaError=`$megacli PdList -a$i|grep -i "Media Error Count"|awk '{ print $4 }'`
  165.                         for u in $MediaError
  166.                         do
  167.                                 if test $u -ge 100;then
  168.                                         MediaErrorcount=$u
  169.                                         MediaErrornumber=`$megacli -PdList -a$i|grep -i "Media Error Count"|grep -n "$u"|awk -F: '{ print $1 }'`
  170.                                         msg="$msg MediaError disk number is $MediaErrornumber ,Media Error Count is $u ,"
  171.                                         break
  172.                                 fi
  173.                         done
  174.                         #error=`$megacli -AdpAllInfo -a0| grep -i "Device Present" -A 12|egrep -i "Degraded|Offline|Critical Disks|Failed disks"|awk -F: '{ print $2 }'`
  175.                         #for r in $error
  176.                         #do
  177.                         # if test $r -ne 0;then
  178.                         # msg=`$megacli -AdpAllInfo -a0| grep -i "Device Present" -A 12`
  179.                         # exitstatus=$critical
  180.                         # return
  181.                         # fi
  182.                         #done
  183.                         if [[ "$NUM_DEGRADED" -ne 0 || "$NUM_FAILED" -ne 0 || "$NUM_Critical" -ne 0 || "$NUM_Offline" -ne 0 || "$MediaErrorcount" -ge 100 ]]; then
  184.                                 msg="$msg ctrl $ctrlCount:$NUM_DEGRADED VD degraded,$NUM_Offline VD offilne, $NUM_FAILED PD failed ,$NUM_Critical PD Critical"
  185.                                 exitstatus=$critical
  186.                                 return
  187.                         fi
  188.                         LD_NUM=`$megacli -LdGetNum -a$i|grep -i 'Number of Virtual'|cut -d: -f2|tr -d " "`
  189.                         #for((j=0;j<$LD_NUM;j++))
  190.                         #j=0
  191.                         while test $j -lt $LD_NUM
  192.                         do
  193.                                 #$j=$(($j+1))
  194.                                 readlevel=`$megacli -LdInfo -L$j -a$i|grep -i "RAID Level" |grep -o "Primary-[0-9]"|cut -d- -f2`
  195.                                 ldstatus=`$megacli -LdInfo -L$j -a$i|grep -i "State"|cut -d: -f 2|tr -d ' '`
  196.                                 disknumber=`$megacli -pdlist -a$i|grep -i "Slot Number"|wc -l`
  197.                                 if [ $ldstatus != "Optimal" ];then
  198.                                         msg="$msg megacli -LdInfo is critical!"
  199.                                         exitstatus=$critical
  200.                                         return
  201.                                 fi
  202.                                 onlinenu=`$megacli -PdList -a$i|grep -i "Firmware state:"|egrep -i "online|Hotspare|good"|wc -l`
  203.                                 if [ $disknumber -ne $onlinenu ];then
  204.                                         errordisknumber=`$megacli -pdlist -a$i|grep "Firmware state"|grep -nvi "online"|awk -F: '{print $1}'`
  205.                                         msg="$msg this host total have $disknumber disks,raidlevel $readlevel,failed disk number is $errordisknumber"
  206.                                         exitstatus=$critical
  207.                                 else
  208.                                         exitstatus=$ok
  209.                                 # msg="$msg this host raidlevel is $readlevel,total disk $disknumber,online disk is $onlinenu"
  210.                                 fi
  211.                                 j=`expr $j + 1`

  212.                         done
  213.                         i=`expr $i + 1`
  214.                 done
  215.                 msg="$msg this host raidlevel is $readlevel,total disk $disknumber,online disk is $onlinenu"

  216.         #else
  217.         # rpm -Uhv http://10.23.230.161/zds/Lib_Utils-1.00-08.noarch.rpm
  218.         # rpm -Uhv http://10.23.230.161/zds/MegaCli-8.00.29-1.i386.rpm
  219.         fi
  220. }
  221. check_log(){
  222.         now_date=`date +"%b %d" |sed -e 's/\([^0]\+\)0\(.*\)/\1 \2/'`
  223.         yester_date=`date --date "1 days ago" +"%b %d" |sed -e 's/\([^0]\+\)0\(.*\)/\1 \2/'`
  224.         logsize=`du -m /var/log/messages |awk '{print $1}'`
  225.         if test $logsize -ge 100;then
  226.                 exitstatus=$ok
  227.                 msg="$msg /var/log/message too big!!"
  228.                 return
  229.         else
  230.                 errorlog=`egrep -i "$now_date|$yester_date" /var/log/messages|egrep -i "offline|medium|I/O error.*"`
  231.                 if test -n $errorlog;then
  232.                         exitstatus=$ok
  233.                 else
  234.                         errorcount=`egrep -i "$now_date|$yester_date" /var/log/messages|egrep -i "offline|medium|I/O error.*"|wc -l`
  235.                         if test $errorcount -ge 10;then
  236.                         exitstatus=$critical
  237.                         msg="$msg $errorlog"
  238.                         return
  239.                         else
  240.                                 exitstatus=$ok
  241.                         fi
  242.                 fi
  243.         fi

  244. }
  245. check_sunlog(){
  246.         now_date=`date +"%b %d" |sed -e 's/\([^0]\+\)0\(.*\)/\1 \2/'`
  247.         logsizesun=`du -k /var/adm/messages|awk '{print $1}'`
  248.         if test $logsizesun -ge 434400;then
  249.                 exitstatus=$ok
  250.                 msg="$msg /var/adm/messages too big !!"
  251.                 return
  252.         else
  253.                         errorcountsun=`egrep -i "$now_date" /var/adm/messages|egrep -i "offline|medium|I/O error."|wc -l`
  254.                         if test $errorcountsun -ge 10;then
  255.                         exitstatus=$critical
  256.                         msg="$msg $errorlog2"
  257.                         return
  258.                         else
  259.                                  exitstatus=$ok
  260.                                 msg="$msg all disk is ok!"
  261.                         return
  262.                         fi
  263.         fi
  264. }
  265. hpraidcheck(){
  266.         exitstatus=$unknow
  267.     rpm -aq|grep -qi hpacucli-8
  268.     if test $? -eq 0 ;then
  269.         Slotnu=`$hpacucli ctrl all show status|grep -i "Smart Array"|cut -d" " -f6`
  270.         ctrlstatus=`$hpacucli ctrl all show status|grep -i "Controller Status"|cut -d: -f2|tr -d ' '`
  271.         if test "$ctrlstatus" != "OK";then
  272.             exitstatus=$critical
  273.             msg="$msg Controller Status:$ctrlstatus"
  274.             return
  275.         fi
  276.         for l in $Slotnu
  277.         do
  278.             raidlevel=`$hpacucli ctrl slot=$l show config|grep -i logicaldrive|sed -e "s/^ * //g" -e "s/,//g"|cut -d" " -f6`
  279.             totaldisknu=`$hpacucli ctrl slot=$l show config|grep -c physicaldrive`
  280.             onlinedisknu=`$hpacucli ctrl slot=$l show config|grep physicaldrive|grep -ic ok`
  281.             if test $totaldisknu -eq $onlinedisknu;then
  282.                 msg="$msg this host raidlevel is $raidlevel,total disk is $totaldisknu,all disk is ok"
  283.                 exitstatus=$ok
  284.             else
  285.                 errordisk=`expr $totaldisknu - $onlinedisknu`
  286.                 errordiskhpnumber=`$hpacucli ctrl slot=$l show config|grep -i "physicaldrive"|grep -inv "ok"|awk -F: '{ print $1 }'`
  287.                 #msg="$msg this host raidlevel is $raidlevel,total disk is $totaldisknu,fail disk is $errordisk,number $errordiskhpnumber is fail!"
  288.                 msg="$msg this host total have $totaldisknu disks,raidlevel $raidlevel,failed disk number is $errordiskhpnumber"
  289.                 exitstatus=$critical
  290.                 return
  291.             fi

  292.                 hpacucli ctrl slot=${l} show status|grep -i "Battery"
  293.                 if test $? -eq 0;then
  294.                         #ba_log=`hpacucli ctrl slot=${i} show status|grep Battery|awk '$NF!~/OK/||$NF!~/Recharging/ {printf ("Battery Status is %s", $3) }'`
  295.                         $hpacucli ctrl slot=${l} show status|grep -i Battery|egrep -iq "OK|Recharging"
  296.                         if test $? -ne 0 ;then
  297.                                 exitstatus=$critical
  298.                                 bbuhpstatus=`$hpacucli ctrl slot=${l} show status|grep -i Battery|sed 's/.*:\(.*\)/\1/'`
  299.                                 msg="$msg HP Raidcard bbu $bbuhpstatus"
  300.                                 return
  301.                         fi

  302.                 fi
  303.         done
  304.     else
  305.         rpm -Uhv http://10.23.230.161/zds/hpacucli-8.50-6.0.noarch.rpm
  306.     fi

  307. }
  308. check_megaRAIDSCSI(){
  309.         exitstatus=$unknow
  310.         failedscsi=0
  311.         non_optimal_arrays=0
  312.         number_arrays=0
  313.         $megarc -AllAdpInfo |grep -q "No Adapters Found"
  314.         if test $? -eq 0;then
  315.                 dmidecode |grep -iq 1850
  316.                 if test $? -eq 0;then
  317.                 echo "$msg this host is dell1850"
  318.                 exit 0
  319.                 else
  320.                         diskname=`awk '{print $NF}' /proc/partitions |grep sd|grep -v ssd|grep -v "[0-9]\+"`
  321.                         for q in $diskname
  322.                         do
  323.                                 $smartctl -H /dev/$q|egrep -iq "not an ATA/ATAPI device|Input/output error"
  324.                                 if test $? -ne 0;then
  325.                                         $smartctl -H /dev/$q|egrep -iq "ok|PASSED"
  326.                                         if test $? -ne 0;then
  327.                                                 exitstatus=$critical
  328.                                                 msg="$msg smartctl check disk $q is fail!"
  329.                                                 return
  330.                                         else
  331.                                                 exitstatus=$ok
  332.                                                 msg="$msg Smartctl: Device Read Identity Failed"
  333.                                         fi
  334.                                 else
  335.                                 exitstatus=$ok
  336.                                         msg="$msg Smartctl: Device Read Identity Failed"
  337.                                 fi
  338.                         done
  339.                 fi

  340.         else
  341.                 $megarc -dispcfg -a0 |grep -i "Logical Drive.*status"|grep -qi "OPTIMAL"
  342.                 if test $? -ne 0;then
  343.                         contstatus=`$megarc -dispcfg -a0 |grep -i "Logical Drive.*status"|sed 's/.*Status: \(.*\)/\1/'`
  344.                         echo "this host raid control is $contstatus"
  345.                         exit 2
  346.                 else
  347.                         raidscsilevel=`$megarc -dispcfg -a0 |grep -oi "raidlevel: [0-9]*"`
  348.                         scsidisknu=`$megarc -dispcfg -a0 |grep -c "0x00000000"`
  349.                         scsionlinenu=`$megarc -dispcfg -a0 |grep -c "ONLINE"`
  350.                         if test $scsidisknu -eq $scsionlinenu;then
  351.                                 msg="$msg this host $raidscsilevel,total disk is $scsidisknu.all disk is ok!"
  352.                                 exitstatus=$ok
  353.                                 return
  354.                         else
  355.                                 failscsidisk=`expr $scsidisknu - $scsionlinenu`
  356.                                 failscsidisknumber=`$megarc -dispcfg -a0 |grep "0x00000"|grep -inv "ONLINE"|awk -F: '{ print $1 }'`
  357.                                 #msg="$msg this host $raidscsilevel,total disk is $scsidisknu ,fail disk is $failscsidisk,number $failscsidisknumber is fail!!"
  358.                                 msg="$msg this host total have $scsidisknu disks,raillevel $raidscsilevel,failed $failscsidisk,failed disk number is $failscsidisknumber!"
  359.                                 exitstatus=$critical
  360.                         fi
  361.                 fi
  362.         fi
  363. }
  364. check_mptSAS(){
  365.         if test -e /dev/mptctl;then
  366.         $mpt -p|grep -qi "No such device"
  367.         if test $? -eq 0;then
  368.                 checkmegasas
  369.             return
  370.         else
  371.                  $mpt -p|grep -qi "Nothing found"
  372.                 if test $? -ne 0;then
  373.             mptnumber=`$mpt -p|grep -o "\-i [0-9]*"`
  374.             disknumber=`$mpt $mptnumber|grep -co "phy [0-9]*"`
  375.             okdiskun=`$mpt $mptnumber|grep -i "phy [0-9]*"|grep -ci "online"`
  376.             if test $disknumber -ne $okdiskun;then
  377.                 exitstatus=$critical
  378.                 mpterror=`expr $disknumber - $okdiskun`
  379.                 errormptum=`$mpt $mptnumber|grep -i "phy [0-9]*"|grep -vin "online"|awk -F: '{ print $1 }'`
  380.                 #msg="$msg total disk is $disknumber,fail $mpterror,fail disk number is $errormptum "
  381.                 msg="$msg this host total have $disknumber disks,failed $mpterror,fail disk number is $errormptum!"
  382.                 return
  383.             else
  384.                 $mpt $mptnumber|grep vol|grep -iq "OPTIMAL"
  385.                 if test $? -ne 0;then
  386.                     exitstatus=$critical
  387.                         msg=`$mpt $mptnumber`
  388.                     msg="this host volume status is critical! $msg"
  389.                     return
  390.                 else
  391.                     exitstatus=$ok
  392.                     msg="$msg this host total disk is $disknumber,all disk is ok"
  393.                 fi
  394.             fi
  395.                 else
  396.                         diskname=`awk '{print $NF}' /proc/partitions |grep sd|grep -v ssd|grep -v "[0-9]\+"`
  397.                         for m in $diskname
  398.                         do
  399.                                 $smartctl -H /dev/$m|egrep -iq "not an ATA/ATAPI device"
  400.                                 if test $? -ne 0;then

  401.                                 $smartctl -H /dev/$m|egrep -iq "ok|PASSED"
  402.                                 if test $? -ne 0;then
  403.                                         exitstatus=$critical
  404.                                         msg="$msg smartctl check disk $m is fail!"
  405.                                         return
  406.                                 else
  407.                                         exitstatus=$ok
  408.                                 # msg="$msg this host no raid,smartctl check all disk is ok"
  409.                                 fi
  410.                                 else
  411.                                         exitstatus=$ok
  412.                                         msg="Smartctl: Device Read Identity Failed"
  413.                                 fi
  414.                         done
  415.                         if test $exitstatus -eq 0;then
  416.                                  msg=" this host no raid,smartctl check all disk is ok"
  417.                         fi
  418.                 fi
  419.         fi
  420.         else
  421.                 /sbin/modprobe mptctl
  422.         fi
  423. }
  424. smarctl_check(){
  425.         disknamesmart=`awk '{print $NF}' /proc/partitions |grep sd|grep -v ssd|grep -v "[0-9]\+"`
  426.         for n in $disknamesmart
  427.         do
  428.                 $smartctl -H /dev/$n|egrep -iq "not an ATA/ATAPI device"
  429.                 if test $? -ne 0;then
  430.                 $smartctl -H /dev/$n|egrep -iq "ok|PASSED"
  431.                 if test $? -ne 0;then
  432.                         exitstatus=$critical
  433.                          msg="$msg smartctl check disk $n is fail!"
  434.                         return
  435.                 else
  436.                         exitstatus=$ok
  437.                         msg="this host no raid,smartctl check all disk is ok"
  438.                 fi
  439.                 else
  440.                         msg="Smartctl: Device Read Identity Failed "
  441.                         exitstatus=$ok
  442.                 fi
  443.         done
  444. }
  445. main_fun(){
  446.         os_type_fun
  447.         if test "$os_type" = "SunOS";then
  448.                 check_sunlog
  449.                 #checkmegasas()
  450.                 if test $exitstatus -eq 2;then
  451.                         echo "$msg"
  452.                         exit $exitstatus
  453.                 else
  454.                         echo "$msg "
  455.                         exit $exitstatus
  456.                 fi
  457.         elif test "$os_type" = "Linux";then
  458.                 #is_vm
  459.                 #check_log
  460.         # if test $exitstatus -eq 0;then
  461.                 uname -a|grep -iq "2.4"
  462.                 if test $? -eq 0;then
  463.                         megacli="/usr/alisys/dragoon/libexec/raidtool/MegaCli"
  464.                 fi
  465.                 dmidecode |grep -iq "Tecal BH28"
  466.                 if test $? -eq 0;then
  467.                         if test -c /dev/mptctl;then
  468.                                 aa="bb"
  469.                         else
  470.                          mknod /dev/mptctl c 10 220
  471.                         fi
  472.                         /sbin/modprobe mptctl
  473.                                                 check_log
  474.                                 if test $exitstatus -eq 2;then
  475.                                         echo $msg
  476.                                         exit $exitstatus
  477.                                 fi
  478.                         echo "mptSAS"
  479.                         check_mptSAS
  480.                         echo $msg
  481.                         exit $exitstatus
  482.                 fi
  483.                 is_vm
  484.                 if test $exitstatus -eq 0 ;then
  485.                         raid_type
  486.                         echo $raidtype
  487.                         if test "$raidtype" = "megaRAIDSAS";then
  488.                                 check_log
  489.                                 if test $exitstatus -eq 2;then
  490.                                         echo $msg
  491.                                         exit $exitstatus
  492.                                 fi
  493.                                 checkmegasas
  494.                                 echo $msg
  495.                                 exit $exitstatus
  496.                         elif test "$raidtype" = "hpraid";then
  497.                                 check_log
  498.                                 if test $exitstatus -eq 2;then
  499.                                         echo $msg
  500.                                         exit $exitstatus
  501.                                 fi
  502.                                 hpraidcheck
  503.                                 echo $msg
  504.                                 exit $exitstatus
  505.                         elif test $raidtype = "megaRAIDSCSI";then
  506.                                 check_log
  507.                                 if test $exitstatus -eq 2;then
  508.                                         echo $msg
  509.                                         exit $exitstatus
  510.                                 fi
  511.                                 check_megaRAIDSCSI
  512.                                 echo $msg
  513.                                 exit $exitstatus
  514.                         elif test $raidtype = "mptSAS";then
  515.                                 check_log
  516.                                 if test $exitstatus -eq 2;then
  517.                                         echo $msg
  518.                                         exit $exitstatus
  519.                                 fi
  520.                                 check_mptSAS
  521.                                 echo $msg
  522.                                 exit $exitstatus
  523.                         elif test $raidtype = "unknow";then
  524.                                 check_log
  525.                                 if test $exitstatus -eq 2;then
  526.                                         echo $msg
  527.                                         exit $exitstatus
  528.                                 fi
  529.                                 smarctl_check
  530.                                 echo $msg
  531.                                 exit $exitstatus

  532.                         fi
  533.                 fi
  534.                 else
  535.                         echo $msg
  536.                         exit $exitstatus
  537.                 fi

  538. }
  539. main_fun

阅读(5138) | 评论(0) | 转发(4) |
给主人留下些什么吧!~~