Community discussions

MikroTik App
 
Fumi
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 97
Joined: Fri Jul 28, 2006 10:12 am

API on v3.23

Thu Apr 23, 2009 8:19 pm

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!
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8486
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: API on v3.23

Fri Apr 24, 2009 12:56 am

/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'...
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.
 
Fumi
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 97
Joined: Fri Jul 28, 2006 10:12 am

Re: API on v3.23

Fri Apr 24, 2009 11:04 am

Hi!

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

it's work!

Thanks
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6284
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: API on v3.23

Fri Apr 24, 2009 3:33 pm

you use queries only for print command, not for torch where you have to set actual parameters for command to work at all.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8486
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: API on v3.23

Sat Apr 25, 2009 12:41 pm

wow! monitor-traffic works in 3.23! then torch should arrive soon )))
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.
 
Fumi
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 97
Joined: Fri Jul 28, 2006 10:12 am

Re: API on v3.23

Mon Apr 27, 2009 11:03 am

Thanks janisk for aclaration!
We will be wait for API news!
 
Fumi
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 97
Joined: Fri Jul 28, 2006 10:12 am

Re: API on v3.23

Tue May 05, 2009 7:11 pm

How I can print N first lines of log?

/log/print
????

Thanks
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8486
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: API on v3.23

Tue May 05, 2009 11:26 pm

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?
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.
 
Fumi
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 97
Joined: Fri Jul 28, 2006 10:12 am

Re: API on v3.23

Wed May 06, 2009 11:07 am

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
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8486
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: API on v3.23

Wed May 06, 2009 6:38 pm

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?
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.
 
Fumi
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 97
Joined: Fri Jul 28, 2006 10:12 am

Re: API on v3.23

Wed May 06, 2009 7:59 pm

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
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8486
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: API on v3.23

Wed May 06, 2009 9:10 pm

what bandwidth does the user have?..
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.
 
Fumi
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 97
Joined: Fri Jul 28, 2006 10:12 am

Re: API on v3.23

Thu May 07, 2009 11:08 am

I don't know.. 128K 256K... but read 500, 1000 lines of log is not more efficient...
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8486
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: API on v3.23

Thu May 07, 2009 2:16 pm

well, in API you can issue parallel commands, so you cal load log in background (by tagging your API query)
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.
 
Fumi
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 97
Joined: Fri Jul 28, 2006 10:12 am

Re: API on v3.23

Thu May 07, 2009 3:05 pm

Yeah, I think in this option..
I think option to read N entires of command would be better...
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8486
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: API on v3.23

Thu May 07, 2009 3:10 pm

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=
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.
 
hrico
just joined
Posts: 12
Joined: Wed Dec 16, 2009 2:25 am

Re: API on v3.23

Tue May 04, 2010 9:03 pm

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.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8486
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: API on v3.23

Wed May 05, 2010 2:14 pm

/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
Russian-speaking forum: https://forum.mikrotik.by/. Welcome!

For every complex problem, there is a solution that is simple, neat, and wrong.

MikroTik. Your life. Your routing.

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 200 guests