Monitor traffic per IP

Hi,

I tried some way to monitor traffic per IP and generate graph. I try with script but scripting for me… :confused:

I make a firewall rule

add action=add-src-to-address-list address-list=LanIP address-list-timeout=3d \
    chain=forward connection-state=established,related in-interface=\
    bridge2-LAN

After that I make a script to generate simple queue

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

              :set list ([/ip firewall address-list get $i list] )
              :set hostip ([/ip firewall address-list get $i address] )
                    
              :if ([:len $testvalue] <= 0) do={
                     :if ($list = "LanIP") do={
                          
                             /queue simple add name=$hostip comment=$hostip  target=$hostip queue=default/default total-queue=default

                      } else={
                         }
                      } else={    
                         }
       }
       
       :log info "******************** ending - address lsit queue create ********************"

Until here every think is ok

Problem for me is How can remove queue if the IP after time out it is not in LanIP address list ?

I don’t know how make that with script
Please, Can anyone can help with that ?


Best Regards,