mirror of https://github.com/eLvErDe/hwraid.git
Retrieve disk serial number
This commit is contained in:
parent
29b2068bf1
commit
458ca9ad90
|
@ -128,6 +128,7 @@ def returnDisksInfo(output,controllerid):
|
||||||
vendor = False
|
vendor = False
|
||||||
model = False
|
model = False
|
||||||
state = False
|
state = False
|
||||||
|
serial = False
|
||||||
disks = []
|
disks = []
|
||||||
for line in output:
|
for line in output:
|
||||||
if re.match(r'^Reported Channel,Device(\(T:L\))?\s+: [0-9]+,[0-9]+(\([0-9]+:[0-9]+\))?$',line.strip()):
|
if re.match(r'^Reported Channel,Device(\(T:L\))?\s+: [0-9]+,[0-9]+(\([0-9]+:[0-9]+\))?$',line.strip()):
|
||||||
|
@ -140,12 +141,15 @@ def returnDisksInfo(output,controllerid):
|
||||||
vendor = line.split(':')[1].strip()
|
vendor = line.split(':')[1].strip()
|
||||||
if re.match(r'^Model\s+:.*$',line.strip()):
|
if re.match(r'^Model\s+:.*$',line.strip()):
|
||||||
model = line.split(':')[1].strip()
|
model = line.split(':')[1].strip()
|
||||||
if diskid != False and vendor != False and model != False and state != False:
|
if re.match(r'^Serial number\s+:.*$',line.strip()):
|
||||||
disks.append([diskid,state,vendor,model])
|
serial = line.split(':')[1].strip()
|
||||||
|
if diskid != False and vendor != False and model != False and state != False and serial != False:
|
||||||
|
disks.append([diskid, state, vendor, model, serial])
|
||||||
diskid = False
|
diskid = False
|
||||||
vendor = False
|
vendor = False
|
||||||
model = False
|
model = False
|
||||||
state = False
|
state = False
|
||||||
|
serial = False
|
||||||
return disks
|
return disks
|
||||||
|
|
||||||
config = parse_args()
|
config = parse_args()
|
||||||
|
@ -296,14 +300,14 @@ while controllerid <= controllernumber:
|
||||||
# Matched in members of this array
|
# Matched in members of this array
|
||||||
if disk[0] == member:
|
if disk[0] == member:
|
||||||
if not config.nagios:
|
if not config.nagios:
|
||||||
print 'c'+str(controllerid-1)+'u'+str(arrayid)+'d'+str(memberid)+' | '+disk[2]+' '+disk[3]+' | '+disk[1]
|
print 'c'+str(controllerid-1)+'u'+str(arrayid)+'d'+str(memberid)+' | '+disk[2]+' '+disk[3]+' '+disk[4]+' | '+disk[1]
|
||||||
array_member = True
|
array_member = True
|
||||||
memberid += 1
|
memberid += 1
|
||||||
|
|
||||||
# Some disks may not be attached to any array (ie: global hot spare)
|
# Some disks may not be attached to any array (ie: global hot spare)
|
||||||
if not array_member:
|
if not array_member:
|
||||||
if not config.nagios:
|
if not config.nagios:
|
||||||
print 'c'+str(controllerid-1)+'uX'+'d'+str(no_array_disk_id)+' | '+disk[2]+' '+disk[3]+' | '+disk[1]
|
print 'c'+str(controllerid-1)+'uX'+'d'+str(no_array_disk_id)+' | '+disk[2]+' '+disk[3]+' '+disk[4]+' | '+disk[1]
|
||||||
no_array_disk_id += 1
|
no_array_disk_id += 1
|
||||||
|
|
||||||
controllerid += 1
|
controllerid += 1
|
||||||
|
|
Loading…
Reference in New Issue