Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve array enumeration in megaclisas-status #27

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions wrapper-scripts/megaclisas-status
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ def returnArrayNumber(output):
i = line.strip().split(':')[1].strip()
return i

def returnArrayList(output):
arrays = []

for line in output:
m = re.match(r'Virtual Drive:.*Target Id: (\d+)', line.strip())
if m:
arrays += m.group(1)
return arrays

def returnArrayInfo(output,controllerid,arrayid):
id = 'c'+str(controllerid)+'u'+str(arrayid)
operationlinennumber = False
Expand Down Expand Up @@ -154,11 +163,10 @@ if not nagiosmode:
print '-- ID | Type | Size | Status | InProgress'

while controllerid < controllernumber:
arrayid = 0
cmd = binarypath+' -LdGetNum -a'+str(controllerid)+' -NoLog'
cmd = binarypath+' -LDInfo -Lall -a'+str(controllerid)+' -NoLog'
output = getOutput(cmd)
arraynumber = returnArrayNumber(output)
while arrayid < int(arraynumber):
arrays = returnArrayList(output)
for arrayid in arrays:
cmd = binarypath+' -LDInfo -l'+str(arrayid)+' -a'+str(controllerid)+' -NoLog'
output = getOutput(cmd)
arrayinfo = returnArrayInfo(output,controllerid,arrayid)
Expand All @@ -169,8 +177,8 @@ while controllerid < controllernumber:
nagiosbadarray=nagiosbadarray+1
else:
nagiosgoodarray=nagiosgoodarray+1
arrayid += 1
controllerid += 1

if not nagiosmode:
print ''

Expand Down