Forum Discussion
raddboy_74501
Nimbostratus
Oct 01, 2010Force Pool members offline for Nightly Maintenance?
I've searched this forum for an answer to no avail.
I'm looking to "force offline" all members of a pool at a specific time every night, say 10:00pm. This will keep users out of an application during our nightly batch process. I'll also need to "Enable" these pool members at a specific time, say 2:00am, when the batch processing has completed.
Any thoughts?
We're on LTM Big-IP 9.3.1 Build 58.0
Kevin
- Ben_95489
Nimbostratus
Hey Kevin, - This should be doable with the clock command. I wrote a tech tip a while back titled "iRule Maintenance Windows" that allows you to use an iRule to enter the maintenance window times and it then stores those times in a stats profile. Then on inbound requests, if the windows are set, it uses the TCL "clock" command to get the local time of the BIG-IP. If the current time is during the window, the iRule returns a HTML response with an error indicating that maintenance mode is on.
- Ben_95489
Nimbostratus
Well, color me wrong! - Kevin_Davies_40
Nacreous
Was bored today and this looked interesting... hope it helps.F5 maintenance windows Maintenance windows are specified in a string datagroup called maintenance_windows, entries are space delimited in the following format, time is 24 hour. HH:MM HH:MM Mon [Wed] [Sat] [Any] Example would be 9:00 10:00 Mon Wed Fri 23:00 1:00 Any If you want a custom site down web page from your web server then create a node for the server in the maintenance pool and setup the /status page on your webserver. when HTTP_REQUEST { set data_source "maintenance_windows" set maint_pool "maintenance" current epoc time set cur_time [clock seconds] current day set cur_day [string tolower [clock format $cur_time -format "%a"]] foreach maint_window [class names $data_source] { scan [string tolower $maint_window] {%s %s %[^:]} min_time max_time maint_days log local0.debug "cur day $cur_day min $min_time max $max_time days $maint_days" convert time to epoc set min_time [clock scan $min_time] set max_time [clock scan $max_time] if {$max_time < $min_time} { set max_time [clock scan "tomorrow" -base $max_time] } is it the right day? set groundhog_day 0 if {$maint_days eq "any"} { set groundhog_day 1 } else { if {$maint_days contains $cur_day} { set groundhog_day 1 } } if {$groundhog_day eq 0} { continue } is it the right time? if {$cur_time < $min_time} { continue } if {$cur_time > $max_time} { continue } if we got this far then we are in a maintenance window if {[active_nodes $maint_pool] > 0} { HTTP::uri "/status" pool $maint_pool } else { HTTP::respond 200 content "Site is down for maintenance" } return } }
Note: I did have html tags around the 200 content above but this forum affects them so they were removed. If anyone can tell me the correct html tags I should be using to display iRule code I would appreciate it. Note editing does not display well in IE (esp preview mode). Should I be using a different browser?
- Kevin_Davies_40
Nacreous
Just an update,
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