Very minor bugfixes (Rev 1.18)

This commit is contained in:
Vincent S. Cojot 2015-03-27 02:52:24 -04:00
parent 84827f6582
commit ae24057874
1 changed files with 35 additions and 19 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/python
# $Id: megaclisas-status,v 1.17 2015/03/27 01:44:53 root Exp $
# $Id: megaclisas-status,v 1.18 2015/03/27 02:52:24 root Exp $
import os
import re
@ -8,6 +8,7 @@ import pdb
# Sane defaults
tabwdth = 4
drvfmt = "%-8s | %-8s | %-20s | %-8s | %-20s | %-8s | %-8s | %-8s | %-8s"
#megaclipath = "/opt/MegaRAID/MegaCli/MegaCli64"
@ -356,7 +357,7 @@ while controllerid < controllernumber:
if totaldrivenumber:
print '-- Disks information --'
print '-- ID\t| Type\t| Model\t\t\t\t\t| Size\t\t| Status\t\t| Speed\t\t| Temp\t| Slot ID\t| LSI Device ID '.expandtabs(tabwdth)
# print '-- ID\t| Type\t| Model\t\t\t\t\t| Size\t\t| Status\t\t| Speed\t\t| Temp\t| Slot ID\t| LSI Device ID '.expandtabs(tabwdth)
controllerid = 0
while controllerid < controllernumber:
@ -369,15 +370,24 @@ if totaldrivenumber:
cmd = '%s -LdPdInfo -a%d -NoLog' % (megaclipath, controllerid)
output = getOutput(cmd)
arraydisk = returnDiskInfo(output,controllerid)
i = 0
for array in arraydisk:
print str('c'+str(controllerid)+'u'+array[0]+'p'+array[1]+'\t| '
+array[2]+'\t| '
+array[3]+'\t| '
+array[4]+'\t| '
+array[5]+'\t| '
+array[6]+'\t| ['
+array[7]+':'+array[8]+']\t| '
+array[9]).expandtabs(tabwdth)
# Header
if ( i == 0 ):
print drvfmt % (
"-- ID", "Type", "Model", "Size", "Status", "Speed", "Temp", "Slot ID", "LSI Device ID")
# Drive information
print drvfmt % (
str('c'+str(controllerid)+'u'+array[0]+'p'+array[1]),
array[2],
array[3],
array[4],
array[5],
array[6],
array[7],
str('['+array[8]+':'+array[9]+']'),
array[10])
i = i + 1
controllerid += 1
print ''
@ -390,8 +400,6 @@ while controllerid < controllernumber:
if totalunconfdrivenumber:
print '-- Unconfigured Disks information --'
print '-- ID\t| Type\t| Model\t\t\t\t\t| Size\t\t| Status\t\t| Speed\t\t| Temp\t| Slot ID\t| LSI Device ID '.expandtabs(tabwdth)
## print '-- ID\t| Type\t| Mfg.\t\t| Drive Type\t| Size\t\t| H/W Serial\t| Status\t\t| Speed\t\t| Temp\t| Slot ID\t| LSI Device ID '.expandtabs(tabwdth)
controllerid = 0
while controllerid < controllernumber:
@ -404,14 +412,22 @@ if totalunconfdrivenumber:
cmd = '%s -PDList -a%d -NoLog' % (megaclipath, controllerid)
output = getOutput(cmd)
arraydisk = returnUnconfDiskInfo(output,controllerid)
i = 0
for array in arraydisk:
print str('c'+str(controllerid)+'uXpY\t| '+array[0]+'\t| '
+array[1]+'\t| '
+array[2]+'\t| '
+array[3]+'\t| '
+array[4]+'\t| ['
+array[5]+':'+array[6]+']\t| '
+array[7]+'').expandtabs(tabwdth)
# Header
if ( i == 0 ):
print drvfmt % (
"-- ID", "Type", "Model", "Size", "Status", "Speed", "Temp", "Slot ID", "LSI Device ID")
# Drive information
print drvfmt % (
str('c'+str(controllerid)+'uXpY\t| '+array[0]),
array[1],
array[2],
array[3],
array[4],
str('['+array[5]+':'+array[6]+']'),
array[7])
i = i + 1
controllerid += 1
print ''