iRule Maintenance Windows
A fun, but not well known, feature on BIG-IP is the Statistics Profile. This tech tip is the second in a series on how the Statistics Profile and iRules, when working together, can save time, product...
Published Apr 10, 2007
Version 1.0ASAT_6562
May 24, 2010Nimbostratus
I have had trouble getting this to work correctly. Even when the Octal number issue is resolved, the evaluation of current_time fails when the time real current time is between ));24 and 00:59. Using set cur_time [clock format [clock scan now] -format %H:%M] solved the issue for us and this is now happy in our production environment and works as expected.
My code from /check
"/check" {
Return the current time and the current settings for the maintenance window
set day [STATS::get $PROFILE_NAME "day"]
if { ($day < 1) } {
set day "No day set"
}
set start_time [clock format [clock scan [STATS::get $PROFILE_NAME "start_time"]] -format %H:%M]
set end_time [clock format [clock scan [STATS::get $PROFILE_NAME "end_time"]] -format %H:%M]
scan [clock format [clock seconds] -format {%A %k %M}] {%s %s %s} cur_day cur_hour cur_minute
set cur_time [clock format [clock scan now] -format %H:%M]
log local0. "\$cur_day: $cur_day, \$cur_hour: $cur_hour, \$cur_minute: $cur_minute, \$cur_time: $cur_time"
HTTP::respond 200 content [subst $::window_check_response]
}