Fixed: net_io_counters() not iterating over itself

pull/27/head
aristocratos 2020-08-03 19:42:09 +02:00
parent 896828819c
commit ebbc25dc3d
1 changed files with 1 additions and 1 deletions

View File

@ -2714,7 +2714,7 @@ class NetCollector(Collector):
errlog.exception(f'{e}') errlog.exception(f'{e}')
if not io_all: return if not io_all: return
up_stat = psutil.net_if_stats() up_stat = psutil.net_if_stats()
for nic in sorted(psutil.net_if_addrs(), key=lambda nic: (getattr(io_all.get(nic), "bytes_recv", 0) + getattr(io_all.get(nic), "bytes_sent", 0)), reverse=True): for nic in sorted(io_all.keys(), key=lambda nic: (getattr(io_all[nic], "bytes_recv", 0) + getattr(io_all[nic], "bytes_sent", 0)), reverse=True):
if nic not in up_stat or not up_stat[nic].isup: if nic not in up_stat or not up_stat[nic].isup:
continue continue
cls.nics.append(nic) cls.nics.append(nic)