parent
e4410b1258
commit
1b5e05b81a
1 changed files with 34 additions and 13 deletions
|
|
@ -51,9 +51,15 @@ IO_VARS = {
|
|||
'Scale 8': [2**(0.56*(x+1))+(16*(x+1)) for x in range(8)],
|
||||
'Scale 16': [2**(0.56*(x+1))+(16*(x+1)) for x in range(16)],
|
||||
'Scale 32': [2**(0.56*(x+1)/2)+(16*(x+1)/2) for x in range(32)],
|
||||
'Threshold Fail': 65*1024**2,
|
||||
'Threshold Warn': 135*1024**2,
|
||||
'Threshold Great': 750*1024**2,
|
||||
'Threshold Graph Fail': 65*1024**2,
|
||||
'Threshold Graph Warn': 135*1024**2,
|
||||
'Threshold Graph Great': 750*1024**2,
|
||||
'Threshold HDD Min': 50*1024**2,
|
||||
'Threshold HDD High Avg': 75*1024**2,
|
||||
'Threshold HDD Low Avg': 65*1024**2,
|
||||
'Threshold SSD Min': 90*1024**2,
|
||||
'Threshold SSD High Avg': 135*1024**2,
|
||||
'Threshold SSD Low Avg': 100*1024**2,
|
||||
'Graph Horizontal': ('▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'),
|
||||
'Graph Horizontal Width': 40,
|
||||
'Graph Vertical': (
|
||||
|
|
@ -112,7 +118,7 @@ def connect_to_db():
|
|||
|
||||
# Establish SQL connection (try a few times in case SSH is slow)
|
||||
for x in range(5):
|
||||
sleep(3)
|
||||
sleep(1)
|
||||
try:
|
||||
ost_db['Connection'] = mariadb.connect(
|
||||
user=DB_USER, password=DB_PASS, database=DB_NAME)
|
||||
|
|
@ -180,11 +186,11 @@ def generate_horizontal_graph(rates, oneline=False):
|
|||
|
||||
# Set color
|
||||
r_color = COLORS['CLEAR']
|
||||
if r < IO_VARS['Threshold Fail']:
|
||||
if r < IO_VARS['Threshold Graph Fail']:
|
||||
r_color = COLORS['RED']
|
||||
elif r < IO_VARS['Threshold Warn']:
|
||||
elif r < IO_VARS['Threshold Graph Warn']:
|
||||
r_color = COLORS['YELLOW']
|
||||
elif r > IO_VARS['Threshold Great']:
|
||||
elif r > IO_VARS['Threshold Graph Great']:
|
||||
r_color = COLORS['GREEN']
|
||||
|
||||
# Build graph
|
||||
|
|
@ -910,10 +916,25 @@ def run_iobenchmark(ticket_number):
|
|||
TESTS['iobenchmark']['Results'][name] = report
|
||||
|
||||
# Set CS/NS
|
||||
if min(TESTS['iobenchmark']['Data'][name]['Read Rates']) <= IO_VARS['Threshold Fail']:
|
||||
min_read = min(TESTS['iobenchmark']['Data'][name]['Read Rates'])
|
||||
avg_read = sum(
|
||||
TESTS['iobenchmark']['Data'][name]['Read Rates'])/len(
|
||||
TESTS['iobenchmark']['Data'][name]['Read Rates'])
|
||||
dev_rotational = dev['lsblk'].get('rota', None)
|
||||
if dev_rotational == "0":
|
||||
# Use SSD scale
|
||||
thresh_min = IO_VARS['Threshold SSD Min']
|
||||
thresh_high_avg = IO_VARS['Threshold SSD High Avg']
|
||||
thresh_low_avg = IO_VARS['Threshold SSD Low Avg']
|
||||
else:
|
||||
# Use HDD scale
|
||||
thresh_min = IO_VARS['Threshold HDD Min']
|
||||
thresh_high_avg = IO_VARS['Threshold HDD High Avg']
|
||||
thresh_low_avg = IO_VARS['Threshold HDD Low Avg']
|
||||
if min_read <= thresh_min and avg_read <= thresh_high_avg:
|
||||
TESTS['iobenchmark']['Status'][name] = 'NS'
|
||||
elif avg_read <= thresh_low_avg:
|
||||
TESTS['iobenchmark']['Status'][name] = 'NS'
|
||||
elif min(TESTS['iobenchmark']['Data'][name]['Read Rates']) <= IO_VARS['Threshold Warn']:
|
||||
TESTS['iobenchmark']['Status'][name] = 'Unknown'
|
||||
else:
|
||||
TESTS['iobenchmark']['Status'][name] = 'CS'
|
||||
|
||||
|
|
@ -1473,13 +1494,13 @@ def update_io_progress(percent, rate, progress_file):
|
|||
bar_color = COLORS['CLEAR']
|
||||
rate_color = COLORS['CLEAR']
|
||||
step = get_graph_step(rate, scale=32)
|
||||
if rate < IO_VARS['Threshold Fail']:
|
||||
if rate < IO_VARS['Threshold Graph Fail']:
|
||||
bar_color = COLORS['RED']
|
||||
rate_color = COLORS['YELLOW']
|
||||
elif rate < IO_VARS['Threshold Warn']:
|
||||
elif rate < IO_VARS['Threshold Graph Warn']:
|
||||
bar_color = COLORS['YELLOW']
|
||||
rate_color = COLORS['YELLOW']
|
||||
elif rate > IO_VARS['Threshold Great']:
|
||||
elif rate > IO_VARS['Threshold Graph Great']:
|
||||
bar_color = COLORS['GREEN']
|
||||
rate_color = COLORS['GREEN']
|
||||
line = ' {p:5.1f}% {b_color}{b:<4} {r_color}{r:6.1f} Mb/s{c}\n'.format(
|
||||
|
|
|
|||
Loading…
Reference in a new issue