OpenWrt Forum Archive

Topic: Where does LuCI get RX bytes for every interface?

The content of this topic has been archived on 29 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello,

I'm a beginner developer so I'm not used to that kind of things.
For a project of mine I need to know the byte count for an interface. I see LuCI is capable of this but I can't really find how nor where it's doing it, I'd use it as an example for my goal. Can you link me the code which is getting the byte count?
Thank you!

(Last edited by livingsilver94 on 11 Mar 2017, 22:00)

I'm certain there's a more elegant way which you can discover if you look at the luci code, but I think you can accomplish the same result by screen-scraping ifconfig.

Thanks for the hint, I haven't thought of such a simple solution.
Fortunately, with a search based on your suggestion, I found the magical world of /proc/dev/net (cannot link the source. Bummer). Pretty useful and easy to parse.
By the way, for the sake of curiosity, my original question is still open wink

The discussion might have continued from here.