How can I retrieve network traffic per second?

Is there a library, preferably cross platform, that can give me network in/out bytes per second?
I don’t mind if it retrieves the OS numbers or Erlang VM numbers

1 Like

systat -ifstat 1 produces something like this

                    /0   /1   /2   /3   /4   /5   /6   /7   /8   /9   /10
     Load Average   |||

      Interface           Traffic               Peak                Total
            xn0  in      2.497 KB/s         28.860 KB/s           15.930 GB
                 out     0.000 KB/s          0.000 KB/s            0.000 KB

            lo0  in      0.000 KB/s          0.000 KB/s          851.549 KB
                 out     0.000 KB/s          0.000 KB/s          851.549 KB

Thats not cross platform, or at least it requires to install a not further named software on my windows box.

Aside of that:

Network handling is far too different on operating systems, so it is really hard to retrieve that numbers from the OS in a generic way. Also BEAM does not differ between disk, terminal and network IO AFAIK, so you can’t retrieve the numbers from the BEAM as well.

1 Like

I know these things, that’s the reason I was hoping there is a good library where someone has solved all the different ways.

1 Like