Community discussions

MikroTik App
 
flameproof
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 80
Joined: Tue Sep 01, 2015 3:17 pm

Getting realtime traffic speeds from interface

Tue May 30, 2017 1:40 pm

Hi all,

Trying to get realtime traffic speed on PPPoE interfaces on a CCR, and with /interface/monitor-traffic <interface> I get this:
    name:  <pppoe-661806175A84>
       rx-packets-per-second:                   121
          rx-bits-per-second:              52.9kbps
    fp-rx-packets-per-second:                     0
       fp-rx-bits-per-second:                  0bps
         rx-drops-per-second:                     0
        rx-errors-per-second:                     0
       tx-packets-per-second:                   155
          tx-bits-per-second:             1553.0...
    fp-tx-packets-per-second:                     0
       fp-tx-bits-per-second:                  0bps
         tx-drops-per-second:                     0
        tx-errors-per-second:                     0
As you can see, once speed is above 1000kbps, it shows as 1553.0... which breaks the code used to process this. Can anyone suggest a fix to get up/down speeds without this happening?
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2411
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Getting realtime traffic speeds from interface

Tue May 30, 2017 1:44 pm

Wait, is this with the API or SSH? I ask because your syntax is a mix of the two...

If you're having code that processes this (rather than you simply reading this), consider using the API instead of SSH. The API will (or at least it should) give you all rates in fully readable "bps" values (that is, pure integer values) that you can then process as you see fit.
PEAR2_Net_RouterOS(1.0.0b6) - My API client in PHP
(Rate my posts? If you want... no pressure...)
 
flameproof
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 80
Joined: Tue Sep 01, 2015 3:17 pm

Re: Getting realtime traffic speeds from interface

Tue May 30, 2017 1:52 pm

Thanks - this was a test using SSH before I move the code to use API. I'll test using API then.
 
troffasky
Member
Member
Posts: 405
Joined: Wed Mar 26, 2014 4:37 pm

Re: Getting realtime traffic speeds from interface

Tue May 30, 2017 9:49 pm

If it's true that once speed is above 1000kbps, it shows as 1553.0... then report it to support@

Who is online

Users browsing this forum: No registered users and 19 guests