Community discussions

MikroTik App
 
User avatar
webasdf
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 84
Joined: Mon Jan 26, 2009 6:37 pm

API problem in 4.8

Thu Apr 29, 2010 9:31 pm

Running across a problem with viewing interface traffic statistics in new version 4.8. I try:
<<< /interface/print
<<< ?name=ether1
<<<

And I get

>>> !re
>>> =.id=*1
>>> =name=ether1
>>> =type=ether
>>> =mtu=1500
>>> =l2mtu=1524
>>> =dynamic=false
>>> =running=true
>>> =disabled=false
>>> =comment=

In version 4.5 I get returned parameters "bytes" and "packets" along with everything else.
>>> !re
>>> =.id=*1
>>> =name=ether1
>>> =type=ether
>>> =mtu=1500
>>> =l2mtu=1526
>>> =bytes=284609182/413275649
>>> =packets=1307889/766476
>>> =dynamic=false
>>> =running=true
>>> =disabled=false
>>> =comment=


Is this information not available anymore in 4.8 API? Did it move? Would be great to get it back.

Thank you,
 
duvi
Frequent Visitor
Frequent Visitor
Posts: 70
Joined: Fri Jun 05, 2009 12:32 pm
Contact:

Re: API problem in 4.8

Thu Apr 29, 2010 10:42 pm

Same issue here, my munin script drawing the interface graph does not collect any data anymore ):
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6283
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: API problem in 4.8

Fri Apr 30, 2010 12:51 pm

at this moment you can try this command
/interface/print
=stats=
?name=ether1
not the =stats=

result on RB450G is:
!re
=.id=*1
=name=ether1
=type=ether
=mtu=1500
=l2mtu=1524
=bytes=13645510/211566156
=packets=145917/163922
=drops=0/0
=errors=0/0
=dynamic=false
=running=true
=disabled=false
i will check where this change crept in. On the other hand it does make sense that errors and other stats are showed when =stats= are added. BTW this behaviour is on both 4.8 and 5.0beta2 (due to be released someday)
 
User avatar
webasdf
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 84
Joined: Mon Jan 26, 2009 6:37 pm

Re: API problem in 4.8

Fri Apr 30, 2010 6:12 pm

The =stats= sentence works on 4.5 and 4.8. Will change the code behind our app.

Thanks!
 
User avatar
webasdf
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 84
Joined: Mon Jan 26, 2009 6:37 pm

Re: API problem in 4.8

Fri Apr 30, 2010 7:56 pm

The =stats= sentence worked for interfaces, but I am having this problem now with /ip/hotspot/host/print.

<<< /ip/hotspot/host/print
<<< =stats=
<<<
Sentence iLength = 2
Sentence iReturnValue = 2
>>> !trap
>>> =message=unknown parameter

The =stats= sentence doesn't work and the bytes and packets stats don't display. Is there a command to show the user stats in hotspot using API?

I am able to get bytes and packets from /ip/hotspot/active/print by using =stats= sentence, but that only works for hotspot users that are logged in. I also tried new version 4.9 today and same problem.
 
dssmiktik
Forum Veteran
Forum Veteran
Posts: 732
Joined: Fri Aug 17, 2007 8:42 am

Re: API problem in 4.8

Sat May 01, 2010 3:06 am

This makes sense to me, as it closely relates to the console commands.

Ex.
/interface print <no stats shown>
/interface print stats <shows interface stats>
/ip hotspot active print stats <shows active hotspot stats>
/ip hotspot host print stats <not available>
/ip hotspot host print bytes <shows host bytes>
/ip hotspot host print packets <shows host packets>

Try with the 'packets' and 'bytes'. This should be the expected behavior.
Doug
 
User avatar
webasdf
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 84
Joined: Mon Jan 26, 2009 6:37 pm

Re: API problem in 4.8

Mon May 03, 2010 4:43 pm

Thank you much dssmiktik. Using the =bytes= sentence gives me everything like =stats= does. This should work for my API application.

Does anybody know if this is the expected behavior of API? Is there a plan to change it in future revisions? Will =stats= sentence be added in for /ip/hotspot/host/print sentence?

<<< /ip/hotspot/host/print
<<< =bytes=
<<<
Sentence iLength = 20
Sentence iReturnValue = 0
>>> !re
>>> =.id=*1
>>> =mac-address=00:40:05:53:A2:5A
>>> =address=192.168.0.19
>>> =to-address=192.168.0.19
>>> =server=hotspot1
>>> =uptime=2d03:35:49
>>> =idle-time=00:00:12
>>> =idle-timeout=01:00:00
>>> =keepalive-timeout=01:00:00
>>> =host-dead-time=00:00:12
>>> =bridge-port=ether3
>>> =bytes-in=171696
>>> =bytes-out=171696
>>> =packets-in=3066
>>> =packets-out=3066
>>> =found-by=ARP reply to 192.168.0.1
>>> =authorized=false
>>> =bypassed=true
>>> =comment=type:device;Dlink AP


Thank you.
 
User avatar
webasdf
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 84
Joined: Mon Jan 26, 2009 6:37 pm

Re: API problem in 4.8

Tue May 04, 2010 8:16 pm

Now I'm having problems getting .id property from /ip/route/print command. I've tried =detail=, =stats=, =bytes=, and =packets= but I can't get .id property from /ip/route/print using API. I also found that /ip/dns has changed.

Is there a help or changelog file somewhere detailing what has changed from 4.5 to 4.9? The changelog from the download page is very vague. My app is really broken when I try routeros 4.9. I have no idea what has changed and it is really frustrating. :(
 
reverged
Member Candidate
Member Candidate
Posts: 271
Joined: Thu Nov 12, 2009 8:30 am

Re: API problem in 4.8

Sun Sep 26, 2010 8:36 pm

I just ran into this problem. This thread saved my mind.

I've been using api for a web based app with ROS <=4.6 for many months.

I installed some new devices recently with 4.10 and the web app is missing hotspot 'bytes' and other information.

adding =bytes= to the command works.

Thanks!

I would volunteer to help keep an api wiki up to date, BUT I WILL NOT do it using trial and error with API commands.
It is way too time consuming.

I have had to resort to trial and error to write my apps, because the documentation is severely lacking for API and it DOES NOT always follow the terminal commands, as we have seen.

Someone has the api source code and knows what commands result in what data!
 
dssmiktik
Forum Veteran
Forum Veteran
Posts: 732
Joined: Fri Aug 17, 2007 8:42 am

Re: API problem in 4.8

Sun Sep 26, 2010 9:22 pm

Now I'm having problems getting .id property from /ip/route/print command. I've tried =detail=, =stats=, =bytes=, and =packets= but I can't get .id property from /ip/route/print using API. I also found that /ip/dns has changed.

Is there a help or changelog file somewhere detailing what has changed from 4.5 to 4.9? The changelog from the download page is very vague. My app is really broken when I try routeros 4.9. I have no idea what has changed and it is really frustrating. :(
v4.10 fixed the route print problem (not sure about dns):
*) api - fixed '/ip/route/print', was not showing '.id' values;
Doug

Who is online

Users browsing this forum: EdPa, Egert143, karlisi, Me3do, sindy and 122 guests