Forum Discussion
Bob_10976
Mar 14, 2014Nimbostratus
Block traffic to node during specific time period
Hello all. I have a situation where we need to recycle our AppPools for two servers, that are in the same LTM Pool, during two different times, so I need to create an irule that will block traffic to...
IheartF5_45022
Nacreous
Here is an idea to get you started which used your link above as a starting point. It assumes that you only have 2 pool members so that during each maintenance period there is only one valid pool member
when CLIENT_ACCEPTED {
Set list of start and end times of each maintenance period
set lmaint {{0200 0230} {0300 0330}}
Set list of valid pool member for each maint period
set lmember {"1.1.1.1" "2.2.2.2"}
Set current date
set today [clock format $systemTime -format %D]
Get the current time in seconds since the Unix epoch of 0-0-1970
set now [clock seconds]
Cycle through each maintenance period, checking current time
foreach maint $lmaint member $lmember {
Convert start/end times to seconds from the epoch for easier date comparisons
set start [clock scan "$today [lindex $maint 0]" -format "%D %H%M"]
set end [clock scan "$today [lindex $maint 1]" -format "%D %H%M"]
Check if the current time is between the start and end times
if {$now > $start && $now < $end}{
pool [LB::server pool] member $member 80
}
}
Default action is to use the virtual server default pool
}
Mar 18, 2014
Sexy! :)
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects