mirror of https://github.com/eLvErDe/hwraid.git
[megaclisas-status] Initial attempt at adding Battery Status
This commit is contained in:
parent
123ef59da8
commit
99ba05aabd
|
@ -174,6 +174,32 @@ def returnROCTemp(output):
|
|||
else:
|
||||
return str('N/A')
|
||||
|
||||
def returnBBUPresence(output):
|
||||
BBU = ''
|
||||
tmpstr = ''
|
||||
for line in output:
|
||||
if re.match(r'^BBU +:.*$',line.strip()):
|
||||
tmpstr = line.split(':')[1].strip()
|
||||
BBU = re.sub(' +.*$', '', tmpstr)
|
||||
break
|
||||
if ( BBU != '' ):
|
||||
return str(BBU)
|
||||
else:
|
||||
return str('N/A')
|
||||
|
||||
def returnBBUStatus(output):
|
||||
BBUStatus = ''
|
||||
tmpstr = ''
|
||||
for line in output:
|
||||
if re.match(r'^Battery Replacement required +:.*$',line.strip()):
|
||||
tmpstr = line.split(':')[1].strip()
|
||||
BBUStatus = re.sub(' +.*$', '', tmpstr)
|
||||
break
|
||||
if ( BBUStatus == 'Yes' ):
|
||||
return str('REPL')
|
||||
else:
|
||||
return str(BBUStatus)
|
||||
|
||||
def returnArrayNumber(output):
|
||||
i = 0
|
||||
for line in output:
|
||||
|
@ -210,8 +236,14 @@ def returnHBAInfo(table,output,controllerid):
|
|||
controllerram = returnMemorySize(output)
|
||||
controllerrev = returnFirmwareVersion(output)
|
||||
controllertemp = returnROCTemp(output)
|
||||
controllerbbu = returnBBUPresence(output)
|
||||
if controllerbbu == 'Present':
|
||||
cmd = '%s -AdpBbuCmd -GetBbuStatus -a%d -NoLog' % (megaclipath, controllerid)
|
||||
output = getOutput(cmd)
|
||||
controllerbbu = returnBBUStatus(output)
|
||||
|
||||
if controllermodel != 'Unknown':
|
||||
table.append([ 'c'+str(controllerid), controllermodel, controllerram, str(controllertemp), str('FW: '+controllerrev) ])
|
||||
table.append([ 'c'+str(controllerid), controllermodel, controllerram, str(controllertemp), str(controllerbbu), str('FW: '+controllerrev) ])
|
||||
|
||||
def returnArrayInfo(output,controllerid,arrayid):
|
||||
id = 'c'+str(controllerid)+'u'+str(arrayid)
|
||||
|
@ -470,18 +502,19 @@ if printcontroller:
|
|||
|
||||
controllerid = 0
|
||||
for hba in hbainfo:
|
||||
hbafmt = str('%-5s | %-'+str(mlen)+'s | %-6s | %-4s | %-12s ')
|
||||
hbafmt = str('%-5s | %-'+str(mlen)+'s | %-6s | %-4s | %-6s | %-12s ')
|
||||
# Header
|
||||
if ( i == 0 ):
|
||||
if not nagiosmode:
|
||||
print hbafmt % ("-- ID","H/W Model","RAM","Temp","Firmware")
|
||||
print hbafmt % ("-- ID","H/W Model","RAM","Temp","BBU", "Firmware")
|
||||
if not nagiosmode:
|
||||
print hbafmt % (
|
||||
hba[0],
|
||||
hba[1],
|
||||
hba[2],
|
||||
hba[3],
|
||||
hba[4])
|
||||
hba[4],
|
||||
hba[5])
|
||||
i += 1
|
||||
if not nagiosmode:
|
||||
print ''
|
||||
|
|
Loading…
Reference in New Issue