Community discussions

MUM Europe 2020
 
pedja
Long time Member
Long time Member
Topic Author
Posts: 684
Joined: Sat Feb 26, 2005 5:37 am

How to monitor through api?

Fri Jan 16, 2009 7:25 pm

How API is used to gather information like

/interface wireless scan

/interface wireless frequency-monitor

... and others?


For instance, /interface/ethernet/monitor =numbers=0 =once= returns proper value but there commands just return error.

I tried

/interface/wireless/frequency-monitor =number=0 =once=
/interface/wireless/frequency-monitor =numbers=0 =once=
/interface/wireless/frequency-monitor =interface=wlan =once=
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 5950
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: How to monitor through api?

Mon Jan 19, 2009 12:03 pm

last time I checked monitor and scan commands were not supported by API.
 
Mplsguy
MikroTik Support
MikroTik Support
Posts: 226
Joined: Fri Jun 06, 2008 5:06 pm

Re: How to monitor through api?

Mon Jan 19, 2009 5:13 pm

You sure can do frequency-monitor and scan from API. API "commands" are based on console commands, e.g. "frequency-monitor" does not have "once" parameter, therefore you have to start it and stop it over API:
 <<< /interface/wireless/print
 <<<                          
 >>> !re                      
 >>> =.id=*3                  
 >>> =comment=                
 >>> =name=wlan1
 >>> =mtu=1500
...
 <<< /interface/wireless/frequency-monitor
 <<< =.id=*3                              
 <<<                                      
 >>> !re                                  
 >>> =.id=*1                              
 >>> =freq=5180                           
 >>> =use=192                             
 >>> =nf=-101                             
 >>>                                      
 >>> !re                                  
 >>> =.id=*2                              
 >>> =freq=5200                           
 >>> =use=0                               
 >>> =nf=-101                             
...
 <<< /cancel
 <<<
 >>> !trap
 >>> =category=2
 >>> =message=interrupted
 >>>
 >>> !done
 >>>
 >>> !done
Another thing - "numbers" argument is not accepted everywhere and even where accepted not advised - use ".id" argument to specify the object (interface in this case) you refer to - use "print" command to find it out if not known.

You can use most of commands available in console from API (that are not console scripting related) with the same arguments as in console. There are some commands where you currently will not get meaningful results (such as traceroute), but there are only a few like this. You can even run bandwidth-test from API.

Who is online

Users browsing this forum: No registered users and 82 guests