FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
2,364 views 4 comments
by
Hi all,

I have some RUT955 units, I need to be able to read the bytes sent/received from a linux/python based device attached to the router.  Does anyone know a way to do this, MODBUS documents don't show this data as available through that route.

Thanks

1 Answer

+1 vote
by

Hi,

Do you need sent/received data from mobile network? Or you need to count data which was generated between router and "linux/python based device "?

Best answer
by

If you want to get data from router mobile WAN, then please check Wiki:

https://wiki.teltonika.lt/index.php?title=Monitoring_via_JSON-RPC#Getting_router_parameters_2

gsmctl

usage: gsmctl OPTIONS

   -e, --bsent <INTERFACE>       Get number of bytes sent

  -r, --brecv <INTERFACE>       Get number of bytes recieved

by
Hi, thanks for reading the question :-)

I need to get the mobile data.

For info the devices are Rasp Pis.

Had a play with using web-scraping to get the data off the routers built in web page but as my pis are headless and running only the CLI  I'm having trouble as the webpages are Java based and I can't render them without Xwindows.  I don't really want to have to go to xvfm/selenium etc just to get 2 numbers, the rest of the code on the Pis is running under Python2.7.
by
Typical, I typed my comment and submitted, then the JSON answer arrived.  Thats great I'll give it a go, thanks
by

Ok, nearly there, have the curl working to get session ID and pass that to the next command, how do i structure the gsmctl part of the command to get the data (highlighted does not work). I have it working to get the RSSI as per the example but can't grasp how to format the last bit

SUCCESS.. The following works with -e for the other value

curl -d "{ \"jsonrpc\": \"2.0\", \"id\": 1, \"method\": \"call\", \"params\": [\"a74c8e07646f0da2bfddce35bf3de1f3\", \"file\", \"exec\", { \"command\":\"gsmctl\", \"params\": [\"-r\", \"wwan0\"] } ] }" http://192.168.1.1/ubus
Thanks folks 
yes