Community discussions

MikroTik App
 
nicutdk
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 99
Joined: Sat Sep 24, 2016 12:06 pm

Script add queues and read static dns

Mon May 22, 2017 1:18 pm

Hi,

I try to add queues from address list and add to comment host name from dns.

To add queues from address list works fine. Problem is to add HostName from DNS.

       :local hostip
       :local list
       :local testvalue
       :local hostdns
      
       :log info "******************** starting - address list queue create ********************"
 
       :foreach i in=[/ip firewall address-list find list=ipLAN] do={

              :set list ([/ip firewall address-list get $i list] )
              :set hostip ([/ip firewall address-list get $i address] )
             
        
              :set testvalue [/queue simple find name=$hostip]
          


              :if ([:len $testvalue] <= 0) do={
                     :if ($list = "ipLAN") do={
                            :set hostdns [/ip dns static find name where address=$hostip]
                             /queue simple add name=$hostip comment="ipLAN $hostdns"  target=$hostip queue=default/default total-queue=default

                      } else={

           
                                 }
                      } else={
                         
                        }
       }
My problem is that line:
:set hostdns [/ip dns static find name where address=$hostip]

Can anybody help me ?


Best Regards,
 
andredossantos
just joined
Posts: 8
Joined: Thu Jul 21, 2016 9:21 pm

Re: Script add queues and read static dns

Mon May 22, 2017 6:58 pm

Do you want to resolve the IP to a name?
Maybe use :resolve.

> :put [:resolve 8.8.8.8]
google-public-dns-a.google.com
 
nicutdk
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 99
Joined: Sat Sep 24, 2016 12:06 pm

Re: Script add queues and read static dns

Mon May 22, 2017 8:52 pm

I have static dns address and I want to add at the comment the address for that ip.


Regards

Who is online

Users browsing this forum: netmas and 75 guests