subscribe to our Youtube


14455 questions

17168 answers


0 members

We are migrating to our new platform at Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
234 views 0 comments
by anonymous
I have tried different methods to retreive mobile data usage of RUT devices, but I can't get any of the methods to match "Mobile usage" in the GUI.
Methods tried:
* "ubus call mdcollect get '{"iface_name":"wwan0","conn_period":"month","sim":1}' "
  - stats seem off. Hardly any diff between day, week, month.
* SNMP polls of OID . & .
  - stats seem to be somewhat correct, but sometimes I get negative values. (could be that the counters reset to 0)
* Modbus reads to register 186 & 188
  - Data is there and increasing, but seems very off compared to what is seen in the GUI

What would be the simplest way of collecting the correct data?

1 Answer

0 votes
by anonymous


ubus call should be the best way to retrieve consumed mobile data, as it gets information from mdcollect database. Mobile usage displayed in the WebUI is obtained by mdcollect as wellIt has a slightly different structure, than the one you have used:

  • "get":{"period":"String","iface":"String","sim":"Integer","modem":"String","current":"Boolean"}

For example:

  • ubus call mdcollect get '{"period":"day","iface":"mob1s1a1","sim":"1", "current":True}'

According to internal documentation, when current is set to be true, current period is returned (eg. current week).

Collected mobile data can also be read with the following:

  • cat /proc/net/xt_quota/rx_wwan0
  • cat /proc/net/xt_quota/tx_wwan0

Various mobile data counters can be found in the files contained in a directory below, but this is a different method, thus, discrepancies are possible:

  • /sys/class/net/wwan0/statistics/

Data from here is used by ifconfig command.

Best regards,