mirror of
https://github.com/eLvErDe/hwraid.git
synced 2025-07-26 15:24:01 +02:00
[megaclisas-stat] Improve support for Nested RAID levels by display the span ID as well..
This commit is contained in:
parent
17b178cb51
commit
8ef38aa659
@ -29,6 +29,7 @@ totalunconfdrivenumber = 0
|
|||||||
|
|
||||||
# Hardcode a max of 16 HBA for now. LDTable must be initialized to accept populating list of LD's into each ctlr's list.
|
# Hardcode a max of 16 HBA for now. LDTable must be initialized to accept populating list of LD's into each ctlr's list.
|
||||||
LDTable = [ [] * 16 for i in range(16) ]
|
LDTable = [ [] * 16 for i in range(16) ]
|
||||||
|
NestedLDTable = [ [] * 16 for i in range(16) ]
|
||||||
# Outputs is a 'dict' of all MegaCLI outputs so we can re-use them during loops..
|
# Outputs is a 'dict' of all MegaCLI outputs so we can re-use them during loops..
|
||||||
Outputs = {}
|
Outputs = {}
|
||||||
|
|
||||||
@ -289,7 +290,7 @@ def returnArrayInfo(output,controllerid,arrayid):
|
|||||||
state = line.strip().split(':')[1].strip()
|
state = line.strip().split(':')[1].strip()
|
||||||
if re.match(r'^Strip Size.*?:.*$',line.strip()):
|
if re.match(r'^Strip Size.*?:.*$',line.strip()):
|
||||||
strpsz = line.strip().split(':')[1].strip()
|
strpsz = line.strip().split(':')[1].strip()
|
||||||
if re.match(r'^Number Of Drives.*:.*$',line.strip()):
|
if re.match(r'^Number Of Drives per span.*:.*$',line.strip()):
|
||||||
diskperspan = int(line.strip().split(':')[1].strip())
|
diskperspan = int(line.strip().split(':')[1].strip())
|
||||||
if re.match(r'^Current Cache Policy.*?:.*$',line.strip()):
|
if re.match(r'^Current Cache Policy.*?:.*$',line.strip()):
|
||||||
props = line.strip().split(':')[1].strip()
|
props = line.strip().split(':')[1].strip()
|
||||||
@ -321,10 +322,12 @@ def returnArrayInfo(output,controllerid,arrayid):
|
|||||||
# Compute the RAID level
|
# Compute the RAID level
|
||||||
if (int(spandepth) >= 2):
|
if (int(spandepth) >= 2):
|
||||||
raidtype = str('RAID-' + str(raidlvl) + '0')
|
raidtype = str('RAID-' + str(raidlvl) + '0')
|
||||||
|
NestedLDTable[controllerid][arrayid] = True
|
||||||
else:
|
else:
|
||||||
if(raidlvl == 1):
|
if(raidlvl == 1):
|
||||||
if(diskperspan > 2):
|
if(diskperspan > 2):
|
||||||
raidtype = str('RAID-10')
|
raidtype = str('RAID-10')
|
||||||
|
NestedLDTable[controllerid][arrayid] = True
|
||||||
else:
|
else:
|
||||||
raidtype = str('RAID-' + str(raidlvl))
|
raidtype = str('RAID-' + str(raidlvl))
|
||||||
else:
|
else:
|
||||||
@ -341,6 +344,7 @@ def returnDiskInfo(output,controllerid):
|
|||||||
diskid = False
|
diskid = False
|
||||||
oldenclid = False
|
oldenclid = False
|
||||||
enclid = False
|
enclid = False
|
||||||
|
spanid = False
|
||||||
slotid = False
|
slotid = False
|
||||||
lsidid = 'Unknown'
|
lsidid = 'Unknown'
|
||||||
table = []
|
table = []
|
||||||
@ -350,6 +354,9 @@ def returnDiskInfo(output,controllerid):
|
|||||||
dsize = 'Unknown'
|
dsize = 'Unknown'
|
||||||
temp = 'Unk0C'
|
temp = 'Unk0C'
|
||||||
for line in output:
|
for line in output:
|
||||||
|
if re.match(r'^Span: [0-9]+ - Number of PDs:',line.strip()):
|
||||||
|
spanid = line.split(':')[1].strip()
|
||||||
|
spanid = re.sub(' - Number of PDs.*', '', spanid)
|
||||||
if re.match(r'Enclosure Device ID: .*$',line.strip()):
|
if re.match(r'Enclosure Device ID: .*$',line.strip()):
|
||||||
# We match here early in the analysis so reset the vars if this is a new disk we're reading..
|
# We match here early in the analysis so reset the vars if this is a new disk we're reading..
|
||||||
oldenclid = enclid
|
oldenclid = enclid
|
||||||
@ -399,8 +406,11 @@ def returnDiskInfo(output,controllerid):
|
|||||||
temp = line.split(':')[1].strip()
|
temp = line.split(':')[1].strip()
|
||||||
temp = re.sub(' \(.*\)', '', temp)
|
temp = re.sub(' \(.*\)', '', temp)
|
||||||
if model != 'Unknown':
|
if model != 'Unknown':
|
||||||
#### print str(arrayid)+' '+str(diskid)+' '+str(olddiskid)
|
dbgprint('Disk Info: '+str(arrayid)+' '+str(diskid)+' '+str(oldenclid))
|
||||||
table.append([str(arrayid), str(diskid), mtype, model, dsize, fstate , speed, temp, enclid, slotid, lsidid])
|
if ( NestedLDTable[controllerid][int(arrayid)] == True):
|
||||||
|
table.append([str(arrayid)+"s"+spanid, str(diskid), mtype, model, dsize, fstate , speed, temp, enclid, slotid, lsidid])
|
||||||
|
else:
|
||||||
|
table.append([str(arrayid), str(diskid), mtype, model, dsize, fstate , speed, temp, enclid, slotid, lsidid])
|
||||||
return table
|
return table
|
||||||
|
|
||||||
|
|
||||||
@ -548,6 +558,7 @@ if printarray:
|
|||||||
ldid += 1
|
ldid += 1
|
||||||
if re.match(r'^Virtual Drive:',line.strip()):
|
if re.match(r'^Virtual Drive:',line.strip()):
|
||||||
LDTable[controllerid].append ( ldid )
|
LDTable[controllerid].append ( ldid )
|
||||||
|
NestedLDTable[controllerid].append ( False )
|
||||||
ldcount += 1
|
ldcount += 1
|
||||||
ldid += 1
|
ldid += 1
|
||||||
|
|
||||||
@ -629,6 +640,7 @@ if totaldrivenumber:
|
|||||||
print '-- Disk information --'
|
print '-- Disk information --'
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
|
dlen = 0
|
||||||
mlen = 0
|
mlen = 0
|
||||||
flen = 0
|
flen = 0
|
||||||
controllerid = 0
|
controllerid = 0
|
||||||
@ -644,12 +656,14 @@ if totaldrivenumber:
|
|||||||
arraydisk = returnDiskInfo(output,controllerid)
|
arraydisk = returnDiskInfo(output,controllerid)
|
||||||
for array in arraydisk:
|
for array in arraydisk:
|
||||||
dbgprint('Disk c'+str(controllerid)+'u'+array[0]+'p'+array[1] + ' status : ' + array[5])
|
dbgprint('Disk c'+str(controllerid)+'u'+array[0]+'p'+array[1] + ' status : ' + array[5])
|
||||||
if array[5] not in [ 'Online', 'Online, Spun Up' ]:
|
if not array[5] == 'Online' and not array[5] == 'Online, Spun Up':
|
||||||
bad = True
|
bad = True
|
||||||
nagiosbaddisk=nagiosbaddisk+1
|
nagiosbaddisk=nagiosbaddisk+1
|
||||||
else:
|
else:
|
||||||
nagiosgooddisk=nagiosgooddisk+1
|
nagiosgooddisk=nagiosgooddisk+1
|
||||||
|
|
||||||
|
if ( returnWdthFromArrayCol(arraydisk,0) > dlen):
|
||||||
|
dlen = returnWdthFromArrayCol(arraydisk,0)
|
||||||
if ( returnWdthFromArrayCol(arraydisk,3) > mlen):
|
if ( returnWdthFromArrayCol(arraydisk,3) > mlen):
|
||||||
mlen = returnWdthFromArrayCol(arraydisk,3)
|
mlen = returnWdthFromArrayCol(arraydisk,3)
|
||||||
if ( returnWdthFromArrayCol(arraydisk,5) > flen):
|
if ( returnWdthFromArrayCol(arraydisk,5) > flen):
|
||||||
@ -671,7 +685,7 @@ if totaldrivenumber:
|
|||||||
arraydisk = returnDiskInfo(output,controllerid)
|
arraydisk = returnDiskInfo(output,controllerid)
|
||||||
|
|
||||||
# Adjust print format with width computed above
|
# Adjust print format with width computed above
|
||||||
drvfmt = "%-7s | %-4s | %-"+str(mlen)+"s | %-8s | %-"+str(flen)+"s | %-8s | %-4s | %-8s | %-8s"
|
drvfmt = "%-"+str(dlen+5)+"s | %-4s | %-"+str(mlen)+"s | %-8s | %-"+str(flen)+"s | %-8s | %-4s | %-8s | %-8s"
|
||||||
for array in arraydisk:
|
for array in arraydisk:
|
||||||
# Header
|
# Header
|
||||||
if ( i == 0 ):
|
if ( i == 0 ):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user