mirror of
https://github.com/eLvErDe/hwraid.git
synced 2025-07-27 07:44:01 +02:00
Coded PCI path.. (Rev 1.44)
This commit is contained in:
parent
bf3d2a205f
commit
fabae64392
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# $Id: megaclisas-status,v 1.43 2015/04/13 19:22:05 cojot Exp $
|
# $Id: megaclisas-status,v 1.44 2015/04/17 01:59:31 root 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>
|
||||||
@ -88,7 +88,7 @@ megaclipath = which("MegaCli64")
|
|||||||
if (megaclipath == None):
|
if (megaclipath == None):
|
||||||
megaclipath = which("MegaCli")
|
megaclipath = which("MegaCli")
|
||||||
if (megaclipath == None):
|
if (megaclipath == None):
|
||||||
megaclipath = "MegaCli_is_missing"
|
megaclipath = "MegaCli"
|
||||||
|
|
||||||
# Check binary exists (and +x), if not print an error message
|
# Check binary exists (and +x), if not print an error message
|
||||||
if os.path.exists(megaclipath) and os.access(megaclipath, os.X_OK):
|
if os.path.exists(megaclipath) and os.access(megaclipath, os.X_OK):
|
||||||
@ -97,7 +97,7 @@ else:
|
|||||||
if nagiosmode:
|
if nagiosmode:
|
||||||
print 'UNKNOWN - Cannot find '+megaclipath
|
print 'UNKNOWN - Cannot find '+megaclipath
|
||||||
else:
|
else:
|
||||||
print 'Cannot find ' + megaclipath + '. Please install it.'
|
print 'Cannot find ' + megaclipath + 'in your PATH. Please install it.'
|
||||||
sys.exit(3)
|
sys.exit(3)
|
||||||
|
|
||||||
|
|
||||||
@ -178,6 +178,22 @@ def returnArrayNumber(output):
|
|||||||
i += 1
|
i += 1
|
||||||
return i
|
return i
|
||||||
|
|
||||||
|
def returnPCIInfo(output):
|
||||||
|
busprefix = '0000'
|
||||||
|
busid = ''
|
||||||
|
devid = ''
|
||||||
|
functionid = ''
|
||||||
|
pcipath = ''
|
||||||
|
for line in output:
|
||||||
|
if re.match(r'^Bus Number.*:.*$',line.strip()):
|
||||||
|
busid = str(line.strip().split(':')[1].strip()).zfill(2)
|
||||||
|
if re.match(r'^Device Number.*:.*$',line.strip()):
|
||||||
|
devid = str(line.strip().split(':')[1].strip()).zfill(2)
|
||||||
|
if re.match(r'^Function Number.*:.*$',line.strip()):
|
||||||
|
functionid = str(line.strip().split(':')[1].strip()).zfill(2)
|
||||||
|
pcipath = str(busprefix + ':' + busid + ':' + devid + '.' + functionid)
|
||||||
|
return str(pcipath)
|
||||||
|
|
||||||
def returnHBAInfo(table,output,controllerid):
|
def returnHBAInfo(table,output,controllerid):
|
||||||
controllermodel = 'Unknown'
|
controllermodel = 'Unknown'
|
||||||
controllerram = 'Unknown'
|
controllerram = 'Unknown'
|
||||||
@ -444,11 +460,16 @@ if printarray:
|
|||||||
print '-- Array information --'
|
print '-- Array information --'
|
||||||
|
|
||||||
controllerid = 0
|
controllerid = 0
|
||||||
|
pcipath = ''
|
||||||
i = 0
|
i = 0
|
||||||
mlen = 0
|
mlen = 0
|
||||||
rlen = 0
|
rlen = 0
|
||||||
while controllerid < controllernumber:
|
while controllerid < controllernumber:
|
||||||
arrayid = 0
|
arrayid = 0
|
||||||
|
cmd = '%s -AdpGetPciInfo -a%d -NoLog' % (megaclipath, controllerid)
|
||||||
|
output = getOutput(cmd)
|
||||||
|
pcipath = returnPCIInfo(output)
|
||||||
|
|
||||||
cmd = '%s -LDInfo -lall -a%d -NoLog' % (megaclipath, controllerid)
|
cmd = '%s -LDInfo -lall -a%d -NoLog' % (megaclipath, controllerid)
|
||||||
output = getOutput(cmd)
|
output = getOutput(cmd)
|
||||||
arraynumber = returnArrayNumber(output)
|
arraynumber = returnArrayNumber(output)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user