Skip to content
Browse files

fix ethernet monitoring when interface name is more that 6 chars long (

TSUN-38).  (bug reported by Marco Nijdam)

SVN Revision: 745
  • Loading branch information...
1 parent c49fb0d commit cc73156a7645abe7a2753fe71f9a5f69b5f05d53 @nniclausse nniclausse committed Aug 24, 2007
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/tsung_controller/ts_os_mon.erl
View
8 src/tsung_controller/ts_os_mon.erl
@@ -342,11 +342,13 @@ get_os_data(packets, _OS) ->
%% packets Linux, special case with File as a variable to easy testing
get_os_data(packets, {unix, linux},File) ->
- %% get the cumulative traffic of all ethX interfaces
{ok, Lines} = ts_utils:file_to_list(File),
- Eth = [io_lib:fread("~6s:~d~d~d~d~d~d~d~d~d~d", X) || X<-Lines, string:str(X,"eth") /= 0],
+ %% get the cumulative traffic of all ethX interfaces
+ Eth=[io_lib:fread("~d~d~d~d~d~d~d~d~d~d", X) ||
+ {E,X}<-lists:map(fun(Y)->ts_utils:split2(Y,$:,strip) end ,Lines),
+ string:str(E,"eth") /= 0],
Fun = fun (A, {Rcv, Sent}) ->
- {ok,[_,_RcvBytes,RcvPkt,_,_,_,_,_,_,_SentBytes,SentPkt],_}=A,
+ {ok,[_RcvBytes,RcvPkt,_,_,_,_,_,_,_SentBytes,SentPkt],_}=A,
{Rcv+RcvPkt,Sent+SentPkt}
end,
lists:foldl(Fun, {0,0}, Eth).

0 comments on commit cc73156

Please sign in to comment.
Something went wrong with that request. Please try again.