Community discussions

MikroTik App
 
David1234
Forum Guru
Forum Guru
Topic Author
Posts: 1424
Joined: Sun Sep 18, 2011 7:00 pm

how to get interface status on API?

Fri Mar 24, 2017 3:41 pm

Hello ,
can someone help me find out the command for know if the interface is enable\disable running?
so I can show it ?
for example want to know if my ppp-out1 is running (true \ false)
and also if ppp-out1 is enable \ disable ?

Thanks , ,
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: how to get interface status on API?

Fri Mar 24, 2017 6:08 pm

"/interface/print"
and check the "disabled" property. It is the string "true" if the interface is disabled, or the string "false" if it is enabled.

There is also a separate property called "running", which is also either the strings "true" or "false", depending on whether the interface is running or not, since it's possible for an interface to be enabled but not running (e.g. cable unplugged, or an AP client Wi-Fi that is not connected).
 
David1234
Forum Guru
Forum Guru
Topic Author
Posts: 1424
Joined: Sun Sep 18, 2011 7:00 pm

Re: how to get interface status on API?

Sun Mar 26, 2017 8:25 pm

this is what I get when I do "Interface/print"
.id=*1;actual-mtu=1500;comment=;l2mtu=1526;mac-address=22:09:42:6F:46:EC;name=ethe
r1;type=ether;.id=*7;comment=;name=SIM1;type=ppp-out;.id=*8;comment=;name=SIM2;typ
e=ppp-out;.id=*a;comment=;name=SIM3;type=ppp-out;.id=*b;comment=;name=SIM4;type=pp
p-out;.id=*3;actual-mtu=1500;comment=;name=ppp-out1;type=ppp-out
doesn't see any running\disable option....
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: how to get interface status on API?

Sun Mar 26, 2017 9:02 pm

Hmm... I guess those are only available from the type specific menus, or in your case, I'm guessing that would be "/interface/ppp-client/print".
 
David1234
Forum Guru
Forum Guru
Topic Author
Posts: 1424
Joined: Sun Sep 18, 2011 7:00 pm

Re: how to get interface status on API?

Mon Mar 27, 2017 11:41 am

I have try it also
nothing
.id=*7;add-default-route=true;allow=pap;apn=fddfssa;comment=;data-channel=2;default-route-distance=1;dial-command=ATDT;dial-on-dem
and=false;info-channel=2;keepalive-timeout=30;max-mru=1500;max-mtu=1500;modem-init=;mrru=0;name=SIM1;null-modem=false;password=fds
fdsa;phone=*99#;pin=;port=usb2;profile=default;use-peer-dns=true;user=re
how could it be?
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: how to get interface status on API?

Mon Mar 27, 2017 12:51 pm

Have the "=detail=" argument also?

I'm sure the type specific menu has "running", as doing "print where [tab]" on the command line shows that property as one you can filter by.
 
David1234
Forum Guru
Forum Guru
Topic Author
Posts: 1424
Joined: Sun Sep 18, 2011 7:00 pm

Re: how to get interface status on API?

Mon Mar 27, 2017 1:06 pm

sorry?
I don't understand waht you are saying ....
can you write the command so I will understand?

Thanks ,
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2400
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: how to get interface status on API?

Mon Mar 27, 2017 1:33 pm

On CLI, it would be
/interface ppp-client print detail
or in API flow:
/interface/ppp-client/print
=detail=
 
David1234
Forum Guru
Forum Guru
Topic Author
Posts: 1424
Joined: Sun Sep 18, 2011 7:00 pm

Re: how to get interface status on API?

Tue Mar 28, 2017 10:04 am

sorry , still no (I have make space to be sure )
/interface ppp-client print as-value detail
.id=*7;
add-default-route=true;
allow=pap;
apn=fddfssa;
comment=;
data-channel=2;
default-route-distance=1;
dial-command=ATDT;
dial-on-demand=false;
info-channel=2;
keepalive-timeout=30;
max-mru=1500;
max-mtu=1500;
modem-init=;
mrru=0;
name=SIM1;
null-modem=false;
password=fdsfdsa;
phone=*99#;
pin=;
port=usb2;
profile=default;
use-peer-dns=true;
user=user1

Who is online

Users browsing this forum: Bing [Bot] and 56 guests