mirror of
https://github.com/eLvErDe/hwraid.git
synced 2025-07-25 06:44:26 +02:00
Very minor bugfixes (Rev 1.42)
This commit is contained in:
parent
f665b41883
commit
79e420cd31
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# $Id: megaclisas-status,v 1.41 2015/04/13 18:34:21 cojot Exp $
|
# $Id: megaclisas-status,v 1.42 2015/04/13 18:50:42 cojot Exp $
|
||||||
#
|
#
|
||||||
# Written by Adam Cecile <gandalf@NOSPAM.le-vert.net>
|
# Written by Adam Cecile <gandalf@NOSPAM.le-vert.net>
|
||||||
# Modified vy Vincent S. Cojot <vincent@NOSPAM.cojot.name>
|
# Modified vy Vincent S. Cojot <vincent@NOSPAM.cojot.name>
|
||||||
@ -51,8 +51,6 @@ if len(sys.argv) > 2:
|
|||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
if sys.argv[1] == '--nagios':
|
if sys.argv[1] == '--nagios':
|
||||||
nagiosmode = True
|
nagiosmode = True
|
||||||
printarray = False
|
|
||||||
printcontroller = False
|
|
||||||
elif sys.argv[1] == '--debug':
|
elif sys.argv[1] == '--debug':
|
||||||
debugmode = True
|
debugmode = True
|
||||||
else:
|
else:
|
||||||
@ -405,7 +403,8 @@ bad = False
|
|||||||
# List available controller
|
# List available controller
|
||||||
if printcontroller:
|
if printcontroller:
|
||||||
if controllernumber:
|
if controllernumber:
|
||||||
print '-- Controller information --'
|
if not nagiosmode:
|
||||||
|
print '-- Controller information --'
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
controllerid = 0
|
controllerid = 0
|
||||||
@ -423,21 +422,25 @@ if printcontroller:
|
|||||||
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")
|
if not nagiosmode:
|
||||||
print hbafmt % (
|
print hbafmt % ("-- ID","H/W Model","RAM","Temp","Firmware")
|
||||||
hba[0],
|
if not nagiosmode:
|
||||||
hba[1],
|
print hbafmt % (
|
||||||
hba[2],
|
hba[0],
|
||||||
hba[3],
|
hba[1],
|
||||||
hba[4])
|
hba[2],
|
||||||
|
hba[3],
|
||||||
|
hba[4])
|
||||||
i += 1
|
i += 1
|
||||||
print ''
|
if not nagiosmode:
|
||||||
|
print ''
|
||||||
else:
|
else:
|
||||||
print "No MegaRAID or PERC adapter detected on your system!"
|
print "No MegaRAID or PERC adapter detected on your system!"
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
if printarray:
|
if printarray:
|
||||||
print '-- Array information --'
|
if not nagiosmode:
|
||||||
|
print '-- Array information --'
|
||||||
|
|
||||||
controllerid = 0
|
controllerid = 0
|
||||||
i = 0
|
i = 0
|
||||||
@ -487,23 +490,25 @@ if printarray:
|
|||||||
ldfmt = str('%-5s | %-'+str(rlen)+'s | %7s | %7s | %'+str(mlen)+'s | %8s | %-7s | %-12s ')
|
ldfmt = str('%-5s | %-'+str(rlen)+'s | %7s | %7s | %'+str(mlen)+'s | %8s | %-7s | %-12s ')
|
||||||
# Header
|
# Header
|
||||||
if ( i == 0 ):
|
if ( i == 0 ):
|
||||||
print ldfmt % ("-- ID", "Type", "Size", "Strpsz", "Flags", "DskCache", "Status", "InProgress" )
|
if not nagiosmode:
|
||||||
print ldfmt % (
|
print ldfmt % ("-- ID", "Type", "Size", "Strpsz", "Flags", "DskCache", "Status", "InProgress" )
|
||||||
arrayinfo[0],
|
if not nagiosmode:
|
||||||
arrayinfo[1],
|
print ldfmt % (
|
||||||
arrayinfo[2],
|
arrayinfo[0],
|
||||||
arrayinfo[3],
|
arrayinfo[1],
|
||||||
arrayinfo[4],
|
arrayinfo[2],
|
||||||
arrayinfo[5],
|
arrayinfo[3],
|
||||||
arrayinfo[6],
|
arrayinfo[4],
|
||||||
arrayinfo[7])
|
arrayinfo[5],
|
||||||
|
arrayinfo[6],
|
||||||
|
arrayinfo[7])
|
||||||
if not arrayinfo[6] == 'Optimal':
|
if not arrayinfo[6] == 'Optimal':
|
||||||
bad = True
|
bad = True
|
||||||
arrayid += 1
|
arrayid += 1
|
||||||
i += 1
|
i += 1
|
||||||
controllerid += 1
|
controllerid += 1
|
||||||
print ''
|
if not nagiosmode:
|
||||||
|
print ''
|
||||||
|
|
||||||
controllerid = 0
|
controllerid = 0
|
||||||
while controllerid < controllernumber:
|
while controllerid < controllernumber:
|
||||||
@ -513,7 +518,8 @@ while controllerid < controllernumber:
|
|||||||
controllerid += 1
|
controllerid += 1
|
||||||
|
|
||||||
if totaldrivenumber:
|
if totaldrivenumber:
|
||||||
print '-- Disk information --'
|
if not nagiosmode:
|
||||||
|
print '-- Disk information --'
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
mlen = 0
|
mlen = 0
|
||||||
@ -552,22 +558,25 @@ if totaldrivenumber:
|
|||||||
for array in arraydisk:
|
for array in arraydisk:
|
||||||
# Header
|
# Header
|
||||||
if ( i == 0 ):
|
if ( i == 0 ):
|
||||||
print drvfmt % (
|
if not nagiosmode:
|
||||||
"-- ID", "Type", "Drive Model", "Size", "Status", "Speed", "Temp", "Slot ID", "LSI Device ID")
|
print drvfmt % (
|
||||||
|
"-- ID", "Type", "Drive Model", "Size", "Status", "Speed", "Temp", "Slot ID", "LSI Device ID")
|
||||||
# Drive information
|
# Drive information
|
||||||
print drvfmt % (
|
if not nagiosmode:
|
||||||
str('c'+str(controllerid)+'u'+array[0]+'p'+array[1]), # c0p0
|
print drvfmt % (
|
||||||
array[2], # HDD/SDD
|
str('c'+str(controllerid)+'u'+array[0]+'p'+array[1]), # c0p0
|
||||||
array[3], # Model Information (Variable len)
|
array[2], # HDD/SDD
|
||||||
array[4], # Size
|
array[3], # Model Information (Variable len)
|
||||||
array[5], # Status (Variable len)
|
array[4], # Size
|
||||||
array[6], # Speed
|
array[5], # Status (Variable len)
|
||||||
array[7], # Temp
|
array[6], # Speed
|
||||||
str('['+array[8]+':'+array[9]+']'), # Slot ID
|
array[7], # Temp
|
||||||
array[10]) # LSI ID
|
str('['+array[8]+':'+array[9]+']'), # Slot ID
|
||||||
|
array[10]) # LSI ID
|
||||||
i = i + 1
|
i = i + 1
|
||||||
controllerid += 1
|
controllerid += 1
|
||||||
print ''
|
if not nagiosmode:
|
||||||
|
print ''
|
||||||
|
|
||||||
controllerid = 0
|
controllerid = 0
|
||||||
while controllerid < controllernumber:
|
while controllerid < controllernumber:
|
||||||
@ -577,7 +586,8 @@ while controllerid < controllernumber:
|
|||||||
controllerid += 1
|
controllerid += 1
|
||||||
|
|
||||||
if totalunconfdrivenumber:
|
if totalunconfdrivenumber:
|
||||||
print '-- Unconfigured Disk information --'
|
if not nagiosmode:
|
||||||
|
print '-- Unconfigured Disk information --'
|
||||||
|
|
||||||
controllerid = 0
|
controllerid = 0
|
||||||
while controllerid < controllernumber:
|
while controllerid < controllernumber:
|
||||||
@ -599,22 +609,25 @@ if totalunconfdrivenumber:
|
|||||||
for array in arraydisk:
|
for array in arraydisk:
|
||||||
# Header
|
# Header
|
||||||
if ( i == 0 ):
|
if ( i == 0 ):
|
||||||
print drvfmt % (
|
if not nagiosmode:
|
||||||
"-- ID", "Type", "Drive Model", "Size", "Status", "Speed", "Temp", "Slot ID", "LSI Device ID")
|
print drvfmt % (
|
||||||
|
"-- ID", "Type", "Drive Model", "Size", "Status", "Speed", "Temp", "Slot ID", "LSI Device ID")
|
||||||
# Drive information
|
# Drive information
|
||||||
print drvfmt % (
|
if not nagiosmode:
|
||||||
str('c'+str(controllerid)+'uXpY'), # cXpY
|
print drvfmt % (
|
||||||
array[0], # HDD/SDD
|
str('c'+str(controllerid)+'uXpY'), # cXpY
|
||||||
array[1], # Model Information (Variable len)
|
array[0], # HDD/SDD
|
||||||
array[2], # Size
|
array[1], # Model Information (Variable len)
|
||||||
array[3], # Status (Variable len)
|
array[2], # Size
|
||||||
array[4], # Speed
|
array[3], # Status (Variable len)
|
||||||
array[5], # Temp
|
array[4], # Speed
|
||||||
str('['+array[6]+':'+array[7]+']'), # Slot ID
|
array[5], # Temp
|
||||||
array[8]) # LSI ID
|
str('['+array[6]+':'+array[7]+']'), # Slot ID
|
||||||
|
array[8]) # LSI ID
|
||||||
i = i + 1
|
i = i + 1
|
||||||
controllerid += 1
|
controllerid += 1
|
||||||
print ''
|
if not nagiosmode:
|
||||||
|
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