Community discussions

 
erkan1525
just joined
Topic Author
Posts: 7
Joined: Sat Nov 12, 2016 3:04 pm

Get pppoe in interface

Thu Sep 14, 2017 5:59 pm

Hi masters.
I have a microtic router. This includes pppoe-server. My clients connect to the internete here. I can view the details of a customer in the interface section as follows.
Image

As I pointed out in the picture, it is possible to read where the customer is connected via the interface.

But... :put [/ interface get 30] does not have interface information on output when I run command. The output is as follows.

.id=*f00adc;actual-mtu=1480;disabled=false;dynamic=true;fast-path=true;fp-rx-byte=243361091;fp-rx-packet=1866233;fp-tx-byte=0;fp-tx-packet=0;last-link-up-time=sep/14/2017 05:16:38;link-downs=0;mtu=1480;name=;running=true;rx-byte=243361091;rx-drop=0;rx-error=0;rx-packet=1866233;tx-byte=3654480301;tx-drop=0;tx-error=0;tx-packet=2755483;type=pppoe-in

There is no interface information here. How can I get the knowledge of the interface.
 
User avatar
PaulsMT
MikroTik Support
MikroTik Support
Posts: 282
Joined: Tue Feb 10, 2015 3:21 pm

Re: Get pppoe in interface

Fri Sep 15, 2017 9:40 am

You can use PPPoE server monitor command to see this value in CLI:
/interface pppoe-server monitor <pppoe-user> once do={:put $"interface"}

And store it in the global variable
/interface pppoe-server monitor <pppoe-user> once do={:global i $"interface"}
 
erkan1525
just joined
Topic Author
Posts: 7
Joined: Sat Nov 12, 2016 3:04 pm

Re: Get pppoe in interface

Mon Nov 06, 2017 5:22 pm

is it possible to run this code with the php API and get the output?
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2370
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: Get pppoe in interface

Mon Nov 06, 2017 9:54 pm

Sure:
<?php
use PEAR2\Net\RouterOS;

require_once 'PEAR2_Net_RouterOS-1.0.0b6.phar';

$client = new RouterOS\Client('192.168.88.1', 'admin', 'password');

$request = new RouterOS\Request('/interface pppoe-server monitor');
$request->setArgument('numbers', '<pppoe-user>')->setArgument('once');

////Or if you are not accepting user input, you can also just use
//$request = new RouterOS\Request('/interface pppoe-server monitor numbers="<pppoe-user>" once');

$response = $client->sendSync($request);
echo $response->getProperty('interface'); 
PEAR2_Net_RouterOS(1.0.0b6) - My API client in PHP
(Rate my posts? If you want... no pressure...)
 
erkan1525
just joined
Topic Author
Posts: 7
Joined: Sat Nov 12, 2016 3:04 pm

Re: Get pppoe in interface

Mon Nov 20, 2017 8:39 am

Sure:
<?php
use PEAR2\Net\RouterOS;

require_once 'PEAR2_Net_RouterOS-1.0.0b6.phar';

$client = new RouterOS\Client('192.168.88.1', 'admin', 'password');

$request = new RouterOS\Request('/interface pppoe-server monitor');
$request->setArgument('numbers', '<pppoe-user>')->setArgument('once');

////Or if you are not accepting user input, you can also just use
//$request = new RouterOS\Request('/interface pppoe-server monitor numbers="<pppoe-user>" once');

$response = $client->sendSync($request);
echo $response->getProperty('interface');
Thank you masters...

Who is online

Users browsing this forum: No registered users and 4 guests