Forum Discussion

dubdub's avatar
dubdub
Icon for Nimbostratus rankNimbostratus
Dec 23, 2011

Query currently selected pool

Hi all,

 

 

Per Deb's article at http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/130/iRules-101--05--Selecting-Pools-Pool-Members-and-Nodes.aspx, I am forcing selection of varying pools based on URI. I understand that if I do not force a selection, the pool will remain as the last selected pool for that connection. Is there a way to query which pool is currently assigned to a connection?

 

 

Thanks,

 

Jen

 

  • if i am not wrong, it seems to be LB::server.

    [root@ve1023:Active] config  b virtual bar list
    virtual bar {
       snat automap
       pool foo
       destination 172.28.19.79:80
       ip protocol 6
       rules myrule
       profiles {
          http {}
          tcp {}
       }
    }
    [root@ve1023:Active] config  b pool foo list
    pool foo {
       members 200.200.200.101:80 {}
    }
    b[root@ve1023:Active] config  b pool foo1 list
    pool foo1 {
       members 200.200.200.102:80 {}
    }
    [root@ve1023:Active] config  b rule myrule list
    rule myrule {
       when CLIENT_ACCEPTED {
            log local0. ""
    }
    
    when HTTP_REQUEST {
            set req [HTTP::uri]
            log local0. "[LB::server addr]"
            switch -glob $req {
                    *.jpg { pool foo1 }
            }
    }
    
    when HTTP_RESPONSE {
            log local0. "[IP::client_addr]:[TCP::client_port] -> [IP::remote_addr]:[IP::remote_addr]|$req"
    }
    }
    
     curl http://172.28.19.79/test.html http://172.28.19.79/husky.jpg http://172.28.19.79/f5.gif > /dev/null
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100   149  100   149    0     0  32112      0 --:--:-- --:--:-- --:--:--     0
    100   284  100   284    0     0  79396      0 --:--:-- --:--:-- --:--:-- 79396
    100   281  100   281    0     0   126k      0 --:--:-- --:--:-- --:--:--  126k
    
    [root@ve1023:Active] config  cat /var/log/ltm
    Dec 23 11:01:32 local/tmm info tmm[26866]: Rule myrule CLIENT_ACCEPTED:
    Dec 23 11:01:32 local/tmm info tmm[26866]: Rule myrule HTTP_REQUEST:
    Dec 23 11:01:32 local/tmm info tmm[26866]: Rule myrule HTTP_RESPONSE: 172.28.19.80:51262 -> 200.200.200.101:200.200.200.101|/test.html
    Dec 23 11:01:32 local/tmm info tmm[26866]: Rule myrule HTTP_REQUEST: 200.200.200.101
    Dec 23 11:01:32 local/tmm info tmm[26866]: Rule myrule HTTP_RESPONSE: 172.28.19.80:51262 -> 200.200.200.102:200.200.200.102|/husky.jpg
    Dec 23 11:01:32 local/tmm info tmm[26866]: Rule myrule HTTP_REQUEST: 200.200.200.102
    Dec 23 11:01:32 local/tmm info tmm[26866]: Rule myrule HTTP_RESPONSE: 172.28.19.80:51262 -> 200.200.200.102:200.200.200.102|/f5.gif
    
  • dubdub's avatar
    dubdub
    Icon for Nimbostratus rankNimbostratus
    Hi Nitass,

     

     

    Thank you for the suggestion! I added some logging for it, and on particular busy pages, it occasionally gets a null result in the logs. I've not been able to detect any errors being presented in the browser though. Would that be expected behavior? The wiki indicates it may be due to a server not being selected yet (I know the servers are up, not down) which seems it should generate an error in the brower... a broken link of some sort? Unless it's still being handled by the default pool for the VS.

     

     

    Thanks,

     

    Jen

     

  • on particular busy pages, it occasionally gets a null result in the logs. I've not been able to detect any errors being presented in the browser though. Would that be expected behavior?if it is the first request in a connection, i would say it is an expected since pool member has not been selected in HTTP_REQUEST event. It is like the second line of my ltm log.
  • dubdub's avatar
    dubdub
    Icon for Nimbostratus rankNimbostratus
    Hi Nitass,

     

     

    Yep, that was exactly it, thank you for the help!

     

     

    Thanks,

     

    Jen
  • dubdub's avatar
    dubdub
    Icon for Nimbostratus rankNimbostratus
    Hi Nitass,

     

     

    Yep, that was exactly it, thank you for the help!

     

     

    Thanks,

     

    Jen