mirror of
https://github.com/swizzin/swizzin_dashboard.git
synced 2024-09-20 14:56:08 +08:00
Truncate tops reporting to 10 and fix units with jsonversion 2
This commit is contained in:
parent
93a1157470
commit
219e29dbcb
|
@ -269,14 +269,14 @@ def vnstat(user):
|
|||
#statsa = vnstat_parse(interface, "m", "total", 0)
|
||||
tops = vnstat_data(interface, "t")['interfaces'][0]['traffic'][qt]
|
||||
top = []
|
||||
for t in tops:
|
||||
for t in tops[:10]:
|
||||
date = t['date']
|
||||
year = date['year']
|
||||
month = calendar.month_abbr[date['month']]
|
||||
day = date['day']
|
||||
date = "{month} {day}, {year}".format(year=year, month=month, day=day)
|
||||
rx = GetHumanReadableKB(t['rx'])
|
||||
tx = GetHumanReadableKB(t['tx'])
|
||||
rx = read_unit(t['rx'])
|
||||
tx =read_unit(t['tx'])
|
||||
top.append({"date": date, "rx": rx, "tx": tx})
|
||||
columns = {"date", "rx", "tx"}
|
||||
#stats = []
|
||||
|
|
Loading…
Reference in a new issue