Improve PSI files validation (fix #74)

This commit is contained in:
Alexey Avramov
2020-01-02 00:14:15 +09:00
parent 93e16e084a
commit d563565a2a
3 changed files with 51 additions and 6 deletions

View File

@@ -73,8 +73,12 @@ else:
psi_support = os.path.exists(psi_path)
if not psi_support:
print('PSI is not supported, /proc/pressure/memory does not exist. Exit.')
try:
psi_path_to_metrics(psi_path)
except Exception as e:
print('ERROR: {}'.format(e))
print('PSI metrics are not provided by the kernel. Exit.')
exit(1)

View File

@@ -193,9 +193,12 @@ if log_file is not None:
log('log file: {}'.format(log_file))
if not os.path.exists('/proc/pressure'):
log('ERROR: /proc/pressure does not exist, PSI is not supported, exit')
exit()
try:
psi_file_mem_to_metrics('/proc/pressure/memory')
except Exception as e:
print('ERROR: {}'.format(e))
print('PSI metrics are not provided by the kernel. Exit.')
exit(1)
if target == 'SYSTEM_WIDE':