Hi,
i need some help with mikrotik scripting. I want to telnet to a modem (i can unfortunately not use ssh, because it is not supported) and run a command there and use the output to fill some variables to set download/upload rates in simple queues.
On linux i tried the following, which is working:
#!/bin/bash
(
echo "admin";
sleep 1
echo "mypass";
sleep 1;
echo -e "adsl info --stats\r";
sleep 3;
echo -e "exit\r"
) | telnet 192.168.1.1 | tee log.txt
That gives me some output like this, that i can grep and manipulate further to extract the needed data:
log.txt:
> adsl info --stats
adsl: ADSL driver and PHY status
Status: Showtime
Last Retrain Reason: 8000
Last initialization procedure status: 0
Max: Upstream rate = 2236 Kbps, Downstream rate = 15764 Kbps
Bearer: 0, Upstream rate = 1739 Kbps, Downstream rate = 14160 Kbps
...
Is there some way to interactive telnet to the modem with my mikrotik router via script and get the adslinfo from the modem to fill two variables with the “Bearer: 0 Upstream rate and Downstream rate”, which i can use then to set the rates in simple queues?
Simple queues look like this at the moment for me, i would also set the downstream limit and some more queues if i have the excact information.
/queue simple
add dst=pppoe.dsl max-limit=2100k/0 name=pppoe.dsl packet-marks=no-mark queue=default/default target=ether1-master-local
add dst=pppoe.dsl max-limit=2100k/0 name=pppoe.dsl_prio packet-marks=prio_packet priority=2/2 queue=default/default target=ether1-master-local
I am totally lost with mikrotik scripting and any help would be very appreciated.
Thanks in advance
Reiner