Skript kontroly queues a dhcp serveru: Porovnání verzí

Z Wiki UnArt Slavičín
Skočit na navigaciSkočit na vyhledávání
Bez shrnutí editace
Bez shrnutí editace
Řádek 6: Řádek 6:
  # Pomocne promenne
  # Pomocne promenne
  :global found
  :global found
:global ip
   
   
  :foreach ip in=[/ip dhcp-server lease find] do={
  :foreach ip_id in=[/ip dhcp-server lease find] do={
   :if ([/ip dhcp-server lease get $ip address] in $range) do={
   :set ip [/ip dhcp-server lease get $ip address]
  :put $ip
  :if ($ip in $range) do={
     :set found 0
     :set found 0
    
    
     :foreach i in=[/queue simple find parent=$parent] do={
     :foreach i in=[/queue simple find parent=$parent] do={
       :if ([:find [/queue simple get $i target-addresses] ([/ip dhcp-server lease get $ip address]."/32")]!=0) do={
       :if ([:find [/queue simple get $i target-addresses] ($ip."/32")]!=0) do={
         :set found 1
         :set found 1
       }
       }
     }
     }
     :put ([/ip dhcp-server lease get $ip address]." ".$found)
     :put ($ip." ".$found)
   }
   }
  }
  }

Verze z 10. 2. 2012, 13:26

# 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

:foreach ip_id in=[/ip dhcp-server lease find] do={
  :set ip [/ip dhcp-server lease get $ip address]
  :put $ip
  :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")]!=0) do={
        :set found 1
      }
    }
    :put ($ip." ".$found)
  }
}