Hi,
I have tried to compile a script that would monitor the total number of packets according to individual IP's and block those IP's in the firewall.
I still have to add a line to reset the queue counters after the script has run, however the beginnings of the script is below, I have tried to run this script and it doesn't work.
This is my first script, so please feel free to tell me what I am doing wrong.
:global interval;
:global threshold;
:set interval 10;
:set threshold 2000;
:local recipients {"user@example.com"}
:local subject "Subject of Message"
:for i from=1 to=254 do={
:if ([/queue simple find target-addresses=("192.168.1." . $i)] != "") do={
:set pack [get [find target-addresses=("192.168.1." . $i)] packets]
:if ($pack / $interval > $threshold) do={
/ip firewall filter add action=reject chain=forward src-address=("192.168.1." . $i) disabled=yes
:foreach r in=[:toarray $recipients] do={
:put ("Sending email to " . [:tostr $r])
/tool e-mail send from="mikrotik@scottnet.co.za" server="196.41.123.125" to=[:tostr $r] subject=[:tostr $subject] body="Body of Message"
}
}
}
}