mirror of
https://github.com/eLvErDe/hwraid.git
synced 2025-07-28 08:14:01 +02:00
Multi ctrl support.. (Rev 1.30)
This commit is contained in:
parent
3fb4583c97
commit
376a788668
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# $Id: megaclisas-status,v 1.29 2015/04/01 22:10:47 root Exp $
|
# $Id: megaclisas-status,v 1.30 2015/04/08 16:32:54 root Exp $
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@ -127,13 +127,16 @@ def returnFirmwareVersion(output):
|
|||||||
return line.split(':')[1].strip()
|
return line.split(':')[1].strip()
|
||||||
|
|
||||||
def returnROCTemp(output):
|
def returnROCTemp(output):
|
||||||
ROCtemp = 0
|
ROCtemp = ''
|
||||||
tmpstr = ''
|
tmpstr = ''
|
||||||
for line in output:
|
for line in output:
|
||||||
if re.match(r'^ROC temperature :.*$',line.strip()):
|
if re.match(r'^ROC temperature :.*$',line.strip()):
|
||||||
tmpstr = line.split(':')[1].strip()
|
tmpstr = line.split(':')[1].strip()
|
||||||
ROCtemp = re.sub(' +.*$', '', tmpstr)
|
ROCtemp = re.sub(' +.*$', '', tmpstr)
|
||||||
return ROCtemp
|
if ( ROCtemp != '' ):
|
||||||
|
return str(str(ROCtemp)+'AC')
|
||||||
|
else:
|
||||||
|
return str('N/A')
|
||||||
|
|
||||||
def returnArrayNumber(output):
|
def returnArrayNumber(output):
|
||||||
i = 0
|
i = 0
|
||||||
@ -142,6 +145,18 @@ def returnArrayNumber(output):
|
|||||||
i += 1
|
i += 1
|
||||||
return i
|
return i
|
||||||
|
|
||||||
|
def returnHBAInfo(table,output,controllerid):
|
||||||
|
controllermodel = 'Unknown'
|
||||||
|
controllerram = 'Unknown'
|
||||||
|
controllerrev = 'Unknown'
|
||||||
|
controllertemp = ''
|
||||||
|
controllermodel = returnControllerModel(output)
|
||||||
|
controllerram = returnMemorySize(output)
|
||||||
|
controllerrev = returnFirmwareVersion(output)
|
||||||
|
controllertemp = returnROCTemp(output)
|
||||||
|
if controllermodel != 'Unknown':
|
||||||
|
table.append([ 'c'+str(controllerid), controllermodel, controllerram, str(controllertemp), str('FW: '+controllerrev) ])
|
||||||
|
|
||||||
def returnArrayInfo(output,controllerid,arrayid):
|
def returnArrayInfo(output,controllerid,arrayid):
|
||||||
id = 'c'+str(controllerid)+'u'+str(arrayid)
|
id = 'c'+str(controllerid)+'u'+str(arrayid)
|
||||||
operationlinennumber = False
|
operationlinennumber = False
|
||||||
@ -353,27 +368,27 @@ if printcontroller:
|
|||||||
i = 0
|
i = 0
|
||||||
controllerid = 0
|
controllerid = 0
|
||||||
mlen = 0
|
mlen = 0
|
||||||
|
hbainfo = []
|
||||||
while controllerid < controllernumber:
|
while controllerid < controllernumber:
|
||||||
cmd = '%s -AdpAllInfo -a%d -NoLog' % (megaclipath, controllerid)
|
cmd = '%s -AdpAllInfo -a%d -NoLog' % (megaclipath, controllerid)
|
||||||
output = getOutput(cmd)
|
output = getOutput(cmd)
|
||||||
controllermodel = returnControllerModel(output)
|
returnHBAInfo(hbainfo, output,controllerid)
|
||||||
controllerram = returnMemorySize(output)
|
controllerid += 1
|
||||||
controllerrev = returnFirmwareVersion(output)
|
mlen = returnWdthFromArrayCol(hbainfo,1)
|
||||||
controllertemp = returnROCTemp(output)
|
|
||||||
if ( len(controllermodel) > mlen):
|
|
||||||
mlen = len(controllermodel)
|
|
||||||
|
|
||||||
|
controllerid = 0
|
||||||
|
for hba in hbainfo:
|
||||||
hbafmt = str('%-5s | %-'+str(mlen)+'s | %-6s | %-4s | %-12s ')
|
hbafmt = str('%-5s | %-'+str(mlen)+'s | %-6s | %-4s | %-12s ')
|
||||||
# Header
|
# Header
|
||||||
if ( i == 0 ):
|
if ( i == 0 ):
|
||||||
print hbafmt % ("-- ID","H/W Model","RAM","Temp","Firmware")
|
print hbafmt % ("-- ID","H/W Model","RAM","Temp","Firmware")
|
||||||
print hbafmt % (
|
print hbafmt % (
|
||||||
'c'+str(controllerid),
|
hba[0],
|
||||||
controllermodel,
|
hba[1],
|
||||||
str(controllerram),
|
hba[2],
|
||||||
str(controllertemp+'C'),
|
hba[3],
|
||||||
str('FW: '+controllerrev))
|
hba[4])
|
||||||
controllerid += 1
|
i += 1
|
||||||
print ''
|
print ''
|
||||||
else:
|
else:
|
||||||
print "No MegaRAID or PERC adapter detected on your system!"
|
print "No MegaRAID or PERC adapter detected on your system!"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user