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
414 views 2 comments
by anonymous
Hi team,

We can query modbus values from a PC using the modbus-cli following this guide https://wiki.teltonika-networks.com/view/RUTX11_Monitoring_via_Modbus.

We have a USB drive mounted on the router and we want to log the modbus values to a file for analysis. We shutdown the router often and need these values captured to a file.

There are options to send these values to a sink via https://wiki.teltonika-networks.com/view/RUTX11_Data_to_Server is there a similar config somewhere to log to a file?

Thanks

Yudi

1 Answer

0 votes
by anonymous

Hello,

For your case, you would need to employ a script. An example script of reading device's time and writing it to data file every 10 seconds is below:

#!/bin/ash
while [ 1 ]; do
echo  $(modbus_tcp_test 192.168.1.1 502 5 1 3 1 2 32bit_uint1234 1) >> /tmp/data.txt
sleep 10
done

Keep in mind that RUTX11 must have Services -> MODBUS- > MODBUS TCP slave service enabled.

You could also employ Crontabs for periodic data reading.

The syntx of modbus_tcp_test is the following: modbus_tcp_test IP PORT TIMEOUT SLAVE_ID FUNCTION REG_ADDRESS REG_COUNT/VALUE(S) DATA_TYPE NO_BRACKETS

Best regards,

Best answer
by anonymous
Thanks for the quick reply.

Will try it out.

where can I find more information about "modbus_tcp_test"?
by anonymous

There is not much documentation about this application. It is also used in the WebUI, for Request configuration testing in Services -> Modbus -> MODBUS TCP master.

If you type modbus_tcp_test in the CLI/SSH, you will get the same order of arguments you have to enter, as written above, and, additionally, a list of supported data types.