Related shell scripts for megacli

Source: Internet
Author: User

Tag: megacli shell awk raid

1. cat megacli.sh #!/bin/bash#--------------------------------------------------   #Created : 2015-05-22#author:jimmygong#mail:[email protected] #Function: #Version: 1.0#------------------------------- -------------------function megacliaction  () {    megacmd= "/usr/local/sbin/ MegaCli64 "    if [[ -e  $megacmd  ]]    then         critical=$ (sudo  $megacmd  -adpallinfo -aall - nolog|awk  '/critical disks/ {print $4} ')           failed=$ (sudo  $megacmd  -AdpAllInfo -aALL -NoLog|awk  '/failed disks/ { print $4} ')         [[ -z  $critical  ]] | |  [[ -z  $failed  ]] && echo  "Storage capture failure"   && exit 0         [[  $critical  -ne 0 ]] | |  [[  $failed  -ne 0 ]] && echo  "Storage disk failure"  && exit 0         echo  "Storage  disk normal "    else        echo " Megacli64 problem "        exit 1    fi} MEGACLIACTIONEXIT 02, view raid information cat megacli2.sh#!/bin/bash#-------------------------------------------- ------   #Created: 2015-05-22#author:jimmygong#mail:[email protected] #Function: #Version: 1.0#----- ---------------------------------------------function diskstatus  () {echo -e  "============= ==raid information=============== "cmd="/usr/local/sbin/megacli64 "raid= ' $cmd  -cfgdsply -aall| grep  "Raid level" |tail -1|awk -f:  ' {print $1 '         : ' $ $ ' disknum= ' $ cmd -cfgdsply -aall|grep  "Number of drives" |awk -f:  ' {print $2} ' onlinedisk= ' $cmd  -cfgdsply -aALL|grep -c  Online ' faileddisk= ' $cmd  -adpallinfo - aall -nolog|awk  '/failed disks/ {print $4} ' criticaldisk= ' $cmd  -AdpAllInfo  -aall -nolog|awk  '/critical disks/ {print $4} ' case  ' $raid '  in ' RAID  Level        : primary-1, secondary-0, raid level  qualifier-0 ") echo " raid level:1 ";;" Raid level        : primary-0, secondary-0, raid  level qualifier-0 ") echo " raid level:0 ";;" Raid level        : primary-5, secondary-0, raid  level quAlifier-3 ") echo " Raid level:5 ";;" Raid level        : primary-6, secondary-0, raid  level qualifier-3 ") echo " Raid level:6 ";;" Raid level        : primary-1, secondary-3, raid  level qualifier-0 ") echo " raid level:10 ";; esacecho  "Total diak number: $disknum" echo  "Online disk number: $onlinedisk" Echo   "Failed disk number: $faileddisk" echo  "Critical disk number: $criticaldisk" Echo  -e  "===============current status=================" $cmd  -PDList -aALL|grep  " Firmware state "}diskstatusexit 0

This article is from the "7928217" blog, please be sure to keep this source http://7938217.blog.51cto.com/7928217/1653705

Related shell scripts for megacli

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.