Hi.. its possible to do torch via APi?
yes, something along these lines:
/tool/torch
=interface=ether2
result looks like this:
!re
=tx=4104
=rx=1904
=tx-packets=5
=rx-packets=3
!re
=tx=4104
=rx=1904
=tx-packets=5
=rx-packets=1904
!re
=tx=3536
=rx=3120
=tx-packets=4
=rx-packets=4
adding more parameters will expand the output.
I used
/tool/torch
=interface=
but doesn’t work… on mikrotik api php
what was the result of the command (actual output returned by the router on command?
nothing… dont return anything…
it should return at least !re or !trap if some settings are not correctly sent.
if there are no return mean, that your command itself is not complete and RouterOS expects trailing 0x00.
Check you have current version installed, this is one that i tried this on.
My Code
$API->write('/tool/torch');
$API->write("=interface=<pppoe-$UserName>");
$ARRAY= $API->read(false);
print_r($ARRAY);
now its working… but look the return
Array
(
[0] => !trap
[1] => =message=no such command prefix
[2] => !done
[3] => !trap
[4] => =message=failure: interface not up and running
[5] => !done
)
I’m on mikrotik… and the pppoe works
/tool torch interface=<pppoe-teste>
the return
TX RX TX-PACKETS RX-PACKETS
0bps 360bps 0 1
0bps 360bps 0 1
apparently there is no such interface named
$API->write("=interface=<pppoe-$UserName>");
torch works fine as long as there is traffic passing through the link
/tool/torch
=interface=<pppoe-uuu>
and this is the output:
!re
=tx=448
=rx=448
=tx-packets=1
=rx-packets=1
!re
=tx=448
=rx=448
=tx-packets=1
=rx-packets=1
!re
=tx=448
=rx=448
=tx-packets=1
=rx-packets=1
just pinging the other end
if I execute this line on mikrotik… it works
/tool/torch
=interface=<pppoe-teste>
but… if I execute this on API… show the message
Array
(
[0] => !trap
[1] => =message=failure: interface not up and running
[2] => !done
)
Why by the mikrotik works? and API don’t?
On mikrotik in /ip services, the API its allowed.
check what command exactly is being sent to the router. At this moment i had enabled and working pppoe interface and torch returned valid data.
try to set exact interface name in the command, not substitute value.
how to check in mikrotik the command that was sent?
use /tool sniffer on the router filter for connection ip addresses and API port.
ok…
I set
/tool sniffer
set filter-address1=0.0.0.0/0:8728
but don’t shows anything…
if you use 5.7 then use this:
/tool sniffer set filter-port=8728
/tool sniffer start
or
/tool sniffer quick port=8728
Hi.. my version is 5.6
my mikrotik don’t have
/tool sniffer set filter-port=8728
and don’t have too /tool sniffer quick port=8728
=S
then maybe update?
all my replies are checked on 5.7 ppc (powerpc) or mipsbe board.
ok…
now its 5.7 version…
on log shows conected on api…
but on sniffer i’m not getting nothing..
that mean that you have wrong sniffer settings. anyway, from your previous posts you had wrong value for .id attribute that is why you got the message you where getting and no result.
I get to use the sniffer, and I see some connections with api port… but don’t have any information about the commands sent to mikrotik via api
you should look into packet contents. Sniffer is general tool to capture and check header information, packet content etc.