I’m pretty new at this scripting stuff. I have a script that compares my arp table entries to my queue entries. This script pertains of a few variables, a while, and a nested while. It runs fine from console when i just paste the contents on the command line. If i put this into a script file and run the script file from console it won’t output any variables. Am i missing something? or do i just need to dump it into a file maybe email the unknowns…not sure. Any help is appreciated. Thanks.
-Jonathan
nvm, i am assuming that since print doesn’t work in a script then find doesn’t work as well…
Here is the command i run in console.
:set y [:len [/ip arp find]]; :put ($y); :put [/queue simple print]; :set bad 0; :set i 0; :set bad 0; :while($i < $y) do={:set
x 0; :while($bad = 0 && $x < [:len [/queue simple find]]) do={:if (([/ip arp get $i address] . “/32”) = [/queue simple get $x target-address]) do={:set bad 1;};
:set x ($x + 1);}; :if ($bad = 0) do={:put [/ip arp get $i address]};:set bad 0; :set i ($i + 1)}
This works…trust me. lol Might be crappy, but oh well. I was wondering if, as a suggestion, mikrotik could implement the functionality of print/put commands in scripts. You could possibly open a terminal window run the command and close the terminal window in that case. I know this only outputs to the terminal screen, but if i implemented email with this, it still wouldn’t work as a script file. So for now i just login to each mikrotik and run this command. Thanks.
-Jonathan
Download that syslog tool on the download page
then replace 1.2.3.4 in the follow snippet with your ip (remember to open udp port 514 to your computer)
/ system logging {
action add remotelogger target=remote remote=1.2.3.4:514
add topics=script,warning prefix=queues action=remote disabled=no }
Then run this one, perhaps you’ll get a satisfactory solution?
:foreach a in=[ / ip arp find ] do={ :set a [ / ip arp get $a address ]; :if ( [ / queue simple find target-address=( $a . \/32 ) ] = [ :nothing ] ) do={ :log warning ( ip\_not\_queues\_ . $a ) } }
Hm, there is a problem with the target-address= i looked it up in the terminal and it is target-addresses= Also, this doesn’t return anything when i just run in the terminal the command, "/queue simple find target-addresses=192.168.0.2/32 or any form of the ip address. I’m still tinkering with it.
edit wierd debug error when i submitted, guess it did twice edit
well i dont have anything to test this specific configuration on and i’m too lazy to set it up.
perhaps i spelled it wrong? perhaps you only run v2.8.x or some old v2.9.x version?