Hi
how can i get the tx/rx bytes in pppoe interface using php api?
I’m trying to get the information from the radius server.
I tried:
$API->write(‘/ppp/active/getall’,true);
and
$API->write(‘/interface/getall’,true);
but unfortunately I did not get to these values
i’m using ros 5.17+
To get values you need to READ after WRITE
$API->write(‘/ppp/active/getall’,true);
$API->read(true);
and
$API->write(‘/interface/getall’,true);
$API->read(true);
![]()
You also need to add the “stats” argument, i.e.
$API->write('/interface/print', false);
$API->write('=stats=', true);
Can you tell me why this:
$API->write('/ppp/active/getall',false);
$API->write('=stats=', true);
is working great on ros 5.25 and 5.26
but on 6.x i got unknown parameter error ?
bytes read. >>> [26, 8]=message=unknown parameter >>> [5/5] bytes read. >>> [5, 1]!done Array ( [!trap] => Array ( [0] => Array ( [message] => unknown parameter ) ) )
Maybe getall is no longer really an alias for print… I mean, it should be, but still…
Try to use
/ppp/active/print
instead of
/ppp/active/getall
nope, still message=unknown parameter >>> error ![]()
Sounds like you haven’t completed a previous sentence.
Could you show a more complete piece of your code please? (everything after the connect() should do)
my code
if ($API->connect("$ip", "$usr", "$pass")) {
$API->write('/ppp/active/getall',false);
$API->write('=stats=', true);
$data = $API->read();
.....
}
works fine with 5.25 and 5.26
my error msg:
Connection attempt #1 to xxxxxxxxxxx… <<< [6] /login >>> [5/5] bytes read. >>> [5, 39]!done >>> [37/37] bytes read. >>> [37, 1]=ret=1a87af6eabea149d3b41ae8811133f6a <<< [6] /login <<< [11] =name=adm <<< [44]
=response=00adac1f5fe89efae02e >>> [5/5] bytes read. >>> [5, 1]!done Connected… <<< [23]
/system/identity/getall >>> [3/3] bytes read. >>> [3, 28]!re >>> [19/19] bytes read. >>> [19, 8]=name=My_PPPoE >>> [5/5] bytes read. >>> [5, 1]!done <<< [18] /ppp/active/getall <<< [7] =stats= >>> [5/5] bytes read. >>> [5, 35]!trap >>> [26/26] bytes read. >>> [26, 8]=message=unknown parameter >>> [5/5] bytes read. >>> [5, 1]!done Array ( [!trap] => Array ( [0] => Array ( [message] => unknown parameter ) ) ) My_PPPoE - 1 | Disconnected…
Where’s the “/system/identity/getall” call in your PHP code?
Also… Which 6 version? 6.20?
(I want to actually try whichever one it is on a VM, to rule out a RouterOS bug…)
thats my full code (i commented out the first two lines)
if ($API->connect("$ip", "$usr", "$pass")) {
//$API->write('/system/identity/getall',true);
//$rb_name = $API->read();
$API->write('/ppp/active/getall',false);
$API->write('=stats=', true);
$data = $API->read();
.....
}
tested on 6.15 and 6.18
thx for help!
Sorry I took so long (had some problems with VirtualBox…).
Now… I’ve tested this with 6.19, and it appears that somewhere after 6.9, the “stats” argument was removed from the “/ppp active” menu in general. I don’t know at which version though… 6.9 is merely the earliest one I have access to, since it’s a real router that I have, and it’s there.
Maybe try using just “detail” instead of stats?
(I don’t have any actual active connections on the VM to tell you if this would give you the rx/tx bytes, but the argument is certainly still there)
If that doesn’t work, then you should write support, and report this as a bug.
Ok, I’m Try tomorrow.
Yesterday i upgraded one of my ccr to 6.20
I’ll check if i Got the same problem on 6.20
hey @boen_robot any new on this one?
Is there any other way to display pppoe transfers?
with this one:
$API->write('/ppp/active/getall',false);
$API->write('=stats=', true);
i’m still getting:
done Connected... <<< [18] /ppp/active/getall <<< [7] =stats= >>> [5/5] bytes read. >>> [5, 35]!trap >>> [26/26] bytes read. >>> [26, 8]=message=unknown parameter >>> [5/5] bytes read. >>> [5, 1]!done - 1 | Disconnected...
how can i achieve this witj your API?
Like I said last time, write to support about that. - support@mikrotik.com if you need reminding. You need a way to get that from the command line at the very least.
Once you find a working way to do it from the command line, translating that way to the API (be it mine or Denis Basta’s) is easy.
I tried this:
$API->write('/interface/getall',false);
$API->write('=stats=', true);
and i almost got what I need, Unfortunately, I had recive only the names of the physical interfaces, pppoe interface names vere empty:
for physical interface:
[31, 2792]=name=ether1_lk_RB5 >>> [20/20] bytes read. >>> [20, 2771]=default-name=ether1 >>> [11/11] bytes read. >>> [11, 2759]=type=ether >>> [9/9] bytes read. >>
for pppoe:
.id=*F1ADBC >>> [34/34] bytes read. >>> [34, 2236]=name= >>> [14/14] bytes read. >>> [14, 2221]=type=pppoe-in >>