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 16: Řádek 16:
    
    
     :foreach i in=[/queue simple find parent=$parent] do={
     :foreach i in=[/queue simple find parent=$parent] do={
      :put ([/queue simple get $i target-addresses]." ".($ip."/32")." ".[:find [/queue simple get $i target-addresses] ($ip."/32")])
       :if ([:find [/queue simple get $i target-addresses] ($ip."/32")]) do={
       :if ([:tobool [:find [/queue simple get $i target-addresses] ($ip."/32")]]) do={
         :set found 1
         :set found 1
       }
       }
     }
     }
#    :if ($found=0) do={
      :if ($found=1) do={
#        :put ("IP adresa ".$ip." s komentarem ".$comment." neni v queues!")
        :put ("IP adresa ".$ip." s komentarem ".$comment." neni v queues!")
#    }
      }
   }
   }
  }
  }

Verze z 10. 2. 2012, 14:11

# 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 10.143.230.125/32

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

:foreach ipid in=[/ip dhcp-server lease find] 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=1) do={
        :put ("IP adresa ".$ip." s komentarem ".$comment." neni v queues!")
     }
  }
}