Skip to content

Commit 7033771

Browse files
committed
Update iface.py to fix the error of Interface name
Sometimes, 'bytes' after 'Interface' are too long, and there is no space between 'Interface' and 'bytes'. For example, in my /proc/net/dev there is one line begin with 'eth0:137719774170', and the iface will be identified as 'eth0:137719774170'.
1 parent 67f1378 commit 7033771

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

network/iface/python_modules/iface.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def update_metric(self):
8080

8181
for line in f:
8282
if re.search(':', line):
83-
tokens = re.split('\s+', line.strip())
83+
tokens = re.split('[:\s]+', line.strip())
8484
iface = tokens[0].strip(':')
8585

8686
self.metric.update({
@@ -151,7 +151,7 @@ def metric_init(params):
151151

152152
for line in f:
153153
if re.search(':', line):
154-
tokens = re.split('\s+', line.strip())
154+
tokens = re.split('[:\s]+', line.strip())
155155
iface = tokens[0].strip(':')
156156

157157
for way in ('tx', 'rx'):

0 commit comments

Comments
 (0)