Skript kontroly queues a dhcp serveru

Z Wiki UnArt Slavičín
Skočit na navigaciSkočit na vyhledávání
# Omezeni queues na parent, bez omezeni nechte hodnotu "none"
:global parent "none"
# Omezeni ip adres z DHCP serveru, bez omezeni nechte hodnotu "0.0.0.0/0"
:global range 0.0.0.0/0

# Pomocne promenne
:global found
:global ip
:global comment

:foreach ipid in=[/ip dhcp-server lease find dynamic=no] do={
  :set ip [:toip [/ip dhcp-server lease get $ipid address]]
  :set comment [/ip dhcp-server lease get $ipid comment]
  :if ($ip in $range) do={
    :set found 0
  
    :foreach i in=[/queue simple find parent=$parent] do={
      :if ([:find [/queue simple get $i target-addresses] ($ip."/32")]!="") do={
        :set found 1
      }
    }
     :if ($found=0) do={
        :log warning ("IP adresa ".$ip." s komentarem \"".$comment."\" neni v queues!")
     }
  }
}