File tree Expand file tree Collapse file tree
network/netstats/python_modules Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import sys
22import re
33import time
4+ import copy
45
56PARAMS = {}
67
1314tcpext_file = "/proc/net/netstat"
1415snmp_file = "/proc/net/snmp"
1516
16- LAST_METRICS = dict (METRICS )
17+ LAST_METRICS = copy . deepcopy (METRICS )
1718METRICS_CACHE_MAX = 5
1819
1920stats_pos = {}
@@ -188,10 +189,10 @@ def get_metrics():
188189 if re .match ("TcpExt: [0-9]" , line ):
189190 metrics = re .split ("\s+" , line )
190191
191- file .close
192+ file .close ()
192193
193194 # update cache
194- LAST_METRICS = dict (METRICS )
195+ LAST_METRICS = copy . deepcopy (METRICS )
195196 METRICS = {
196197 'time' : time .time (),
197198 'tcpext' : metrics
@@ -216,7 +217,7 @@ def get_metrics():
216217 METRICS ['tcp' ] = re .split ("\s+" , line )
217218
218219
219- file .close
220+ file .close ()
220221
221222 return [METRICS , LAST_METRICS ]
222223
You can’t perform that action at this time.
0 commit comments