Community discussions

MikroTik App
 
PhotoshopPhilipp
just joined
Topic Author
Posts: 4
Joined: Wed Feb 10, 2021 10:32 am

7.1beta4 monitor-traffic restApi

Wed Feb 10, 2021 10:42 am

Is it possible to get the following information through the rest api?:

tx-bits-per-second
rx-bits-per-second


The command would be: /interface/monitor-traffic wlan1 once but I could not get to run in through the api. I think id have to do it through the POST methode as it is descriped in the documentation https://help.mikrotik.com/docs/display/ROS/REST+API

I think: ip/rest/interface/monitor-traffic?interface=wlan1 is the way to do it but it needs somehow the once param...

Does someone know how to do that?
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 6195
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: 7.1beta4 monitor-traffic restApi

Wed Feb 10, 2021 11:11 am

Check "Timeout" section in that manual. It has an example on how to use similar commands to "monitor-traffic"
 
PhotoshopPhilipp
just joined
Topic Author
Posts: 4
Joined: Wed Feb 10, 2021 10:32 am

Re: 7.1beta4 monitor-traffic restApi

Wed Feb 10, 2021 11:53 am

Check "Timeout" section in that manual. It has an example on how to use similar commands to "monitor-traffic"
Mmm thats a thing but not exactly what im trying to do. I can messure the bandwith between 2 tiks but i want to know the traffic of the interface wlan1 for exampe...

Is there another solution to that?
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 6195
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: 7.1beta4 monitor-traffic restApi

Wed Feb 10, 2021 1:53 pm

It is not clear what you are not able to do.

Have you tried to run
POST 'https://x.x.x.x/rest/tool/traffic-monitor' -data '{"interface":"wlan1","duration":"2s"}'
 
PhotoshopPhilipp
just joined
Topic Author
Posts: 4
Joined: Wed Feb 10, 2021 10:32 am

Re: 7.1beta4 monitor-traffic restApi

Wed Feb 10, 2021 4:06 pm

Yes i already tried that on multiple tiks but it didnt work :(
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 6195
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: 7.1beta4 monitor-traffic restApi  [SOLVED]

Wed Feb 10, 2021 4:19 pm

Be more specific what exaclty is not working what errors you get and so on.

Here is an example of traffic monitor, it works as expected:
$ curl -k -u admin: -X POST 'https://10.155.101.214/rest/interface/monitor-traffic'   --data '{"interface":"sfp12","duration":"2s"}' -H "content-type: application/json"

[{".section":"0","fp-rx-bits-per-second":"45176","fp-rx-packets-per-second":"49","fp-tx-bits-per-second":"222160","fp-tx-packets-per-second":"30","name":"sfp12","rx-bits-per-second":"45176","rx-drops-per-second":"0","rx-errors-per-second":"0","rx-packets-per-second":"49","tx-bits-per-second":"222160","tx-drops-per-second":"0","tx-errors-per-second":"0","tx-packets-per-second":"30","tx-queue-drops-per-second":"0"},{".section":"1","fp-rx-bits-per-second":"24184","fp-rx-packets-per-second":"27","fp-tx-bits-per-second":"214616","fp-tx-packets-per-second":"31","name":"sfp12","rx-bits-per-second":"24184","rx-drops-per-second":"0","rx-errors-per-second":"0","rx-packets-per-second":"27","tx-bits-per-second":"214616","tx-drops-per-second":"0","tx-errors-per-second":"0","tx-packets-per-second":"31","tx-queue-drops-per-second":"0"}]

 
PhotoshopPhilipp
just joined
Topic Author
Posts: 4
Joined: Wed Feb 10, 2021 10:32 am

Re: 7.1beta4 monitor-traffic restApi

Wed Feb 10, 2021 4:25 pm

I tried it with curl and it worked right away. Well I guess I have to look at my not properly working tools.

Thank you for your answeres!

Who is online

Users browsing this forum: No registered users and 14 guests