Handle OSD index errors during stats collection
This commit is contained in:
parent
526a5f4a74
commit
8b93f9a80e
|
@ -350,32 +350,35 @@ def collect_ceph_stats(logger, config, zkhandler, this_node, queue):
|
||||||
elif line[0] == "+":
|
elif line[0] == "+":
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# If line begins with | and second entry is a digit (i.e. OSD ID)
|
try:
|
||||||
if line[0] == "|" and line[1].isdigit():
|
# If line begins with | and second entry is a digit (i.e. OSD ID)
|
||||||
# Parse the line in Ceph 14 format
|
if line[0] == "|" and line[1].isdigit():
|
||||||
osd_id = line[1]
|
# Parse the line in Ceph 14 format
|
||||||
node = line[3].split(".")[0]
|
osd_id = line[1]
|
||||||
used = line[5]
|
node = line[3].split(".")[0]
|
||||||
avail = line[7]
|
used = line[5]
|
||||||
wr_ops = line[9]
|
avail = line[7]
|
||||||
wr_data = line[11]
|
wr_ops = line[9]
|
||||||
rd_ops = line[13]
|
wr_data = line[11]
|
||||||
rd_data = line[15]
|
rd_ops = line[13]
|
||||||
state = line[17]
|
rd_data = line[15]
|
||||||
# If first entry is a digit (i.e. OSD ID)
|
state = line[17]
|
||||||
elif line[0].isdigit():
|
# If first entry is a digit (i.e. OSD ID)
|
||||||
# Parse the line in Ceph 16 format
|
elif line[0].isdigit():
|
||||||
osd_id = line[0]
|
# Parse the line in Ceph 16 format
|
||||||
node = line[1].split(".")[0]
|
osd_id = line[0]
|
||||||
used = line[2]
|
node = line[1].split(".")[0]
|
||||||
avail = line[3]
|
used = line[2]
|
||||||
wr_ops = line[4]
|
avail = line[3]
|
||||||
wr_data = line[5]
|
wr_ops = line[4]
|
||||||
rd_ops = line[6]
|
wr_data = line[5]
|
||||||
rd_data = line[7]
|
rd_ops = line[6]
|
||||||
state = line[8]
|
rd_data = line[7]
|
||||||
# Otherwise, it's the header line and is ignored
|
state = line[8]
|
||||||
else:
|
# Otherwise, it's the header line and is ignored
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
except IndexError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# I don't know why 2018 me used this construct instead of a normal
|
# I don't know why 2018 me used this construct instead of a normal
|
||||||
|
|
Loading…
Reference in New Issue