Page 1 of 1

API on v3.23

Posted: Thu Apr 23, 2009 8:19 pm
by Fumi
Hi TikPeople!

How can make traffic monitor to specific interface with API commands?

/interface monitor-traffic ether2

in API??

/interface/monitor-traffic
?name=ether2
=once=

This not work.. This command make monitor traffic of interface ether1.


Thanks!

Re: API on v3.23

Posted: Fri Apr 24, 2009 12:56 am
by Chupaka
/interface/monitor-traffic
=interface=ether2
=once=

BUT!... :( :( :(

monitor-traffic, ping, torch and other complex commands do not work via API now. they just return '!re'...

Re: API on v3.23

Posted: Fri Apr 24, 2009 11:04 am
by Fumi
Hi!

/interface/monitor-traffic
=interface=ether2
=once=

it's work!

Thanks

Re: API on v3.23

Posted: Fri Apr 24, 2009 3:33 pm
by janisk
you use queries only for print command, not for torch where you have to set actual parameters for command to work at all.

Re: API on v3.23

Posted: Sat Apr 25, 2009 12:41 pm
by Chupaka
wow! monitor-traffic works in 3.23! then torch should arrive soon )))

Re: API on v3.23

Posted: Mon Apr 27, 2009 11:03 am
by Fumi
Thanks janisk for aclaration!
We will be wait for API news!

Re: API on v3.23

Posted: Tue May 05, 2009 7:11 pm
by Fumi
How I can print N first lines of log?

/log/print
????

Thanks

Re: API on v3.23

Posted: Tue May 05, 2009 11:26 pm
by Chupaka
you may print full log and then process the only lines you need

btw, 'first lines' are the middle of the log, the bost recent messages are the last ones - why do you need first lines?

Re: API on v3.23

Posted: Wed May 06, 2009 11:07 am
by Fumi
I need only read a few lines because if I read all lines (400) i need wait time because my application work in remote mode...
If I can read first 10 lines and after folow 10 lines..

Thanks

Re: API on v3.23

Posted: Wed May 06, 2009 6:38 pm
by Chupaka
do you have 9600 bps dialup modem for remote access?.. what do you mean 'i need wait time'?

what exactly do you need to do?

Re: API on v3.23

Posted: Wed May 06, 2009 7:59 pm
by Fumi
A user connects to the router from home.
The router is in another site.

The program read log entries of router. If program reads all the entries in the log, user should wait too long time.
If the program could read ten lines first and next read ten follow lines I think that option will be better...

Thanks

Re: API on v3.23

Posted: Wed May 06, 2009 9:10 pm
by Chupaka
what bandwidth does the user have?..

Re: API on v3.23

Posted: Thu May 07, 2009 11:08 am
by Fumi
I don't know.. 128K 256K... but read 500, 1000 lines of log is not more efficient...

Re: API on v3.23

Posted: Thu May 07, 2009 2:16 pm
by Chupaka
well, in API you can issue parallel commands, so you cal load log in background (by tagging your API query)

Re: API on v3.23

Posted: Thu May 07, 2009 3:05 pm
by Fumi
Yeah, I think in this option..
I think option to read N entires of command would be better...

Re: API on v3.23

Posted: Thu May 07, 2009 3:10 pm
by Chupaka
possible scenario is the following:

- you read 10 lines: from 1 to 10
- router adds 2 lines to log, shifts the log up
- you read next 10 lines: from 11 to 20. but you have skipped two lines of log =)

so the preferred way of reading the log and then listening for changes is
/log/print
=follow=

Re: API on v3.23

Posted: Tue May 04, 2010 9:03 pm
by hrico
I get the reply if I use "=once=" but,
Hi!

/interface/monitor-traffic
=interface=ether2
=once=

it's work!

Thanks
...if i want to use for example "=interval=2" it does not show anything.
Also how is it with the /cancel command?
Should I use it somehow like this:
mikrotik.Send("/interface/monitor-traffic");
mikrotik.Send("=interface=ether1");
mikrotik.Send("/cancel");
mikrotik.Send(".tag=traffic",true);
...because that also not realy works.

Re: API on v3.23

Posted: Wed May 05, 2010 2:14 pm
by Chupaka
/interface/monitor-traffic
=interface=srv
=interval=2
works fine for me (tested in v4.2)

also, you should send '/cancel' command only when you don't need more execute previous command. p.s. '/cancel' is command, not parameter