mirror of
https://github.com/eLvErDe/hwraid.git
synced 2025-07-25 23:04:44 +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,6 +403,7 @@ bad = False
|
|||||||
# List available controller
|
# List available controller
|
||||||
if printcontroller:
|
if printcontroller:
|
||||||
if controllernumber:
|
if controllernumber:
|
||||||
|
if not nagiosmode:
|
||||||
print '-- Controller information --'
|
print '-- Controller information --'
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
@ -423,7 +422,9 @@ 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 ):
|
||||||
|
if not nagiosmode:
|
||||||
print hbafmt % ("-- ID","H/W Model","RAM","Temp","Firmware")
|
print hbafmt % ("-- ID","H/W Model","RAM","Temp","Firmware")
|
||||||
|
if not nagiosmode:
|
||||||
print hbafmt % (
|
print hbafmt % (
|
||||||
hba[0],
|
hba[0],
|
||||||
hba[1],
|
hba[1],
|
||||||
@ -431,12 +432,14 @@ if printcontroller:
|
|||||||
hba[3],
|
hba[3],
|
||||||
hba[4])
|
hba[4])
|
||||||
i += 1
|
i += 1
|
||||||
|
if not nagiosmode:
|
||||||
print ''
|
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:
|
||||||
|
if not nagiosmode:
|
||||||
print '-- Array information --'
|
print '-- Array information --'
|
||||||
|
|
||||||
controllerid = 0
|
controllerid = 0
|
||||||
@ -487,7 +490,9 @@ 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 ):
|
||||||
|
if not nagiosmode:
|
||||||
print ldfmt % ("-- ID", "Type", "Size", "Strpsz", "Flags", "DskCache", "Status", "InProgress" )
|
print ldfmt % ("-- ID", "Type", "Size", "Strpsz", "Flags", "DskCache", "Status", "InProgress" )
|
||||||
|
if not nagiosmode:
|
||||||
print ldfmt % (
|
print ldfmt % (
|
||||||
arrayinfo[0],
|
arrayinfo[0],
|
||||||
arrayinfo[1],
|
arrayinfo[1],
|
||||||
@ -502,9 +507,9 @@ if printarray:
|
|||||||
arrayid += 1
|
arrayid += 1
|
||||||
i += 1
|
i += 1
|
||||||
controllerid += 1
|
controllerid += 1
|
||||||
|
if not nagiosmode:
|
||||||
print ''
|
print ''
|
||||||
|
|
||||||
|
|
||||||
controllerid = 0
|
controllerid = 0
|
||||||
while controllerid < controllernumber:
|
while controllerid < controllernumber:
|
||||||
cmd = '%s -PDGetNum -a%d -NoLog' % (megaclipath, controllerid)
|
cmd = '%s -PDGetNum -a%d -NoLog' % (megaclipath, controllerid)
|
||||||
@ -513,6 +518,7 @@ while controllerid < controllernumber:
|
|||||||
controllerid += 1
|
controllerid += 1
|
||||||
|
|
||||||
if totaldrivenumber:
|
if totaldrivenumber:
|
||||||
|
if not nagiosmode:
|
||||||
print '-- Disk information --'
|
print '-- Disk information --'
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
@ -552,9 +558,11 @@ if totaldrivenumber:
|
|||||||
for array in arraydisk:
|
for array in arraydisk:
|
||||||
# Header
|
# Header
|
||||||
if ( i == 0 ):
|
if ( i == 0 ):
|
||||||
|
if not nagiosmode:
|
||||||
print drvfmt % (
|
print drvfmt % (
|
||||||
"-- ID", "Type", "Drive Model", "Size", "Status", "Speed", "Temp", "Slot ID", "LSI Device ID")
|
"-- ID", "Type", "Drive Model", "Size", "Status", "Speed", "Temp", "Slot ID", "LSI Device ID")
|
||||||
# Drive information
|
# Drive information
|
||||||
|
if not nagiosmode:
|
||||||
print drvfmt % (
|
print drvfmt % (
|
||||||
str('c'+str(controllerid)+'u'+array[0]+'p'+array[1]), # c0p0
|
str('c'+str(controllerid)+'u'+array[0]+'p'+array[1]), # c0p0
|
||||||
array[2], # HDD/SDD
|
array[2], # HDD/SDD
|
||||||
@ -567,6 +575,7 @@ if totaldrivenumber:
|
|||||||
array[10]) # LSI ID
|
array[10]) # LSI ID
|
||||||
i = i + 1
|
i = i + 1
|
||||||
controllerid += 1
|
controllerid += 1
|
||||||
|
if not nagiosmode:
|
||||||
print ''
|
print ''
|
||||||
|
|
||||||
controllerid = 0
|
controllerid = 0
|
||||||
@ -577,6 +586,7 @@ while controllerid < controllernumber:
|
|||||||
controllerid += 1
|
controllerid += 1
|
||||||
|
|
||||||
if totalunconfdrivenumber:
|
if totalunconfdrivenumber:
|
||||||
|
if not nagiosmode:
|
||||||
print '-- Unconfigured Disk information --'
|
print '-- Unconfigured Disk information --'
|
||||||
|
|
||||||
controllerid = 0
|
controllerid = 0
|
||||||
@ -599,9 +609,11 @@ if totalunconfdrivenumber:
|
|||||||
for array in arraydisk:
|
for array in arraydisk:
|
||||||
# Header
|
# Header
|
||||||
if ( i == 0 ):
|
if ( i == 0 ):
|
||||||
|
if not nagiosmode:
|
||||||
print drvfmt % (
|
print drvfmt % (
|
||||||
"-- ID", "Type", "Drive Model", "Size", "Status", "Speed", "Temp", "Slot ID", "LSI Device ID")
|
"-- ID", "Type", "Drive Model", "Size", "Status", "Speed", "Temp", "Slot ID", "LSI Device ID")
|
||||||
# Drive information
|
# Drive information
|
||||||
|
if not nagiosmode:
|
||||||
print drvfmt % (
|
print drvfmt % (
|
||||||
str('c'+str(controllerid)+'uXpY'), # cXpY
|
str('c'+str(controllerid)+'uXpY'), # cXpY
|
||||||
array[0], # HDD/SDD
|
array[0], # HDD/SDD
|
||||||
@ -614,6 +626,7 @@ if totalunconfdrivenumber:
|
|||||||
array[8]) # LSI ID
|
array[8]) # LSI ID
|
||||||
i = i + 1
|
i = i + 1
|
||||||
controllerid += 1
|
controllerid += 1
|
||||||
|
if not nagiosmode:
|
||||||
print ''
|
print ''
|
||||||
|
|
||||||
if bad:
|
if bad:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user