Fid data rate calculation
This commit is contained in:
@@ -51,8 +51,8 @@ def main() -> int:
|
||||
# Calcolo della velocita' interfaccia a ogni ciclo
|
||||
for n, _ in enumerate(if_stats):
|
||||
if_name = if_stats[n].pop('name')
|
||||
if_stats[n]['rx-rate'] = int((if_stats[n]['rx-bytes']-if_stats_old[n]['rx-bytes'])/(now-last))
|
||||
if_stats[n]['tx-rate'] = int((if_stats[n]['tx-bytes']-if_stats_old[n]['tx-bytes'])/(now-last))
|
||||
if_stats[n]['rx-rate'] = int((if_stats[n]['rx-bytes']-if_stats_old[n]['rx-bytes'])/(INTERVAL))
|
||||
if_stats[n]['tx-rate'] = int((if_stats[n]['tx-bytes']-if_stats_old[n]['tx-bytes'])/(INTERVAL))
|
||||
if_points.append(
|
||||
dict2Point('interfaces', if_stats[n], {'interface': if_name})
|
||||
)
|
||||
@@ -63,10 +63,9 @@ def main() -> int:
|
||||
|
||||
# Salvo ultimo punto per il giro successivo
|
||||
if_stats_old = if_stats
|
||||
last = time.time()
|
||||
LOGGER.debug(f"\nInterfaces: {json.dumps(if_stats, indent = 2)}")
|
||||
LOGGER.debug(f"\nResources: {json.dumps(hw_stats, indent = 2)}")
|
||||
time.sleep(INTERVAL)
|
||||
time.sleep(INTERVAL-(last-now))
|
||||
except Exception as e:
|
||||
print(f"Unexpected exception: [{e}]")
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user