(tested with rutx11).
Sometimes you want to know how much data your field router has already consumed on a mobile link. T-Mobile (Telekom Deutschland) provides pass.telekom.de as status page and has a handy json output.
If you reach your teltonika remotely, you can periodically fetch the site to produce output like:
Wed Nov 27 17:32:13 CET 2024
used:
32,13 GB
remaining:
3 Tage 06 Std.
This is an example to fetch the json, parse it, store it and be able to serve it locally via http:
A. Create the script vi /etc/telekomdata.sh
:
#!/bin/ash
date
DATA=$(curl -sL http://pass.telekom.de/api/service/generic/v1/status)
echo -e '\nused: '
echo $DATA | jsonfilter -e "@.usedVolumeStr"
echo -e '\nremaining: '
echo $DATA | jsonfilter -e "@.remainingTimeStr"
echo -e '\n\n'
echo $DATA
and make it executable chmod +x /etc/telekomdata.sh
B. Add to crontab, crontab -e
(this is a vi also!)
*/15 * * * * /etc/telekomdata.sh > /www/usage.txt
C. Wait for the quarter to pass and look at http://ip-to-your-teltonika/usage.txt