mirror of
https://github.com/eLvErDe/hwraid.git
synced 2025-07-03 20:14:21 +02:00
Fixes.. (Rev 1.12)
This commit is contained in:
parent
4ec7f462d4
commit
b25b140994
@ -1,9 +1,10 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# $Id: megaclisas-status,v 1.11 2015/01/14 19:24:10 root Exp $
|
# $Id: megaclisas-status,v 1.12 2015/01/14 20:22:48 root Exp $
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
import pdb
|
||||||
|
|
||||||
if len(sys.argv) > 2:
|
if len(sys.argv) > 2:
|
||||||
print 'Usage: megaraid-status [-d]'
|
print 'Usage: megaraid-status [-d]'
|
||||||
@ -11,6 +12,8 @@ if len(sys.argv) > 2:
|
|||||||
|
|
||||||
printarray = True
|
printarray = True
|
||||||
printcontroller = True
|
printcontroller = True
|
||||||
|
totaldrivenumber = 0
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
if sys.argv[1] == '-d':
|
if sys.argv[1] == '-d':
|
||||||
printarray = False
|
printarray = False
|
||||||
@ -33,6 +36,21 @@ def returnControllerNumber(output):
|
|||||||
if re.match(r'^Controller Count.*$',line.strip()):
|
if re.match(r'^Controller Count.*$',line.strip()):
|
||||||
return int(line.split(':')[1].strip().strip('.'))
|
return int(line.split(':')[1].strip().strip('.'))
|
||||||
|
|
||||||
|
def returnTotalDriveNumber(output):
|
||||||
|
for line in output:
|
||||||
|
if re.match(r'Number of Physical Drives on Adapter.*$',line.strip()):
|
||||||
|
return int(line.split(':')[1].strip())
|
||||||
|
|
||||||
|
def returnUnconfDriveNumber(output):
|
||||||
|
configdrives = 0
|
||||||
|
unconfdrives = 0
|
||||||
|
for line in output:
|
||||||
|
if re.match(r'.*Number of PDs:.*$',line.strip()):
|
||||||
|
configdrives += int(line.split(':')[2].strip())
|
||||||
|
#### pdb.set_trace()
|
||||||
|
unconfdrives = totaldrivenumber - configdrives
|
||||||
|
return int(unconfdrives)
|
||||||
|
|
||||||
def returnControllerModel(output):
|
def returnControllerModel(output):
|
||||||
for line in output:
|
for line in output:
|
||||||
if re.match(r'^Product Name.*$',line.strip()):
|
if re.match(r'^Product Name.*$',line.strip()):
|
||||||
@ -230,11 +248,19 @@ if printarray:
|
|||||||
controllerid += 1
|
controllerid += 1
|
||||||
print ''
|
print ''
|
||||||
|
|
||||||
print '-- Disks information --'
|
|
||||||
print '-- ID\t| Model | Status | Speed | Temperature | Slot ID | LSI Device ID '
|
|
||||||
|
|
||||||
controllerid = 0
|
controllerid = 0
|
||||||
while controllerid < controllernumber:
|
while controllerid < controllernumber:
|
||||||
|
cmd = 'megacli -PDGetNum -a'+str(controllerid)+' -NoLog'
|
||||||
|
output = getOutput(cmd)
|
||||||
|
totaldrivenumber += returnTotalDriveNumber(output)
|
||||||
|
controllerid += 1
|
||||||
|
|
||||||
|
if totaldrivenumber:
|
||||||
|
print '-- Disks information --'
|
||||||
|
print '-- ID\t| Model | Status | Speed | Temperature | Slot ID | LSI Device ID '
|
||||||
|
|
||||||
|
controllerid = 0
|
||||||
|
while controllerid < controllernumber:
|
||||||
arrayid = 0
|
arrayid = 0
|
||||||
cmd = 'megacli -LDInfo -lall -a'+str(controllerid)+' -NoLog'
|
cmd = 'megacli -LDInfo -lall -a'+str(controllerid)+' -NoLog'
|
||||||
output = getOutput(cmd)
|
output = getOutput(cmd)
|
||||||
@ -247,14 +273,22 @@ while controllerid < controllernumber:
|
|||||||
for array in arraydisk:
|
for array in arraydisk:
|
||||||
print 'c'+str(controllerid)+'u'+array[0]+'p'+array[1]+'\t| '+array[3]+' | '+array[2]+' | '+array[4]+' | '+array[5]+' | ID: \'['+array[6]+':'+array[7]+']\' | '+array[8]
|
print 'c'+str(controllerid)+'u'+array[0]+'p'+array[1]+'\t| '+array[3]+' | '+array[2]+' | '+array[4]+' | '+array[5]+' | ID: \'['+array[6]+':'+array[7]+']\' | '+array[8]
|
||||||
controllerid += 1
|
controllerid += 1
|
||||||
|
print ''
|
||||||
|
|
||||||
|
totalunconfdrivenumber = 0
|
||||||
print ''
|
|
||||||
print '-- Unconfigured Disks information --'
|
|
||||||
print '-- ID\t| Model | Status | Speed | Temperature | Slot ID | LSI Device ID '
|
|
||||||
|
|
||||||
controllerid = 0
|
controllerid = 0
|
||||||
while controllerid < controllernumber:
|
while controllerid < controllernumber:
|
||||||
|
cmd = 'megacli -LdPdInfo -a'+str(controllerid)+' -NoLog'
|
||||||
|
output = getOutput(cmd)
|
||||||
|
totalunconfdrivenumber += returnUnconfDriveNumber(output)
|
||||||
|
controllerid += 1
|
||||||
|
|
||||||
|
if ( totalunconfdrivenumber > 0):
|
||||||
|
print '-- Unconfigured Disks information --'
|
||||||
|
print '-- ID\t| Model | Status | Speed | Temperature | Slot ID | LSI Device ID '
|
||||||
|
|
||||||
|
controllerid = 0
|
||||||
|
while controllerid < controllernumber:
|
||||||
arrayid = 0
|
arrayid = 0
|
||||||
cmd = 'megacli -LDInfo -lall -a'+str(controllerid)+' -NoLog'
|
cmd = 'megacli -LDInfo -lall -a'+str(controllerid)+' -NoLog'
|
||||||
output = getOutput(cmd)
|
output = getOutput(cmd)
|
||||||
@ -267,7 +301,7 @@ while controllerid < controllernumber:
|
|||||||
for array in arraydisk:
|
for array in arraydisk:
|
||||||
print 'c'+str(controllerid)+'\t| '+array[1]+' | '+array[0]+' | '+array[2]+' | '+array[3]+' | ID: \'['+array[4]+':'+array[5]+']\' | '+array[6]
|
print 'c'+str(controllerid)+'\t| '+array[1]+' | '+array[0]+' | '+array[2]+' | '+array[3]+' | ID: \'['+array[4]+':'+array[5]+']\' | '+array[6]
|
||||||
controllerid += 1
|
controllerid += 1
|
||||||
|
print ''
|
||||||
|
|
||||||
if bad:
|
if bad:
|
||||||
print '\nThere is at least one disk/array in a NOT OPTIMAL state.'
|
print '\nThere is at least one disk/array in a NOT OPTIMAL state.'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user