import json def count_clients(data): # print("Counting Traffic...") return len(data) def count_traffic(data): ret_val = 0 for x in data: ret_val=ret_val+x["wgDin"] # print(ret_val) # ret_val = 1000*1000*1000*100 return ret_val def count_connection(data): i = 0 for x in data: if x["wgStatus"]=="true": i = i + 1 return i def count_percentage(data): i = 0 for x in data: if x["wgDin"]!=0: i = i + 1 return i def count_broken(data): i = 0 for x in data: if x["wgDin"]<1 or x["wgDout"]<0: i = i + 1 return i