Forum Discussion
Stuart_Myers_88
Nimbostratus
Dec 08, 2009GTM Pool Redirect based on time
This Works with HTTP_REQUEST, but when i try to use the same thing with DNS_REQUEST, i get:
01070151:3: Rule [redirect] error:
line 1: [undefined procedure:
($cur_time <= $maintenance_end_time) ] [{
($cur_time <= $maintenance_end_time) }
{pool STG_Training}]
line 5: [undefined procedure: },] [}, ]
line 6: [parse error: extra characters after close-quote] [) }]
Here is the Rule:
when DNS_REQUEST {
Change the following to set schedule
set maintenance_start_day "Saturday";
set maintenance_start_time "0000";
set maintenance_add_day_1 "Sunday";
set maintenance_add_day_2 "";
set maintenance_add_day_3 "";
set maintenance_add_day_4 "";
set maintenance_add_day_5 "";
set maintenance_end_day "Monday";
set maintenance_end_time "0400";
Get time in seconds, formatted as day of week (%A) hour (%k) minute (%M)
Use scan to save output as $cur_day $cur_hour $cur_minute
scan [clock format [clock seconds] -format {%A %k %M}] {%s %d %d} cur_day cur_hour cur_minute
set cur_time ${cur_hour}${cur_minute}
log local0. "\$cur_day: $cur_day, \$cur_hour: $cur_hour, \$cur_minute: $cur_minute, \$cur_time: $cur_time"
if { ($cur_day eq $maintenance_start_day) &&
($cur_time >= $maintenance_start_time) &&
($cur_time <= "2400") }
{pool STG_Training}
if { ($cur_day eq $maintenance_add_day_1) }
{pool STG_Training}
if { ($cur_day eq $maintenance_add_day_2) }
{pool STG_Training}
if { ($cur_day eq $maintenance_add_day_3) }
{pool STG_Training}
if { ($cur_day eq $maintenance_add_day_4) }
{pool STG_Training}
if { ($cur_day eq $maintenance_add_day_5) }
{pool STG_Training}
if { ($cur_day eq $maintenance_end_day) &&
($cur_time >= "0000") &&
($cur_time <= $maintenance_end_time) }
{pool STG_Training}
}
Anybody know if i can make this work?
- hoolio
Cirrostratus
I think it's just an issue with not escaping line breaks in your if statement:when DNS_REQUEST { Change the following to set schedule set maintenance_start_day "Saturday"; set maintenance_start_time "0000"; set maintenance_add_day_1 "Sunday"; set maintenance_add_day_2 ""; set maintenance_add_day_3 ""; set maintenance_add_day_4 ""; set maintenance_add_day_5 ""; set maintenance_end_day "Monday"; set maintenance_end_time "0400"; Get time in seconds, formatted as day of week (%A) hour (%k) minute (%M) Use scan to save output as $cur_day $cur_hour $cur_minute scan [clock format [clock seconds] -format {%A %k %M}] {%s %d %d} cur_day cur_hour cur_minute set cur_time ${cur_hour}${cur_minute} log local0. "\$cur_day: $cur_day, \$cur_hour: $cur_hour, \$cur_minute: $cur_minute, \$cur_time: $cur_time" if { ($cur_day eq $maintenance_start_day) && \ ($cur_time > $maintenance_start_time) && \ ($cur_time < "2400") }{ pool STG_Training } ...
- Stuart_Myers_88
Nimbostratus
Looks like it is still giving me an undefined procedure, any other ideas? - hoolio
Cirrostratus
I think the GTM iRule parser is different than the LTM iRule parser. Make sure to remove any trailing spaces after the backslashes in the $cur_day and $cur_time checks. Also, I had to remove the = from >= and <= to get the rule to load for GTM. I edited the post above with these changes. Can you give that a try?
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