improve formatting

This commit is contained in:
Cyberes 2023-05-03 12:12:07 -06:00
parent 9f9cef96fe
commit cb9dd021ff
1 changed files with 10 additions and 8 deletions

View File

@ -81,14 +81,16 @@ def main():
try: try:
check_result[name] = { check_result[name] = {
'rate_in': np.average([x['rate_bits_in'] for x in traffic_data]), 'rate_in': np.average([x['rate_bits_in'] for x in traffic_data]),
'rate_out': np.average([x['rate_bits_out'] for x in traffic_data]), 'rate_out': np.average([x['rate_bits_out'] for x in traffic_data]),
'cumulative_in': np.average([x['cumulative_bytes_in'] for x in traffic_data]), 'cumulative_in': np.average([x['cumulative_bytes_in'] for x in traffic_data]),
'cumulative_out': np.average([x['cumulative_bytes_out'] for x in traffic_data]), 'cumulative_out': np.average([x['cumulative_bytes_out'] for x in traffic_data]),
'connections': int(np.average([len(x['details']) for x in traffic_data])) 'connections': int(np.average([len(x['details']) for x in traffic_data]))
} }
except: except Exception as e:
print('Failed to parse traffic data.') print(f'UNKNOWN: Failed to parse traffic data: "{e}"')
print(traceback.format_exc())
print('\nRaw data:')
print(traffic_data) print(traffic_data)
sys.exit(nagios.UNKNOWN) sys.exit(nagios.UNKNOWN)