Salva anche l counter dati per ogni interfaccia
This commit is contained in:
@@ -49,14 +49,12 @@ def main() -> int:
|
|||||||
hw_stats: dict[str,str] = convertInt(api.get_resource('/system/resource').call('print', {'proplist':'uptime,cpu-load,total-memory,free-memory'})[0])
|
hw_stats: dict[str,str] = convertInt(api.get_resource('/system/resource').call('print', {'proplist':'uptime,cpu-load,total-memory,free-memory'})[0])
|
||||||
hw_stats['temperature'] = convertInt(api.get_resource('/system/health').call('print')[1])['value']
|
hw_stats['temperature'] = convertInt(api.get_resource('/system/health').call('print')[1])['value']
|
||||||
# Calcolo della velocita' interfaccia a ogni ciclo
|
# Calcolo della velocita' interfaccia a ogni ciclo
|
||||||
for n, d in enumerate(if_stats):
|
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]['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]['tx-rate'] = int((if_stats[n]['tx-bytes']-if_stats_old[n]['tx-bytes'])/(now-last))
|
||||||
if_points.append(
|
if_points.append(
|
||||||
Point('interfaces')
|
dict2Point('interfaces', if_stats[n], {'interface': if_name})
|
||||||
.tag('interface', d['name'])
|
|
||||||
.field('rx-rate', if_stats[n]['rx-rate'])
|
|
||||||
.field('tx-rate', if_stats[n]['tx-rate'])
|
|
||||||
)
|
)
|
||||||
write_client.write(record=if_points)
|
write_client.write(record=if_points)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user