Correct total calculation in data dict

master
Nixellion 2020-07-20 03:11:07 +03:00
parent 34cfe3cf51
commit e7daf11d72
2 changed files with 30 additions and 2 deletions

20
copy_paste_address.py Normal file
View File

@ -0,0 +1,20 @@
import routeros_api
from configuration import read_config
config = read_config()
secrets = read_config("secrets")
def cp():
connection = routeros_api.RouterOsApiPool(config['ros_ip'], username=secrets["ros_login"],
password=secrets["ros_password"], plaintext_login=True)
api = connection.get_api()
filter = api.get_resource('/ip/firewall/filter')
for i in filter.get():
if config['ros_fasttrack_comment'] in i['comment']:
filter.set(id=i['id'], disabled=disabled)
connection.disconnect()
def pst():
pass

View File

@ -351,10 +351,18 @@ def threaded_wan_speed():
data_dict['wan_downloads'] = {}
data_dict['wan_uploads'] = {}
data_dict['wan_downloads']['total'] = 0
data_dict['wan_uploads']['total'] = 0
for key, value in downloads.items():
if key != 'total':
data_dict['wan_downloads'][key] = max(value)
data_dict['wan_downloads']['total'] += data_dict['wan_downloads'][key]
for key, value in uploads.items():
if key != 'total':
data_dict['wan_uploads'][key] = max(value)
data_dict['wan_uploads']['total'] += data_dict['wan_uploads'][key]
log.info(f"Monitor result: {mbits(wan_download)} mbps; {mbits(wan_upload)} mbps;")