MCPcopy Create free account
hub / github.com/cppla/ServerStatus / liuliang

Function liuliang

clients/client-linux.py:136–152  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

134 return round(result, 1)
135
136def liuliang():
137 NET_IN = 0
138 NET_OUT = 0
139 with open('/proc/net/dev') as f:
140 for line in f.readlines():
141 netinfo = re.findall(r'([^\s]+):[\s]{0,}(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)', line)
142 if netinfo:
143 if netinfo[0][0] == 'lo' or 'tun' in netinfo[0][0] \
144 or 'docker' in netinfo[0][0] or 'veth' in netinfo[0][0] \
145 or 'br-' in netinfo[0][0] or 'vmbr' in netinfo[0][0] \
146 or 'vnet' in netinfo[0][0] or 'kube' in netinfo[0][0] \
147 or netinfo[0][1]=='0' or netinfo[0][9]=='0':
148 continue
149 else:
150 NET_IN += int(netinfo[0][1])
151 NET_OUT += int(netinfo[0][9])
152 return NET_IN, NET_OUT
153
154def tupd():
155 '''

Callers 1

client-linux.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected