Forum Discussion

Robert_47833's avatar
Robert_47833
Icon for Altostratus rankAltostratus
Apr 22, 2015

call tmsh from irule for pool/monitor stuff

hi,dear irule

 

when lb failed triggered,and pool member is down,how can I get the info for which monitor marks pool member down and get the content of this monitor in irule?

 

read some posts,it seems there is one way to call tmsh commands/shell script in irule

 

could u kindly paste an example here?

 

9 Replies

  • hi,Nitass glad to hear from you again

     

    hmm,I know how to check it in logs

     

    but I want to get the info from irule or other place which I use http::respond to send back to broswer

     

    searched many posts,it seems sideband can achieve this

     

    pls advise

     

  • but I want to get the info from irule or other place which I use http::respond to send back to broswer

     

    i do not see anywhere else besides log which shows name of health monitor that marks a pool member down. so, it is not going to be straightforward to do.

     

  • Hi,Nitass

     

    Yeah,there is no straightforward way to do this.

     

    I kind of achieve this via code below.

     

    proc send_to_sideband { data } {
     this is the sideband processing procedure (function)
    
    set sbserver [connect -protocol TCP -timeout 500 -idle 10 -status conn_status "ip:port"]
    
     send the sideband request
    send -status send_status -timeout 500 $sbserver $data
    
     return the sideband response
    return [recv -status recv_status -timeout 300 $sbserver]
     }
    
    when LB_FAILED {
    set current_pool [string range [LB::server pool] 8 end]
    set pool_member [LB::server addr]
    set pool_member_port [LB::server port]
    set pool_member_status [LB::status]
    set req "GET /mgmt/tm/ltm/pool/$current_pool/    HTTP/1.1\r\nHost: localhost\r\nAuthorization: Basic anVjYW86Q2pqNTUxNjI1OTk=\r\n\r\n"
    set sb [call send_to_sideband $req]
    log local0.alert "sb is $sb"
       HTTP::respond 200 content [subst  -nobackslashes [ifile get f5_new_txt]]
     }

    it is sideband ,I reused code form other contributor in this forum(Thanks).

     

    but I am not sure whehter I can use icontrol command here since RESTAPI never give me a formatted response and it is difficult to filter out which monitor cause this pool down.

     

  • I kind of achieve this via code below.

     

    i do not think tmsh/rest provides health monitor name which marks a pool member down.

     

  • | Reason : udp: UDP recv: connection refused @2015/04/25 02:33:20.?

                            @(slcq013lba040)(cfg-sync Standalone)(Active)(/Common)(tmos) show ltm pool  xxxx_443 members
    
                 ---------------------------------------------------------------------
                 Ltm::Pool: xxxx_443             
                 ---------------------------------------------------------------------
                 Status                                 
                   Availability : offline               
                   State        : enabled               
                   Reason       : The children pool member(s) are down
                   Monitor      : 1-Check and xxxxxx
                   Minimum Active Members : 0           
                   Current Active Members : 0           
                           Total Requests : 3           
                         Current Sessions : 0           
    
                 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    
                   --------------------------------------------------------------
                   | Ltm::Pool Member: 1.1.1.1:443    
                   --------------------------------------------------------------
                   | Status                                 
                   |   Availability   : offline             
                   |   State          : enabled             
                   |   Reason         : udp: UDP recv: connection refused @2015/04/25 02:33:20. 
                   |   Monitor        :xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (pool monitor)
                   |   Monitor Status : down                
                   |   Session Status : enabled             
                   |   Pool Name      : SLCQ013-STC_443     
                   |   IP Address     : 1.1.1.1       
    

    |

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (END)
    • nitass's avatar
      nitass
      Icon for Employee rankEmployee
      have you tried to have multiple monitors? i understand tmsh won't tell which monitor marks a pool member down.
    • Robert_47833's avatar
      Robert_47833
      Icon for Altostratus rankAltostratus
      yeah,it can show the monitor ,but after I added other monitor ,it didn't show me the correct info,it shows the old monitor which marks pool down.... -------------------------------------------------------------- | Ltm::Pool Member: 1.1.1.1:443 -------------------------------------------------------------- | Status | Availability : offline | State : enabled | Reason : udp: UDP recv: connection refused @2015/04/25 02:33:20. | Monitor : test-Check and /Common/m1.1 (pool monitor) | Monitor Status : down | Session Status : enabled | Pool Name : xxxxx | IP Address : 1.1.1.1