Please Help Is This a Bug or I made a Mistake ????

Hi
On my ROS (PIII) I have written a script which is choosing say better channel
look at My script

[admin@Monument] > system script print 
 0 name="script1" owner="admin" policy=ftp,reboot,read,write,policy,test,winbox,password,(unknown) last-started=oct/30/2007 00:07:31 run-count=1154 
   source=
     :foreach i in=[/interface find name=WiFi-Clients ] do={/interface wireless monitor $i once do {:if ($noise-floor > -100) do {:local tmpfreq [interface wire
less get [/interface wireless find interface=$i] frequency] ; 
     :log info $tmpfreq ;  
     :set tmpfreq ($tmpfreq + 5) ; 
     :log warning $tmpfreq ; 
     :if ($tmpfreq < 2472) do={/interface wireless set $i frequency=$tmpfreq} else={/interface wireless set $i frequency=2412 ;}}}}
[admin@Monument] >

This one works Fine But On others (They are PIII ROS too) it doesn’t work

Why ??
Can anybody help?
Look at logs

[admin@SHIRVANZADE] > :foreach i in=[/interface wireless find name=WiFi-Clients ] do={/interface wireless monitor $i once ; :do {:if ($noise-floor > 100) do {:l
ocal tmpfreq [/interface wireless get [/interface wireless find interface=$i] frequency] ; :log info $tmpfreq ; :set tmpfreq ($tmpfreq + 5) ; :log warning $tmpf
req ; :if ($tmpfreq < 2472) do={/interface wireless set $i frequency=$tmpfreq} else={/interface wireless set $i frequency=2412 ;}}}}
                 status: running-ap
                   band: 2.4ghz-b
              frequency: 2427MHz
            noise-floor: -92dBm
         overall-tx-ccq: 57%
     registered-clients: 14
  authenticated-clients: 14
    current-ack-timeout: 218
       current-distance: 218
                nstreme: no
      current-tx-powers: 1Mbps:28,2Mbps:28,5.5Mbps:28,11Mbps:28
    notify-external-fdb: yes
[admin@SHIRVANZADE] >

It Runs But nothing is changed when it had to change the frequency as noise-floor was -92


Somebody Help Please
With Regards
Karapet Aznavuryan

For your FOREACH statement, you return index values based on a search for a Name under Interface, according to your script.

But then you proceed to trigger a Monitor under /interface/wireless.
The index values under Wireless are not the same list as is shown under Interface.

You’ll see if you do

/interface print

and

/interface wireless print

It’ll give you two different lists, with two different sets of index values.

Quite likely, the index value under /interface for your wireless card does not correspond to the index value for the Wireless card you want to monitor under /interface/wireless.
In my case, this is definitely true.

I suggest changing the FOREACH statement to the following:

:foreach i in=[/interface wireless find name=WiFi-Clients ] do={/interface wireless monitor $i once...

Thanks krigevr Very Much

I tried But It does not work
I don’t Understand why?

Do your wireless interfaces have exactly the same name on each router ?
You are using find to locate them by name.
And yes, do use /interface print OR /interface wireless print, only one of them, for consistency.

Yes I understand that
:foreach i in=[/interface is equal to /interface print
and
:foreach i in=[/interface wireless is equal to /interface wireless print


In Both Case there must be no difference as I use different Interface names on one Router
So My ROS version is 2.9.27,
What you think Can it be a reason for this problem ??

In the first post, you said it works fine on one router. Your script.
If you move it to another router, and you use find to locate the interface, you should look for the exact interface name, case dOeS matter.

I have writen just the same script and on others and there was no Difference
It doesn’t give any errors and doesn’t work at all.
Somebody can Help?

What version of RouterOS are you using?

There are some known errors in the scripting for 2.9.x, which seems to have been solved by 3.0rcX.

Post the script as you have it now, and let’s see if we can debug it some more.

-K

Thanks For Reply
Here My Script

:foreach i in=[/interface find name=WiFi-Clients ] do={/interface wireless monitor $i once do {:if ($noise-floor > -100) do {:local tmpfreq [interface wireless get [/interface wireless find interface=$i] frequency] ; 
:log info $tmpfreq ;  
:set tmpfreq ($tmpfreq + 5) ; 
:log warning $tmpfreq ; 
:if ($tmpfreq < 2472) do={/interface wireless set $i frequency=$tmpfreq} else={/interface wireless set $i frequency=2412 ;}}}}

And We Use 2.9.27 Version of The ROS


Regards
Karapet Aznavuryan

[quote=“karo84”]
And We Use 2.9.27 Version of The ROS
/quote]

woooh that’s too old :slight_smile:

MRZ
What You Mean?
What Can I do?
Upgrade?

Exactly ! :sunglasses:

Thanks All Very Much :laughing: :sunglasses: :laughing:

Yes, I mean upgrade. This version is so old, there could be 100 bugs related to your script problem :slight_smile: It is working for us on latest versions.

OK Thanks I’ll try to Upgrade to the latest Version, and then try to run the script. :sunglasses: