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
331 views 0 comments
by anonymous
I have a mobile unit which has a RUT240 which provides internet access. I would like for the mobile unit to communicate with my main backend about its connection, so I need to gather some information about the router from the mobile unit. What's the best way to do this? Also, how do I gather information such as current connection type (wifi or mobile), latency to some target, signal strength, last time it used a fallback. If it is possible to force a change in connection type or to give it connection details to a wifi network, that would also be useful to have done from the mobile unit rather than the web GUI. Mobile unit is a computer so any communication must be CLI-based.

1 Answer

0 votes
by anonymous

Hello,

There is no unified way to gather data of the points you have you have mentioned, thus, it really depends on what you specifically require.

You could enquire current main WAN connection by querying the interface to reach some remote host. For example:

  • ip route get 8.8.8.8
or simply evaluate routing table metrics
  • ip route

To get mobile signal levels you can use the following command (firmware 7.3 and above):

  • gsmctl -q

Generally, in terms of device data monitoring and management you could use ubus calls. There is no documentation on this, at least from Teltonika side, but it is similar to what OpenWRT provides in this link.

Below I will provide some generalized instructions on how to use/navigate ubus.

to list all of the available services enter the command below:

  • ubus list

Next, to find the details on possible procedures in regards to a specific service from the list, use the following syntax. For example I want to get failover configuration details and currently used WAN interface, I need procedures related tomwan3 application, responsible for failover::

  • ubus -v mwan3

It gives: 

"status":{"section":"String","interface":"String","policies":"String"}

To use this data, I need to enter the following command

  • ubus call mwan3 status

The idea is to replace -v list with call and add one of the listed procedures after the process. The output will list many details about failover interfaces and configuration. 

For another example, I want details about wireless interface procedures:

  • ubus -v list network.wireless

This outputs the following:

        "up":{}
        "down":{}
        "reconf":{}
        "status":{}
        "notify":{}
        "get_validate":{}
Let's say I'm interested in wireless interface details, the command would be:
  • ubus call network.wireless status
Another command below will return wireless interface details too, as well as results of wireless client details:
  • ubus call vuci.network.wireless wifi_interface_status

Following a similar logic, you can find details and statistics for wireless clients with the command:

  • ubus call hostapd.wlan0 get_clients

Mobile data usage statistics for a day:

  • ubus call mdcollect get '{"period":"day","iface_name":"wwan0","sim":1,"modem":1,"current":True}'

Mobile signal metrics:

  • ubus call gsm.modem0 get_signal_query

To change main interface, you could use uci commands to configure failover interface metrics:

To list all available currently configured settings simply enter:

  • uci show

Since the list is extensive, to target failover configuration use:

  • uci show mwan3 

Change metrics by (actual option names might differ based on your configuration):

  • uci set mwan3.mob1s1a1_member_mwan.metric='<integer>'
  • uci set mwan3.Wi_Fi_member_mwan.metric='<integer>'
To execute changes enter:
  • uci commit

Best regards,