improve formatting
This commit is contained in:
parent
9f9cef96fe
commit
cb9dd021ff
|
@ -81,14 +81,16 @@ def main():
|
|||
|
||||
try:
|
||||
check_result[name] = {
|
||||
'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]),
|
||||
'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]),
|
||||
'connections': int(np.average([len(x['details']) for x in traffic_data]))
|
||||
}
|
||||
except:
|
||||
print('Failed to parse 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]),
|
||||
'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]),
|
||||
'connections': int(np.average([len(x['details']) for x in traffic_data]))
|
||||
}
|
||||
except Exception as e:
|
||||
print(f'UNKNOWN: Failed to parse traffic data: "{e}"')
|
||||
print(traceback.format_exc())
|
||||
print('\nRaw data:')
|
||||
print(traffic_data)
|
||||
sys.exit(nagios.UNKNOWN)
|
||||
|
||||
|
|
Loading…
Reference in New Issue