Forum Discussion

JCMATTOS_41723's avatar
JCMATTOS_41723
Icon for Nimbostratus rankNimbostratus
Sep 11, 2009

Time of day loadbalance?

Hi we have an LTM 9.4.7 and wanted to see if it was possible to do a scheduled loadbalance based on time of day? In other words we would not want to loadbalance to a certain leg (pool member) during certain times of the day(s). What would be the best way to address this in an iRule or not? Or is this even possible?

3 Replies

  • Hi JC,

     

    I suppose it's possible. The iRule code could look something like the following:

     

     

        
     when HTTP_REQUEST { 
     set day "Thursday" 
     set starttime "2100" 
     set stoptime "2200" 
      
       Look for the current date of when the irule was processed 
       scan [clock format [clock seconds] -format { %A %H%M}] %s %s curday curtime  
        
       if {($day eq $curday) && ($curtime >= $starttime) && ($curtime <= $stoptime) } { 
                Code here will execute based on the day of time you want to execute this code 
          pool my_Pool member 10.1.2.200 80 
        } 
     } 
      
     

     

     

    I haven't testing this code out but I think it could be the bases of what you are looking for.

     

     

    I hope this helps

     

    CB
  • There appears to be space between %s where there shouldn't be.

     

     

    Try the following:

     

     

     
      when HTTP_REQUEST {  
      set day "Thursday"  
      set starttime "2100"  
      set stoptime "2200"  
      
        Look for the current date of when the irule was processed  
        scan [clock format [clock seconds] -format { %A %H%M}] %s%s curday curtime 
      
        if {($day eq $curday) && ($curtime >= $starttime) && ($curtime <= $stoptime) } {  
                 Code here will execute based on the day of time you want to execute this code  
           pool my_Pool member 10.1.2.200 80  
         }  
      }  
     

     

     

     

    CB

     

  • Here are a few other related posts which may give you guys ideas:

     

     

    Time based rule

     

    http://devcentral.f5.com/Default.aspx?tabid=53&forumid=5&tpage=1&view=topic&postid=57946

     

     

    Scheduled Maintenance Window

     

    http://devcentral.f5.com/Default.aspx?tabid=53&forumid=5&tpage=1&view=topic&postid=29608

     

     

    Aaron