Hi,
I am developer in c#. I want develop a program that using API for connect to MK 3.X.
My application must do :
1-Kill (remove) a user with username.
2-Get Total traffic (Download + Upload ) for a user with username
I am using PPPOE for connecting my users.
I saw API documents but, I did not found any things. How I can use API commands for my application.
Thanks
Thanks a lot, but I said , I saw this link.
I need Command and sentences that I must use.
post here CLI commands that you use for that
Thanks,
1- finding a online user for example ABCD. (whe a PPPOE user is online, we have an Interface )
and remove this Interface.
this Command work with Telnet.
/ppp active remove [ /ppp active find name=ABCD]
but for get traffice of active user I have not Command.
I think, you should work with /interface, not /ppp active. first you execute
/interface/print
=.proplist=.id,bytes
?=name=<pppoe-ABCD>
and now you know interface id and traffic
then you can kill that interface:
/interface/remove
=.id=*XXX
name is case-sensitive, so be careful =)
Thanks a lot,
can you tell me, how I can Kill only with user name ?
you should first find item .id with ‘print’ command, then call ‘remove’ with that id
Hi,
when I run your command, I got error :
!trap=message=argument error
i am using this code in C# :
mikrotik.Send("/interface/print");
mikrotik.Send("=.proplist=.id,bytes");
mikrotik.Send("=name=<pppoe-sanat>", true);
foreach (string h in mikrotik.Read())
{
Console.WriteLine(h);
}
that’s not my command, my is with ‘? =name=’, not ‘=name=’ =)
janisk
June 26, 2009, 5:38am
12
what version of RouterOS you are using - try upgrading to newest version.
Hi.
my MK version is 3.13.
I can run API sample in http://wiki.mikrotik.com/wiki/API_in_C_Sharp and it workes.
But current command does not work.
janisk
June 26, 2009, 6:52am
14
you should use newer version than that. if i remeber correctly proplist where introduced in RouterOS 3.24
Thanks,
Can I solve :
1-Kill (remove) a user with username.
2-Get Total traffic (Download + Upload ) for a user with username
With current version(3.13) and APIs.
janisk
June 26, 2009, 11:21am
16
Current version is 3.25 documentations is according to current version.
at first, you need queries (‘?=attr=value’), they were introduced in v3.21. before - you may just use ‘/interface/print’ and get all interfaces, then search among them. huge traffic =) and I’m not sure, whether you can receive ‘bytes’ attribute in v3.13 - you should check it by yourself
Thanks,
There is some of my query resualt when I use only
/interface/print
!re=.id=*4=comment==name=DSLAM=type=ether=mtu=1500
!re=.id=*5=comment==name=Internet=type=ether=mtu=1500
!re=.id=*6=comment==name=Intranet TCI=type=ether=mtu=1500
!re=.id=*D=comment==name=<pppoe-davood_k>=type=pppoe-in=mtu=14
!re=.id=*E=comment==name=<pppoe-saeed>=type=pppoe-in=mtu=1488
!re=.id=*12=comment==name=<pppoe-kargari>=type=pppoe-in=mtu=14
!re=.id=*14=comment==name=<pppoe-sanat>=type=pppoe-in=mtu=1488
!re=.id=*1A=comment==name=<pppoe-ameri>=type=pppoe-in=mtu=1488
!re=.id=*1D=comment==name=<pppoe-nasr>=type=pppoe-in=mtu=1488
......
do you have any Idea ?
yes. the only idea is to upgrade
at least to v3.23:
What’s new in 3.23:
*) added ‘/interface print stats’ command;
here’s your bytes…
Thanks,
I am a developer only, I must contact my customer to do this.
What about for kill a online user ??
Do you think I must upgrade OS ?