toplek
1
HI,
I’m trying to get wireless monitor stats using below code:
$array = $api->comm("/interface/wireless/monitor", array(
"=name=" => "$mt_interface",
"=once=" => "",
));
and getting error message: [message] => unknown parameter
Do anyone has solution of this problem ?
br
Piotr Polok
If you have a look at the arguments for this command from terminal, using
/interface wireless monitor ?
you’ll see there’s no “name” argument (that’s the “unknown parameter”).
The interface name is instead specified in the “numbers” argument.
toplek
3
HI,
That is true, there is no “name” argument, but the question is how to get statistics using name of interface. It works from command line:
interface wireless monitor Wlan1 once
So how to get wireless monitor statistics using name of interface via API ?
br
Piotr Polok
mrz
4
/interface/wirereless/monitor
=numbers=wlan1
=once=
is it possible to use it in PEAR2_Net_RouterOS without “once” ? for example continuous running loop/for and put an “if ($signal < 60 ) then …”
Sure. Well… not in a “for/while” loop, but using the loop() method instead, after previously specifying a callback for each response.
Just… to avoid a serious performance degradation, make sure to also add some reasonable interval.
e.g.
$monitorRequest = new Request('/interface wireless monitor numbers=wlan1 interval=2', null, 'm');
$client->sendAsync($monitorRequest, function ($response) {
$signal = $response->getArgument('signal');
if ($signal < 60) {
//????
}
});
$client->loop();