I’ve been working on this script. It’s “sort” of working. No matter what I set the local threshold to, 20, 40, 90, the alert comes back with the same numbers. "inside_vlan Pool is 1000% full. Can someone please let me know what I am doing wrong?
:local threshold 20
:foreach pool in=[/ip pool find] do={
:local name [/ip pool get $pool name]
:local ranges [/ip pool get $pool ranges]
:local used [/ip pool get $pool used]
:local size 0
:foreach r in=$ranges do={
:local start [:pick $r 0 [:find $r "-"]]
:local end [:pick $r ([:find $r "-"] + 1) [:len $r]]
:set size ($size + ($endInt - $startInt + 1))
}
:if ($size > 0) do={
:local percentUsed (100 * $used / $size)
:if ($percentUsed > $threshold) do={
:log warning ("IP Pool '$name' is $percentUsed% full ($used of $size)")
/tool e-mail send to="myemail@email.com" subject="DHCP Pool Alert" body="$name is $percentUsed% full."
}
}
}
I would propose an addition: #24: The user usually is not able to follow or understand multiple information in a single post, so either he only considers the first one or the last one ignores all the previous ones.