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
|
||||
# $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>
|
||||
# Modified vy Vincent S. Cojot <vincent@NOSPAM.cojot.name>
|
||||
@ -51,8 +51,6 @@ if len(sys.argv) > 2:
|
||||
if len(sys.argv) > 1:
|
||||
if sys.argv[1] == '--nagios':
|
||||
nagiosmode = True
|
||||
printarray = False
|
||||
printcontroller = False
|
||||
elif sys.argv[1] == '--debug':
|
||||
debugmode = True
|
||||
else:
|
||||
@ -405,6 +403,7 @@ bad = False
|
||||
# List available controller
|
||||
if printcontroller:
|
||||
if controllernumber:
|
||||
if not nagiosmode:
|
||||
print '-- Controller information --'
|
||||
|
||||
i = 0
|
||||
@ -423,7 +422,9 @@ if printcontroller:
|
||||
hbafmt = str('%-5s | %-'+str(mlen)+'s | %-6s | %-4s | %-12s ')
|
||||
# Header
|
||||
if ( i == 0 ):
|
||||
if not nagiosmode:
|
||||
print hbafmt % ("-- ID","H/W Model","RAM","Temp","Firmware")
|
||||
if not nagiosmode:
|
||||
print hbafmt % (
|
||||
hba[0],
|
||||
hba[1],
|
||||
@ -431,12 +432,14 @@ if printcontroller:
|
||||
hba[3],
|
||||
hba[4])
|
||||
i += 1
|
||||
if not nagiosmode:
|
||||
print ''
|
||||
else:
|
||||
print "No MegaRAID or PERC adapter detected on your system!"
|
||||
exit(1)
|
||||
|
||||
if printarray:
|
||||
if not nagiosmode:
|
||||
print '-- Array information --'
|
||||
|
||||
controllerid = 0
|
||||
@ -487,7 +490,9 @@ if printarray:
|
||||
ldfmt = str('%-5s | %-'+str(rlen)+'s | %7s | %7s | %'+str(mlen)+'s | %8s | %-7s | %-12s ')
|
||||
# Header
|
||||
if ( i == 0 ):
|
||||
if not nagiosmode:
|
||||
print ldfmt % ("-- ID", "Type", "Size", "Strpsz", "Flags", "DskCache", "Status", "InProgress" )
|
||||
if not nagiosmode:
|
||||
print ldfmt % (
|
||||
arrayinfo[0],
|
||||
arrayinfo[1],
|
||||
@ -502,9 +507,9 @@ if printarray:
|
||||
arrayid += 1
|
||||
i += 1
|
||||
controllerid += 1
|
||||
if not nagiosmode:
|
||||
print ''
|
||||
|
||||
|
||||
controllerid = 0
|
||||
while controllerid < controllernumber:
|
||||
cmd = '%s -PDGetNum -a%d -NoLog' % (megaclipath, controllerid)
|
||||
@ -513,6 +518,7 @@ while controllerid < controllernumber:
|
||||
controllerid += 1
|
||||
|
||||
if totaldrivenumber:
|
||||
if not nagiosmode:
|
||||
print '-- Disk information --'
|
||||
|
||||
i = 0
|
||||
@ -552,9 +558,11 @@ if totaldrivenumber:
|
||||
for array in arraydisk:
|
||||
# Header
|
||||
if ( i == 0 ):
|
||||
if not nagiosmode:
|
||||
print drvfmt % (
|
||||
"-- ID", "Type", "Drive Model", "Size", "Status", "Speed", "Temp", "Slot ID", "LSI Device ID")
|
||||
# Drive information
|
||||
if not nagiosmode:
|
||||
print drvfmt % (
|
||||
str('c'+str(controllerid)+'u'+array[0]+'p'+array[1]), # c0p0
|
||||
array[2], # HDD/SDD
|
||||
@ -567,6 +575,7 @@ if totaldrivenumber:
|
||||
array[10]) # LSI ID
|
||||
i = i + 1
|
||||
controllerid += 1
|
||||
if not nagiosmode:
|
||||
print ''
|
||||
|
||||
controllerid = 0
|
||||
@ -577,6 +586,7 @@ while controllerid < controllernumber:
|
||||
controllerid += 1
|
||||
|
||||
if totalunconfdrivenumber:
|
||||
if not nagiosmode:
|
||||
print '-- Unconfigured Disk information --'
|
||||
|
||||
controllerid = 0
|
||||
@ -599,9 +609,11 @@ if totalunconfdrivenumber:
|
||||
for array in arraydisk:
|
||||
# Header
|
||||
if ( i == 0 ):
|
||||
if not nagiosmode:
|
||||
print drvfmt % (
|
||||
"-- ID", "Type", "Drive Model", "Size", "Status", "Speed", "Temp", "Slot ID", "LSI Device ID")
|
||||
# Drive information
|
||||
if not nagiosmode:
|
||||
print drvfmt % (
|
||||
str('c'+str(controllerid)+'uXpY'), # cXpY
|
||||
array[0], # HDD/SDD
|
||||
@ -614,6 +626,7 @@ if totalunconfdrivenumber:
|
||||
array[8]) # LSI ID
|
||||
i = i + 1
|
||||
controllerid += 1
|
||||
if not nagiosmode:
|
||||
print ''
|
||||
|
||||
if bad:
|
||||
|
Loading…
x
Reference in New Issue
Block a user